diff --git a/ChangeLog b/ChangeLog index 37c6e031c..dad6c29e6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -9,6 +9,204 @@ * src/core/song_editor.cpp: Some of the files have been renamed, so I updated the include references to get the build to work again. + + * include/basic_filters.h: + Added the ability to clear the filter taps to support + a LPF where the threshold is set by the velocity of + the note. + + * configure.in: + * plugins/stk/voices/resonate/resonate_processor.h: + * plugins/stk/voices/voices/resonate/resonate_instrument.h: + * plugins/stk/voices/voices/resonate/resonate_model.cpp: + * plugins/stk/voices/voices/resonate/resonate_instrument_view.cpp: + * plugins/stk/voices/voices/resonate/artwork.png: + * plugins/stk/voices/voices/resonate/resonate_processor.cpp: + * plugins/stk/voices/voices/resonate/resonate_instrument_view.h: + * plugins/stk/voices/voices/resonate/resonate_instrument.cpp: + * plugins/stk/voices/voices/resonate/logo.png: + * plugins/stk/voices/voices/resonate/resonate_model.h: + * plugins/stk/voices/voices/resonate/Makefile.am: + * plugins/stk/voices/voices/flute/artwork.png: + * plugins/stk/voices/voices/flute/flute_processor.cpp: + * plugins/stk/voices/voices/flute/flute_instrument_view.h: + * plugins/stk/voices/voices/flute/flute_model.h: + * plugins/stk/voices/voices/flute/flute_processor.h: + * plugins/stk/voices/voices/flute/flute_model.cpp: + * plugins/stk/voices/voices/flute/logo.png: + * plugins/stk/voices/voices/flute/flute_instrument.h: + * plugins/stk/voices/voices/flute/Makefile.am: + * plugins/stk/voices/voices/flute/flute_instrument_view.cpp: + * plugins/stk/voices/voices/flute/flute_instrument.cpp: + * plugins/stk/voices/voices/metal/metal_processor.h: + * plugins/stk/voices/voices/metal/metal_instrument.cpp: + * plugins/stk/voices/voices/metal/metal_processor.cpp: + * plugins/stk/voices/voices/metal/artwork.png: + * plugins/stk/voices/voices/metal/metal_instrument_view.cpp: + * plugins/stk/voices/voices/metal/metal_instrument.h: + * plugins/stk/voices/voices/metal/logo.png: + * plugins/stk/voices/voices/metal/metal_instrument_view.h: + * plugins/stk/voices/voices/metal/metal_model.cpp: + * plugins/stk/voices/voices/metal/Makefile.am: + * plugins/stk/voices/voices/metal/metal_model.h: + * plugins/stk/voices/voices/fmvoices/fmvoices_instrument.cpp: + * plugins/stk/voices/voices/fmvoices/fmvoices_processor.h: + * plugins/stk/voices/voices/fmvoices/fmvoices_instrument.h: + * plugins/stk/voices/voices/fmvoices/artwork.png: + * plugins/stk/voices/voices/fmvoices/fmvoices_instrument_view.h: + * plugins/stk/voices/voices/fmvoices/fmvoices_instrument_view.cpp: + * plugins/stk/voices/voices/fmvoices/logo.png: + * plugins/stk/voices/voices/fmvoices/fmvoices_processor.cpp: + * plugins/stk/voices/voices/fmvoices/fmvoices_model.cpp: + * plugins/stk/voices/voices/fmvoices/fmvoices_model.h: + * plugins/stk/voices/voices/fmvoices/Makefile.am: + * plugins/stk/voices/voices/moog/moog_instrument_view.h: + * plugins/stk/voices/voices/moog/moog_instrument_view.cpp: + * plugins/stk/voices/voices/moog/moog_model.cpp: + * plugins/stk/voices/voices/moog/moog_processor.h: + * plugins/stk/voices/voices/moog/artwork.png: + * plugins/stk/voices/voices/moog/logo.png: + * plugins/stk/voices/voices/moog/moog_model.h: + * plugins/stk/voices/voices/moog/moog_instrument.h: + * plugins/stk/voices/voices/moog/moog_instrument.cpp: + * plugins/stk/voices/voices/moog/moog_processor.cpp: + * plugins/stk/voices/voices/moog/Makefile.am: + * plugins/stk/voices/voices/include/stk_instrument_view.h: + * plugins/stk/voices/voices/include/stk_voice.h: + * plugins/stk/voices/voices/include/stk_instrument.h: + * plugins/stk/voices/voices/include/stk_model.h: + * plugins/stk/voices/voices/include/stk_processor.h: + * plugins/stk/voices/voices/wurley/wurley_instrument.h: + * plugins/stk/voices/voices/wurley/wurley_instrument_view.cpp: + * plugins/stk/voices/voices/wurley/wurley_model.cpp: + * plugins/stk/voices/voices/wurley/wurley_instrument_view.h: + * plugins/stk/voices/voices/wurley/wurley_model.h: + * plugins/stk/voices/voices/wurley/artwork.png: + * plugins/stk/voices/voices/wurley/wurley_processor.h: + * plugins/stk/voices/voices/wurley/logo.png: + * plugins/stk/voices/voices/wurley/Makefile.am: + * plugins/stk/voices/voices/wurley/wurley_processor.cpp: + * plugins/stk/voices/voices/wurley/wurley_instrument.cpp: + * plugins/stk/voices/voices/bowed/bowed_instrument.cpp: + * plugins/stk/voices/voices/bowed/bowed_model.cpp: + * plugins/stk/voices/voices/bowed/bowed_instrument_view.cpp: + * plugins/stk/voices/voices/bowed/bowed_model.h: + * plugins/stk/voices/voices/bowed/bowed_processor.h: + * plugins/stk/voices/voices/bowed/artwork.png: + * plugins/stk/voices/voices/bowed/bowed_processor.cpp: + * plugins/stk/voices/voices/bowed/logo.png: + * plugins/stk/voices/voices/bowed/bowed_instrument_view.h: + * plugins/stk/voices/voices/bowed/Makefile.am: + * plugins/stk/voices/voices/bowed/bowed_instrument.h: + * plugins/stk/voices/voices/blow_hole/blow_hole_instrument.cpp: + * plugins/stk/voices/voices/blow_hole/blow_hole_instrument_view.cpp: + * plugins/stk/voices/voices/blow_hole/artwork.png: + * plugins/stk/voices/voices/blow_hole/blow_hole_model.h: + * plugins/stk/voices/voices/blow_hole/blow_hole_processor.h: + * plugins/stk/voices/voices/blow_hole/logo.png: + * plugins/stk/voices/voices/blow_hole/blow_hole_processor.cpp: + * plugins/stk/voices/voices/blow_hole/blow_hole_instrument_view.h: + * plugins/stk/voices/voices/blow_hole/blow_hole_model.cpp: + * plugins/stk/voices/voices/blow_hole/Makefile.am: + * plugins/stk/voices/voices/blow_hole/blow_hole_instrument.h: + * plugins/stk/voices/voices/rhodey/rhodey_instrument_view.h: + * plugins/stk/voices/voices/rhodey/rhodey_processor.h: + * plugins/stk/voices/voices/rhodey/rhodey_processor.cpp: + * plugins/stk/voices/voices/rhodey/rhodey_instrument_view.cpp: + * plugins/stk/voices/voices/rhodey/artwork.png: + * plugins/stk/voices/voices/rhodey/rhodey_model.cpp: + * plugins/stk/voices/voices/rhodey/rhodey_model.h: + * plugins/stk/voices/voices/rhodey/rhodey_instrument.h: + * plugins/stk/voices/voices/rhodey/logo.png: + * plugins/stk/voices/voices/rhodey/rhodey_instrument.cpp: + * plugins/stk/voices/voices/rhodey/Makefile.am: + * plugins/stk/voices/voices/tubebell/tubebell_processor.cpp: + * plugins/stk/voices/voices/tubebell/tubebell_instrument_view.h: + * plugins/stk/voices/voices/tubebell/artwork.png: + * plugins/stk/voices/voices/tubebell/tubebell_instrument.h: + * plugins/stk/voices/voices/tubebell/tubebell_instrument.cpp: + * plugins/stk/voices/voices/tubebell/tubebell_model.h: + * plugins/stk/voices/voices/tubebell/logo.png: + * plugins/stk/voices/voices/tubebell/tubebell_model.cpp: + * plugins/stk/voices/voices/tubebell/tubebell_instrument_view.cpp: + * plugins/stk/voices/voices/tubebell/Makefile.am: + * plugins/stk/voices/voices/tubebell/tubebell_processor.h: + * plugins/stk/voices/voices/clarinet/clarinet_instrument.cpp: + * plugins/stk/voices/voices/clarinet/artwork.png: + * plugins/stk/voices/voices/clarinet/clarinet_processor.h: + * plugins/stk/voices/voices/clarinet/clarinet_processor.cpp: + * plugins/stk/voices/voices/clarinet/clarinet_instrument.h: + * plugins/stk/voices/voices/clarinet/clarinet_model.cpp: + * plugins/stk/voices/voices/clarinet/logo.png: + * plugins/stk/voices/voices/clarinet/clarinet_instrument_view.cpp: + * plugins/stk/voices/voices/clarinet/clarinet_model.h: + * plugins/stk/voices/voices/clarinet/Makefile.am: + * plugins/stk/voices/voices/clarinet/clarinet_instrument_view.h: + * plugins/stk/voices/voices/b3/b3_instrument.cpp: + * plugins/stk/voices/voices/b3/b3_model.h: + * plugins/stk/voices/voices/b3/b3_model.cpp: + * plugins/stk/voices/voices/b3/artwork.png: + * plugins/stk/voices/voices/b3/b3_instrument_view.h: + * plugins/stk/voices/voices/b3/logo.png: + * plugins/stk/voices/voices/b3/b3_processor.h: + * plugins/stk/voices/voices/b3/b3_instrument_view.cpp: + * plugins/stk/voices/voices/b3/b3_instrument.h: + * plugins/stk/voices/voices/b3/b3_processor.cpp: + * plugins/stk/voices/voices/b3/Makefile.am: + * plugins/stk/voices/voices/src/stk_model.cpp: + * plugins/stk/voices/voices/percflute/percflute_instrument.h: + * plugins/stk/voices/voices/percflute/percflute_model.h: + * plugins/stk/voices/voices/percflute/percflute_instrument_view.h: + * plugins/stk/voices/voices/percflute/percflute_processor.cpp: + * plugins/stk/voices/voices/percflute/percflute_processor.h: + * plugins/stk/voices/voices/percflute/artwork.png: + * plugins/stk/voices/voices/percflute/percflute_instrument_view.cpp: + * plugins/stk/voices/voices/percflute/percflute_instrument.cpp: + * plugins/stk/voices/voices/percflute/logo.png: + * plugins/stk/voices/voices/percflute/percflute_model.cpp: + * plugins/stk/voices/voices/percflute/Makefile.am: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_processor.cpp: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_model.h: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_model.cpp: + * plugins/stk/voices/voices/blow_bottle/artwork.png: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_processor.h: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_instrument.h: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_instrument_view.cpp: + * plugins/stk/voices/voices/blow_bottle/logo.png: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_instrument_view.h: + * plugins/stk/voices/voices/blow_bottle/blow_bottle_instrument.cpp: + * plugins/stk/voices/voices/blow_bottle/Makefile.am: + * plugins/stk/voices/voices/Makefile.am: + * plugins/stk/voices/voices/brass/brass_instrument_view.h: + * plugins/stk/voices/voices/brass/brass_instrument.cpp: + * plugins/stk/voices/voices/brass/brass_processor.h: + * plugins/stk/voices/voices/brass/brass_processor.cpp: + * plugins/stk/voices/voices/brass/brass_instrument_view.cpp: + * plugins/stk/voices/voices/brass/artwork.png: + * plugins/stk/voices/voices/brass/brass_instrument.h: + * plugins/stk/voices/voices/brass/logo.png: + * plugins/stk/voices/voices/brass/brass_model.cpp: + * plugins/stk/voices/voices/brass/brass_model.h: + * plugins/stk/voices/voices/brass/Makefile.am: + * plugins/stk/voices/voices/bandedwg/bandedwg_processor.h: + * plugins/stk/voices/voices/bandedwg/bandedwg_instrument_view.h: + * plugins/stk/voices/voices/bandedwg/bandedwg_processor.cpp: + * plugins/stk/voices/voices/bandedwg/artwork.png: + * plugins/stk/voices/voices/bandedwg/bandedwg_model.h: + * plugins/stk/voices/voices/bandedwg/bandedwg_instrument.h: + * plugins/stk/voices/voices/bandedwg/bandedwg_instrument.cpp: + * plugins/stk/voices/voices/bandedwg/bandedwg_instrument_view.cpp: + * plugins/stk/voices/voices/bandedwg/logo.png: + * plugins/stk/voices/voices/bandedwg/bandedwg_model.cpp: + * plugins/stk/voices/voices/bandedwg/Makefile.am: + Started working on a multitimbral instrument that uses all of the + voices available in STK. Need to work out the differences in + level among the voices and figure out what the controls actually + do. Simplist way to do that was to build them as individual + instruments first. The models, views, and processors should be + reusable for the larger instrument. Except for bandedwg and + flute they all work, so if you're curious, add "voices" to the + Makefile.am in plugins/stk to get them to build. 2007-01-30 Paul Giblock * plugins/organic/organic.cpp: diff --git a/configure.in b/configure.in index ec73a9e28..0c8b1edc7 100644 --- a/configure.in +++ b/configure.in @@ -658,6 +658,23 @@ AC_CONFIG_FILES([Makefile plugins/singerbot/Makefile plugins/stk/Makefile plugins/stk/mallets/Makefile + plugins/stk/voices/Makefile + plugins/stk/voices/b3/Makefile + plugins/stk/voices/bandedwg/Makefile + plugins/stk/voices/blow_bottle/Makefile + plugins/stk/voices/blow_hole/Makefile + plugins/stk/voices/bowed/Makefile + plugins/stk/voices/brass/Makefile + plugins/stk/voices/clarinet/Makefile + plugins/stk/voices/flute/Makefile + plugins/stk/voices/fmvoices/Makefile + plugins/stk/voices/metal/Makefile + plugins/stk/voices/moog/Makefile + plugins/stk/voices/percflute/Makefile + plugins/stk/voices/resonate/Makefile + plugins/stk/voices/rhodey/Makefile + plugins/stk/voices/tubebell/Makefile + plugins/stk/voices/wurley/Makefile plugins/triple_oscillator/Makefile plugins/vestige/Makefile plugins/vibed/Makefile diff --git a/include/basic_filters.h b/include/basic_filters.h index 1f4856446..6dc697519 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -92,17 +92,7 @@ public: m_sampleRate( _sample_rate ), m_subFilter( NULL ) { - // reset in/out history - for( ch_cnt_t _chnl = 0; _chnl < CHANNELS; ++_chnl ) - { - // reset in/out history for simple filters - m_ou1[_chnl] = m_ou2[_chnl] = m_in1[_chnl] = - m_in2[_chnl] = 0.0f; - // reset in/out historey for moog-filter - m_y1[_chnl] = m_y2[_chnl] = m_y3[_chnl] = m_y4[_chnl] = - m_oldx[_chnl] = m_oldy1[_chnl] = - m_oldy2[_chnl] = m_oldy3[_chnl] = 0.0f; - } + clearHistory(); } inline ~basicFilters() @@ -110,6 +100,21 @@ public: delete m_subFilter; } + inline void clearHistory( void ) + { + // reset in/out history + for( ch_cnt_t _chnl = 0; _chnl < CHANNELS; ++_chnl ) + { + // reset in/out history for simple filters + m_ou1[_chnl] = m_ou2[_chnl] = m_in1[_chnl] = + m_in2[_chnl] = 0.0f; + // reset in/out historey for moog-filter + m_y1[_chnl] = m_y2[_chnl] = m_y3[_chnl] = m_y4[_chnl] = + m_oldx[_chnl] = m_oldy1[_chnl] = + m_oldy2[_chnl] = m_oldy3[_chnl] = 0.0f; + } + } + inline sample_t update( sample_t _in0, ch_cnt_t _chnl ) { sample_t out; diff --git a/plugins/stk/Makefile.am b/plugins/stk/Makefile.am index 243a8fd79..4eb93be39 100644 --- a/plugins/stk/Makefile.am +++ b/plugins/stk/Makefile.am @@ -1 +1,2 @@ -SUBDIRS = mallets +SUBDIRS = mallets +# voices \ No newline at end of file diff --git a/plugins/stk/voices/Makefile.am b/plugins/stk/voices/Makefile.am new file mode 100644 index 000000000..1e547a463 --- /dev/null +++ b/plugins/stk/voices/Makefile.am @@ -0,0 +1,16 @@ +SUBDIRS = b3 \ + bandedwg \ + blow_bottle \ + blow_hole \ + bowed \ + brass \ + clarinet \ + flute \ + fmvoices \ + metal \ + moog \ + percflute \ + resonate \ + rhodey \ + tubebell \ + wurley diff --git a/plugins/stk/voices/b3/Makefile.am b/plugins/stk/voices/b3/Makefile.am new file mode 100644 index 000000000..14cf364ed --- /dev/null +++ b/plugins/stk/voices/b3/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="b3" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./b3_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libb3.la + +libb3_la_SOURCES = b3_model.cpp \ + b3_model.h \ + b3_processor.cpp \ + b3_processor.h \ + b3_instrument.cpp \ + b3_instrument.h \ + b3_instrument_view.cpp \ + b3_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libb3_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libb3_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/b3/artwork.png b/plugins/stk/voices/b3/artwork.png new file mode 100644 index 000000000..b843c16ec Binary files /dev/null and b/plugins/stk/voices/b3/artwork.png differ diff --git a/plugins/stk/voices/b3/b3_instrument.cpp b/plugins/stk/voices/b3/b3_instrument.cpp new file mode 100644 index 000000000..d1e621486 --- /dev/null +++ b/plugins/stk/voices/b3/b3_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "b3_instrument.h" +#include "b3_instrument_view.h" +#include "b3_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor b3_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "B3", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Organ noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +b3Instrument::b3Instrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &b3_plugin_descriptor ) +{ + model()->operator4()->setTrack( _channel_track ); + model()->operator3()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +b3Instrument::~b3Instrument() +{ +} + + + + +QString b3Instrument::nodeName( void ) const +{ + return( b3_plugin_descriptor.name ); +} + + + + +pluginView * b3Instrument::instantiateView( QWidget * _parent ) +{ + return( new b3InstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new b3Instrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/b3/b3_instrument.h b/plugins/stk/voices/b3/b3_instrument.h new file mode 100644 index 000000000..405f699e4 --- /dev/null +++ b/plugins/stk/voices/b3/b3_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _B3_INSTRUMENT_H +#define _B3_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "b3_processor.h" +#include "b3_model.h" + + +class b3Instrument : public stkInstrument +{ +public: + b3Instrument( instrumentTrack * _channel_track ); + virtual ~b3Instrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/b3/b3_instrument_view.cpp b/plugins/stk/voices/b3/b3_instrument_view.cpp new file mode 100644 index 000000000..459bafab4 --- /dev/null +++ b/plugins/stk/voices/b3/b3_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "b3_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +b3InstrumentView::b3InstrumentView( b3Instrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_operator4 = new knob( knobSmall_17, m_topView, tr( "Operator 4" ) ); + m_operator4->setLabel( tr( "Operator 4" ) ); + m_operator4->setHintText( tr( "Operator 4:" ) + " ", "" ); + + m_operator3 = new knob( knobSmall_17, m_topView, tr( "Operator 3" ) ); + m_operator3->setLabel( tr( "Operator 3" ) ); + m_operator3->setHintText( tr( "Operator 3:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_operator4 ); + h1->addWidget( m_operator3 ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +b3InstrumentView::~b3InstrumentView() +{ +} + + + + +void b3InstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + b3Instrument * inst = castModel(); + m_operator4->setModel( inst->model()->operator4() ); + m_operator3->setModel( inst->model()->operator3() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/b3/b3_instrument_view.h b/plugins/stk/voices/b3/b3_instrument_view.h new file mode 100644 index 000000000..4757163bc --- /dev/null +++ b/plugins/stk/voices/b3/b3_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _B3_INSTRUMENT_VIEW_H +#define _B3_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "b3_instrument.h" + + +class b3InstrumentView: public stkInstrumentView +{ +public: + b3InstrumentView( b3Instrument * _instrument, QWidget * _parent ); + virtual ~b3InstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_operator4; + knob * m_operator3; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/b3/b3_model.cpp b/plugins/stk/voices/b3/b3_model.cpp new file mode 100644 index 000000000..a1738546f --- /dev/null +++ b/plugins/stk/voices/b3/b3_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "b3_model.h" + + +b3Model::b3Model( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _operator4, + StkFloat _operator3, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_operator4( new floatModel( _operator4, 0.0f, 128.0f, 0.1f, this ) ), + m_operator3( new floatModel( _operator3, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +b3Model::~b3Model() +{ + delete m_operator4; + delete m_operator3; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL b3Model::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_operator4->saveSettings( _doc, _parent, "operator4" ); + m_operator3->saveSettings( _doc, _parent, "operator3" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL b3Model::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_operator4->loadSettings( _this, "operator4" ); + m_operator3->loadSettings( _this, "operator3" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/b3/b3_model.h b/plugins/stk/voices/b3/b3_model.h new file mode 100644 index 000000000..d427c1fa8 --- /dev/null +++ b/plugins/stk/voices/b3/b3_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _B3_MODEL_H +#define _B3_MODEL_H + +#include "stk_model.h" + + +class b3Model: public stkModel +{ +public: + b3Model( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _operator4 = 64.0f, + StkFloat _operator3 = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~b3Model(); + + inline floatModel * operator4( void ) const + { + return( m_operator4 ); + } + + inline floatModel * operator3( void ) const + { + return( m_operator3 ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_operator4; + floatModel * m_operator3; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/b3/b3_processor.cpp b/plugins/stk/voices/b3/b3_processor.cpp new file mode 100644 index 000000000..e05ff7eb7 --- /dev/null +++ b/plugins/stk/voices/b3/b3_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "b3_processor.h" +#include "config_mgr.h" + + +b3Processor::b3Processor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +b3Processor::~b3Processor() +{ +} + + + + +void b3Processor::setControls( b3Model * _model ) +{ + voice()->controlChange( 2, _model->operator4()->value() ); + voice()->controlChange( 4, _model->operator3()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/b3/b3_processor.h b/plugins/stk/voices/b3/b3_processor.h new file mode 100644 index 000000000..df225bc7f --- /dev/null +++ b/plugins/stk/voices/b3/b3_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _B3_PROCESSOR_H +#define _B3_PROCESSOR_H + +#include "BeeThree.h" + +#include "stk_processor.h" + +#include "b3_model.h" + +class b3Processor: public stkProcessor +{ +public: + b3Processor( sample_rate_t _sample_rate ); + ~b3Processor( void ); + + void setControls( b3Model * _model ); +}; + +#endif diff --git a/plugins/stk/voices/b3/logo.png b/plugins/stk/voices/b3/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/b3/logo.png differ diff --git a/plugins/stk/voices/bandedwg/Makefile.am b/plugins/stk/voices/bandedwg/Makefile.am new file mode 100644 index 000000000..cb8c8e10a --- /dev/null +++ b/plugins/stk/voices/bandedwg/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="bandedwg" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./bandedwg_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libbandedwg.la + +libbandedwg_la_SOURCES = bandedwg_model.cpp \ + bandedwg_model.h \ + bandedwg_processor.cpp \ + bandedwg_processor.h \ + bandedwg_instrument.cpp \ + bandedwg_instrument.h \ + bandedwg_instrument_view.cpp \ + bandedwg_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libbandedwg_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libbandedwg_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/bandedwg/artwork.png b/plugins/stk/voices/bandedwg/artwork.png new file mode 100644 index 000000000..7178e5a76 Binary files /dev/null and b/plugins/stk/voices/bandedwg/artwork.png differ diff --git a/plugins/stk/voices/bandedwg/bandedwg_instrument.cpp b/plugins/stk/voices/bandedwg/bandedwg_instrument.cpp new file mode 100644 index 000000000..fcaf3a70f --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_instrument.cpp @@ -0,0 +1,105 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "bandedwg_instrument.h" +#include "bandedwg_instrument_view.h" +#include "bandedwg_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor bandedwg_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Banded Wave Guide", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Bowed or struck objects" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +bandedWGInstrument::bandedWGInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &bandedwg_plugin_descriptor ) +{ + model()->bowPressure()->setTrack( _channel_track ); + model()->bowPosition()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); + model()->bowVelocity()->setTrack( _channel_track ); + model()->setStrike()->setTrack( _channel_track ); + model()->sound()->setTrack( _channel_track ); +} + + + + +bandedWGInstrument::~bandedWGInstrument() +{ +} + + + + +QString bandedWGInstrument::nodeName( void ) const +{ + return( bandedwg_plugin_descriptor.name ); +} + + + + +pluginView * bandedWGInstrument::instantiateView( QWidget * _parent ) +{ + return( new bandedWGInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new bandedWGInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/bandedwg/bandedwg_instrument.h b/plugins/stk/voices/bandedwg/bandedwg_instrument.h new file mode 100644 index 000000000..4befeca2f --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BANDEDWG_INSTRUMENT_H +#define _BANDEDWG_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "bandedwg_processor.h" +#include "bandedwg_model.h" + + +class bandedWGInstrument : public stkInstrument +{ +public: + bandedWGInstrument( instrumentTrack * _channel_track ); + virtual ~bandedWGInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/bandedwg/bandedwg_instrument_view.cpp b/plugins/stk/voices/bandedwg/bandedwg_instrument_view.cpp new file mode 100644 index 000000000..fb231b404 --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_instrument_view.cpp @@ -0,0 +1,121 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "bandedwg_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +bandedWGInstrumentView::bandedWGInstrumentView( bandedWGInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout; + QHBoxLayout * h2 = new QHBoxLayout; + QHBoxLayout * h3 = new QHBoxLayout; + + m_bowPressure = new knob( knobSmall_17, m_topView, tr( "Pressure" ) ); + m_bowPressure->setLabel( tr( "Bow Pressure" ) ); + m_bowPressure->setHintText( tr( "Pressure:" ) + " ", "" ); + + m_bowPosition = new knob( knobSmall_17, m_topView, tr( "Position" ) ); + m_bowPosition->setLabel( tr( "Bow Position" ) ); + m_bowPosition->setHintText( tr( "Position:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Vib Freq:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "Vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + m_bowVelocity = new knob( knobSmall_17, m_topView, tr( "Bow Vel" ) ); + m_bowVelocity->setLabel( tr( "Bow Velocity" ) ); + m_bowVelocity->setHintText( tr( "Velocity" ) + " ", "" ); + + m_setStrike = new knob( knobSmall_17, m_topView, tr( "Strike" ) ); + m_setStrike->setLabel( tr( "Set Strike" ) ); + m_setStrike->setHintText( tr( "Strike" ) + " ", "" ); + + m_sound = new knob( knobSmall_17, m_topView, tr( "Instrument" ) ); + m_sound->setLabel( tr( "Instrument" ) ); + m_sound->setHintText( tr( "Instrument" ) + " ", "" ); + + h1->addWidget( m_bowPressure ); + h1->addWidget( m_bowPosition ); + + h2->addWidget( m_vibratoFrequency ); + h2->addWidget( m_vibratoGain ); + + h3->addWidget( m_bowVelocity ); + h3->addWidget( m_setStrike ); + h3->addWidget( m_sound ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +bandedWGInstrumentView::~bandedWGInstrumentView() +{ +} + + + + +void bandedWGInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + bandedWGInstrument * inst = castModel(); + m_bowPressure->setModel( inst->model()->bowPressure() ); + m_bowPosition->setModel( inst->model()->bowPosition() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); + m_bowVelocity->setModel( inst->model()->bowVelocity() ); + m_setStrike->setModel( inst->model()->setStrike() ); + m_sound->setModel( inst->model()->sound() ); +} + + + diff --git a/plugins/stk/voices/bandedwg/bandedwg_instrument_view.h b/plugins/stk/voices/bandedwg/bandedwg_instrument_view.h new file mode 100644 index 000000000..f99b86c77 --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_instrument_view.h @@ -0,0 +1,53 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BANDEDWG_INSTRUMENT_VIEW_H +#define _BANDEDWG_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "bandedwg_instrument.h" + + +class bandedWGInstrumentView: public stkInstrumentView +{ +public: + bandedWGInstrumentView( bandedWGInstrument * _instrument, QWidget * _parent ); + virtual ~bandedWGInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_bowPressure; + knob * m_bowPosition; + knob * m_vibratoFrequency; + knob * m_vibratoGain; + knob * m_bowVelocity; + knob * m_setStrike; + knob * m_sound; +}; + +#endif diff --git a/plugins/stk/voices/bandedwg/bandedwg_model.cpp b/plugins/stk/voices/bandedwg/bandedwg_model.cpp new file mode 100644 index 000000000..1d8de189e --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_model.cpp @@ -0,0 +1,98 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "bandedwg_model.h" + + +bandedWGModel::bandedWGModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _bow_pressure, + StkFloat _bow_position, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain, + StkFloat _bow_velocity, + StkFloat _set_strike, + StkFloat _sound ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_bowPressure( new floatModel( _bow_pressure, 0.0f, 128.0f, 0.1f, this ) ), + m_bowPosition( new floatModel( _bow_position, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_bowVelocity( new floatModel( _bow_velocity, 0.0f, 128.0f, 0.1f, this ) ), + m_setStrike( new floatModel( _set_strike, 0.0f, 128.0f, 0.1f, this ) ), + m_sound( new floatModel( _sound, 0.0f, 3.0f, 1.0f, this ) ) +{ +} + + + + +bandedWGModel::~bandedWGModel() +{ + delete m_bowPressure; + delete m_bowPosition; + delete m_vibratoFrequency; + delete m_vibratoGain; + delete m_bowVelocity; + delete m_setStrike; + delete m_sound; +} + + + + +void FASTCALL bandedWGModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_bowPressure->saveSettings( _doc, _parent, "bowpressure" ); + m_bowPosition->saveSettings( _doc, _parent, "bowgain" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); + m_bowVelocity->saveSettings( _doc, _parent, "bowvelocity" ); + m_setStrike->saveSettings( _doc, _parent, "setstrike" ); + m_sound->saveSettings( _doc, _parent, "sound" ); +} + + + + +void FASTCALL bandedWGModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_bowPressure->loadSettings( _this, "bowpressure" ); + m_bowPosition->loadSettings( _this, "bowposition" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); + m_bowVelocity->loadSettings( _this, "bowvelocity" ); + m_setStrike->loadSettings( _this, "setstrike" ); + m_sound->loadSettings( _this, "sound" ); +} + diff --git a/plugins/stk/voices/bandedwg/bandedwg_model.h b/plugins/stk/voices/bandedwg/bandedwg_model.h new file mode 100644 index 000000000..fd65b7bcf --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_model.h @@ -0,0 +1,100 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BANDEDWG_MODEL_H +#define _BANDEDWG_MODEL_H + +#include "stk_model.h" + + +class bandedWGModel: public stkModel +{ +public: + bandedWGModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _bow_pressure = 64.0f, + StkFloat _bow_position = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f, + StkFloat _bow_velocity = 64.0f, + StkFloat _set_strike = 64.0f, + StkFloat _sound = 0.0f ); + ~bandedWGModel(); + + inline floatModel * bowPressure( void ) const + { + return( m_bowPressure ); + } + + inline floatModel * bowPosition( void ) const + { + return( m_bowPosition ); + } + + inline floatModel * vibratoFrequency( void ) const + { + return( m_vibratoFrequency ); + } + + inline floatModel * vibratoGain( void ) const + { + return( m_vibratoGain ); + } + + inline floatModel * bowVelocity( void ) const + { + return( m_bowVelocity ); + } + + inline floatModel * setStrike( void ) const + { + return( m_setStrike ); + } + + inline floatModel * sound( void ) const + { + return( m_sound ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_bowPressure; + floatModel * m_bowPosition; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; + floatModel * m_bowVelocity; + floatModel * m_setStrike; + floatModel * m_sound; +}; + +#endif diff --git a/plugins/stk/voices/bandedwg/bandedwg_processor.cpp b/plugins/stk/voices/bandedwg/bandedwg_processor.cpp new file mode 100644 index 000000000..fef8f88bb --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_processor.cpp @@ -0,0 +1,53 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "bandedwg_processor.h" +#include "config_mgr.h" + + +bandedWGProcessor::bandedWGProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +bandedWGProcessor::~bandedWGProcessor() +{ +} + + + + +void bandedWGProcessor::setControls( bandedWGModel * _model ) +{ + voice()->controlChange( 2, _model->bowPressure()->value() ); + voice()->controlChange( 4, _model->bowPosition()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 1, _model->vibratoGain()->value() ); + voice()->controlChange( 128, _model->bowVelocity()->value() ); + voice()->controlChange( 64, _model->setStrike()->value() ); + voice()->controlChange( 16, _model->sound()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/bandedwg/bandedwg_processor.h b/plugins/stk/voices/bandedwg/bandedwg_processor.h new file mode 100644 index 000000000..ed147b53d --- /dev/null +++ b/plugins/stk/voices/bandedwg/bandedwg_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BANDEDWG_PROCESSOR_H +#define _BANDEDWG_PROCESSOR_H + +#include "BandedWG.h" + +#include "stk_processor.h" + +#include "bandedwg_model.h" + +class bandedWGProcessor: public stkProcessor +{ +public: + bandedWGProcessor( sample_rate_t _sample_rate ); + ~bandedWGProcessor( void ); + + void setControls( bandedWGModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/bandedwg/logo.png b/plugins/stk/voices/bandedwg/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/bandedwg/logo.png differ diff --git a/plugins/stk/voices/blow_bottle/Makefile.am b/plugins/stk/voices/blow_bottle/Makefile.am new file mode 100644 index 000000000..4543314df --- /dev/null +++ b/plugins/stk/voices/blow_bottle/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="blowbottle" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./blow_bottle_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libblowbottle.la + +libblowbottle_la_SOURCES = blow_bottle_model.cpp \ + blow_bottle_model.h \ + blow_bottle_processor.cpp \ + blow_bottle_processor.h \ + blow_bottle_instrument.cpp \ + blow_bottle_instrument.h \ + blow_bottle_instrument_view.cpp \ + blow_bottle_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libblowbottle_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libblowbottle_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/blow_bottle/artwork.png b/plugins/stk/voices/blow_bottle/artwork.png new file mode 100644 index 000000000..3e33f5ba7 Binary files /dev/null and b/plugins/stk/voices/blow_bottle/artwork.png differ diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_instrument.cpp b/plugins/stk/voices/blow_bottle/blow_bottle_instrument.cpp new file mode 100644 index 000000000..3890df7b4 --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_instrument.cpp @@ -0,0 +1,102 @@ +/* + * blow_bottle_instrument.cpp - interface to lmms for blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "blow_bottle_instrument.h" +#include "blow_bottle_instrument_view.h" +#include "blow_bottle_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor blowbottle_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Blow Bottle", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Blown bottle noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +blowBottleInstrument::blowBottleInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &blowbottle_plugin_descriptor ) +{ + model()->noiseGain()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); +} + + + + +blowBottleInstrument::~blowBottleInstrument() +{ +} + + + + +QString blowBottleInstrument::nodeName( void ) const +{ + return( blowbottle_plugin_descriptor.name ); +} + + + + +pluginView * blowBottleInstrument::instantiateView( QWidget * _parent ) +{ + return( new blowBottleInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new blowBottleInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_instrument.h b/plugins/stk/voices/blow_bottle/blow_bottle_instrument.h new file mode 100644 index 000000000..66f6cef02 --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_instrument.h @@ -0,0 +1,47 @@ +/* + * blow_bottle_instrument.h - interface to lmms for blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BLOW_BOTTLE_INSTRUMENT_H +#define _BLOW_BOTTLE_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "blow_bottle_processor.h" +#include "blow_bottle_model.h" + + +class blowBottleInstrument : public stkInstrument +{ +public: + blowBottleInstrument( instrumentTrack * _channel_track ); + virtual ~blowBottleInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_instrument_view.cpp b/plugins/stk/voices/blow_bottle/blow_bottle_instrument_view.cpp new file mode 100644 index 000000000..61fe9a051 --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_instrument_view.cpp @@ -0,0 +1,89 @@ +/* + * blow_bottle_instrument_view.cpp - gui interface to blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "blow_bottle_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +blowBottleInstrumentView::blowBottleInstrumentView( blowBottleInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + + m_noiseGain = new knob( knobSmall_17, m_topView, tr( "Noise" ) ); + m_noiseGain->setLabel( tr( "Noise Gain" ) ); + m_noiseGain->setHintText( tr( "Noise:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Vib Freq:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "Vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + vl->addWidget( m_noiseGain ); + vl->addWidget( m_vibratoFrequency ); + vl->addWidget( m_vibratoGain ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +blowBottleInstrumentView::~blowBottleInstrumentView() +{ +} + + + + +void blowBottleInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + blowBottleInstrument * inst = castModel(); + m_noiseGain->setModel( inst->model()->noiseGain() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); +} + + + diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_instrument_view.h b/plugins/stk/voices/blow_bottle/blow_bottle_instrument_view.h new file mode 100644 index 000000000..38e9e8dc3 --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_instrument_view.h @@ -0,0 +1,50 @@ +/* + * blow_bottle_instrument_view.h - gui interface to blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BLOW_BOTTLE_INSTRUMENT_VIEW_H +#define _BLOW_BOTTLE_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "blow_bottle_instrument.h" + + +class blowBottleInstrumentView: public stkInstrumentView +{ +public: + blowBottleInstrumentView( blowBottleInstrument * _instrument, QWidget * _parent ); + virtual ~blowBottleInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_noiseGain; + knob * m_vibratoFrequency; + knob * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_model.cpp b/plugins/stk/voices/blow_bottle/blow_bottle_model.cpp new file mode 100644 index 000000000..8e304907a --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_model.cpp @@ -0,0 +1,79 @@ +/* + * blow_bottle_model.cpp - data storage for blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "blow_bottle_model.h" + + +blowBottleModel::blowBottleModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _noise_gain, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_noiseGain( new floatModel( _noise_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +blowBottleModel::~blowBottleModel() +{ + delete m_noiseGain; + delete m_vibratoFrequency; + delete m_vibratoGain; +} + + + + +void FASTCALL blowBottleModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_noiseGain->saveSettings( _doc, _parent, "noisegain" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); +} + + + + +void FASTCALL blowBottleModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_noiseGain->loadSettings( _this, "noisegain" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); +} + diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_model.h b/plugins/stk/voices/blow_bottle/blow_bottle_model.h new file mode 100644 index 000000000..52d9dee08 --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_model.h @@ -0,0 +1,63 @@ +/* + * blow_bottle_model.h - data storage for blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BLOW_BOTTLE_MODEL_H +#define _BLOW_BOTTLE_MODEL_H + +#include "stk_model.h" + + +class blowBottleModel: public stkModel +{ +public: + blowBottleModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _noise_gain = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f ); + ~blowBottleModel(); + + inline floatModel * noiseGain( void ) { return( m_noiseGain ); } + inline floatModel * vibratoFrequency( void ) { return( m_vibratoFrequency ); } + inline floatModel * vibratoGain( void ) { return( m_vibratoGain ); } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_noiseGain; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; + floatModel * m_volume; +}; + +#endif diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_processor.cpp b/plugins/stk/voices/blow_bottle/blow_bottle_processor.cpp new file mode 100644 index 000000000..f65239356 --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_processor.cpp @@ -0,0 +1,53 @@ +/* + * blow_bottle_processor.cpp - sound generator for blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "BlowBotl.h" + +#include "blow_bottle_processor.h" +#include "config_mgr.h" + + +blowBottleProcessor::blowBottleProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +blowBottleProcessor::~blowBottleProcessor() +{ +} + + + + +void blowBottleProcessor::setControls( blowBottleModel * _model ) +{ + voice()->controlChange( 1, _model->vibratoGain()->value() ); + voice()->controlChange( 4, _model->noiseGain()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 128, _model->volume()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/blow_bottle/blow_bottle_processor.h b/plugins/stk/voices/blow_bottle/blow_bottle_processor.h new file mode 100644 index 000000000..f94f8539a --- /dev/null +++ b/plugins/stk/voices/blow_bottle/blow_bottle_processor.h @@ -0,0 +1,43 @@ +/* + * blow_bottle_processor.h - sound generator for blown bottle noises + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BLOW_BOTTLE_PROCESSOR_H +#define _BLOW_BOTTLE_PROCESSOR_H + +#include "BlowBotl.h" + +#include "stk_processor.h" + +#include "blow_bottle_model.h" + +class blowBottleProcessor: public stkProcessor +{ +public: + blowBottleProcessor( sample_rate_t _sample_rate ); + ~blowBottleProcessor( void ); + + void setControls( blowBottleModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/blow_bottle/logo.png b/plugins/stk/voices/blow_bottle/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/blow_bottle/logo.png differ diff --git a/plugins/stk/voices/blow_hole/Makefile.am b/plugins/stk/voices/blow_hole/Makefile.am new file mode 100644 index 000000000..d4751fdd4 --- /dev/null +++ b/plugins/stk/voices/blow_hole/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="blowhole" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./blow_hole_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libblowhole.la + +libblowhole_la_SOURCES = blow_hole_model.cpp \ + blow_hole_model.h \ + blow_hole_processor.cpp \ + blow_hole_processor.h \ + blow_hole_instrument.cpp \ + blow_hole_instrument.h \ + blow_hole_instrument_view.cpp \ + blow_hole_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libblowhole_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libblowhole_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/blow_hole/artwork.png b/plugins/stk/voices/blow_hole/artwork.png new file mode 100644 index 000000000..03e1ce0a7 Binary files /dev/null and b/plugins/stk/voices/blow_hole/artwork.png differ diff --git a/plugins/stk/voices/blow_hole/blow_hole_instrument.cpp b/plugins/stk/voices/blow_hole/blow_hole_instrument.cpp new file mode 100644 index 000000000..903770647 --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "blow_hole_instrument.h" +#include "blow_hole_instrument_view.h" +#include "blow_hole_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor blowhole_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Blow Hole", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Blown tube noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +blowHoleInstrument::blowHoleInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &blowhole_plugin_descriptor ) +{ + model()->reedStiffness()->setTrack( _channel_track ); + model()->noiseGain()->setTrack( _channel_track ); + model()->toneholeState()->setTrack( _channel_track ); + model()->registerState()->setTrack( _channel_track ); + model()->breathPressure()->setTrack( _channel_track ); +} + + + + +blowHoleInstrument::~blowHoleInstrument() +{ +} + + + + +QString blowHoleInstrument::nodeName( void ) const +{ + return( blowhole_plugin_descriptor.name ); +} + + + + +pluginView * blowHoleInstrument::instantiateView( QWidget * _parent ) +{ + return( new blowHoleInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new blowHoleInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/blow_hole/blow_hole_instrument.h b/plugins/stk/voices/blow_hole/blow_hole_instrument.h new file mode 100644 index 000000000..21ffb7fea --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BLOW_HOLE_INSTRUMENT_H +#define _BLOW_HOLE_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "blow_hole_processor.h" +#include "blow_hole_model.h" + + +class blowHoleInstrument : public stkInstrument +{ +public: + blowHoleInstrument( instrumentTrack * _channel_track ); + virtual ~blowHoleInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/blow_hole/blow_hole_instrument_view.cpp b/plugins/stk/voices/blow_hole/blow_hole_instrument_view.cpp new file mode 100644 index 000000000..c1453099d --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "blow_hole_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +blowHoleInstrumentView::blowHoleInstrumentView( blowHoleInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_reedStiffness = new knob( knobSmall_17, m_topView, tr( "Stiffness" ) ); + m_reedStiffness->setLabel( tr( "Reed Stiffness" ) ); + m_reedStiffness->setHintText( tr( "Stiffness:" ) + " ", "" ); + + m_noiseGain = new knob( knobSmall_17, m_topView, tr( "Noise" ) ); + m_noiseGain->setLabel( tr( "Noise Gain" ) ); + m_noiseGain->setHintText( tr( "Noise:" ) + " ", "" ); + + m_toneholeState = new knob( knobSmall_17, m_topView, tr( "Tone Hole" ) ); + m_toneholeState->setLabel( tr( "Tone Hole" ) ); + m_toneholeState->setHintText( tr( "Tone Hole:" ) + " ", "" ); + + m_registerState = new knob( knobSmall_17, m_topView, tr( "Register" ) ); + m_registerState->setLabel( tr( "Register" ) ); + m_registerState->setHintText( tr( "Register:" ) + " ", "" ); + + m_breathPressure = new knob( knobSmall_17, m_topView, tr( "Breath Pres" ) ); + m_breathPressure->setLabel( tr( "Breath Pressure" ) ); + m_breathPressure->setHintText( tr( "Pressure:" ) + " ", "" ); + + h1->addWidget( m_reedStiffness ); + h1->addWidget( m_noiseGain ); + + h2->addWidget( m_toneholeState ); + h2->addWidget( m_registerState ); + + h3->addWidget( m_breathPressure ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +blowHoleInstrumentView::~blowHoleInstrumentView() +{ +} + + + + +void blowHoleInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + blowHoleInstrument * inst = castModel(); + m_reedStiffness->setModel( inst->model()->reedStiffness() ); + m_noiseGain->setModel( inst->model()->noiseGain() ); + m_toneholeState->setModel( inst->model()->toneholeState() ); + m_registerState->setModel( inst->model()->registerState() ); + m_breathPressure->setModel( inst->model()->breathPressure() ); +} + + + diff --git a/plugins/stk/voices/blow_hole/blow_hole_instrument_view.h b/plugins/stk/voices/blow_hole/blow_hole_instrument_view.h new file mode 100644 index 000000000..7631fe0c2 --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BLOW_HOLE_INSTRUMENT_VIEW_H +#define _BLOW_HOLE_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "blow_hole_instrument.h" + + +class blowHoleInstrumentView: public stkInstrumentView +{ +public: + blowHoleInstrumentView( blowHoleInstrument * _instrument, QWidget * _parent ); + virtual ~blowHoleInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_reedStiffness; + knob * m_noiseGain; + knob * m_toneholeState; + knob * m_registerState; + knob * m_breathPressure; +}; + +#endif diff --git a/plugins/stk/voices/blow_hole/blow_hole_model.cpp b/plugins/stk/voices/blow_hole/blow_hole_model.cpp new file mode 100644 index 000000000..d0f753666 --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "blow_hole_model.h" + + +blowHoleModel::blowHoleModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _reed_stiffness, + StkFloat _noise_gain, + StkFloat _tonehole_state, + StkFloat _register_state, + StkFloat _breath_pressure ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_reedStiffness( new floatModel( _reed_stiffness, 0.0f, 128.0f, 0.1f, this ) ), + m_noiseGain( new floatModel( _noise_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_toneholeState( new floatModel( _tonehole_state, 0.0f, 128.0f, 0.1f, this ) ), + m_registerState( new floatModel( _register_state, 0.0f, 128.0f, 0.1f, this ) ), + m_breathPressure( new floatModel( _breath_pressure, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +blowHoleModel::~blowHoleModel() +{ + delete m_reedStiffness; + delete m_noiseGain; + delete m_toneholeState; + delete m_registerState; + delete m_breathPressure; +} + + + + +void FASTCALL blowHoleModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_reedStiffness->saveSettings( _doc, _parent, "reedstiffness" ); + m_noiseGain->saveSettings( _doc, _parent, "noisegain" ); + m_toneholeState->saveSettings( _doc, _parent, "toneholestate" ); + m_registerState->saveSettings( _doc, _parent, "registerstate" ); + m_breathPressure->saveSettings( _doc, _parent, "breathpressure" ); +} + + + + +void FASTCALL blowHoleModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_reedStiffness->loadSettings( _this, "reedstiffness" ); + m_noiseGain->loadSettings( _this, "noisegain" ); + m_toneholeState->loadSettings( _this, "toneholestate" ); + m_registerState->loadSettings( _this, "registerstate" ); + m_breathPressure->loadSettings( _this, "breathpressure" ); +} + diff --git a/plugins/stk/voices/blow_hole/blow_hole_model.h b/plugins/stk/voices/blow_hole/blow_hole_model.h new file mode 100644 index 000000000..302081a7f --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_model.h @@ -0,0 +1,67 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BLOW_HOLE_MODEL_H +#define _BLOW_HOLE_MODEL_H + +#include "stk_model.h" + + +class blowHoleModel: public stkModel +{ +public: + blowHoleModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _reed_stiffness = 64.0f, + StkFloat _noise_gain = 64.0f, + StkFloat _tonehole_state = 64.0f, + StkFloat _register_state = 64.0f, + StkFloat _breath_pressure = 64.0f ); + ~blowHoleModel(); + + inline floatModel * reedStiffness( void ) { return( m_reedStiffness ); } + inline floatModel * noiseGain( void ) { return( m_noiseGain ); } + inline floatModel * toneholeState( void ) { return( m_toneholeState ); } + inline floatModel * registerState( void ) { return( m_registerState ); } + inline floatModel * breathPressure( void ) { return( m_breathPressure ); } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_reedStiffness; + floatModel * m_noiseGain; + floatModel * m_toneholeState; + floatModel * m_registerState; + floatModel * m_breathPressure; +}; + +#endif diff --git a/plugins/stk/voices/blow_hole/blow_hole_processor.cpp b/plugins/stk/voices/blow_hole/blow_hole_processor.cpp new file mode 100644 index 000000000..13ce2fefc --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "blow_hole_processor.h" +#include "config_mgr.h" + + +blowHoleProcessor::blowHoleProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate, 20.0f ) +{ +} + + + + +blowHoleProcessor::~blowHoleProcessor() +{ +} + + + + +void blowHoleProcessor::setControls( blowHoleModel * _model ) +{ + voice()->controlChange( 1, _model->registerState()->value() ); + voice()->controlChange( 2, _model->reedStiffness()->value() ); + voice()->controlChange( 4, _model->noiseGain()->value() ); + voice()->controlChange( 11, _model->toneholeState()->value() ); + voice()->controlChange( 128, _model->breathPressure()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/blow_hole/blow_hole_processor.h b/plugins/stk/voices/blow_hole/blow_hole_processor.h new file mode 100644 index 000000000..331aeba3c --- /dev/null +++ b/plugins/stk/voices/blow_hole/blow_hole_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BLOW_HOLE_PROCESSOR_H +#define _BLOW_HOLE_PROCESSOR_H + +#include "BlowHole.h" + +#include "stk_processor.h" + +#include "blow_hole_model.h" + +class blowHoleProcessor: public stkProcessor +{ +public: + blowHoleProcessor( sample_rate_t _sample_rate ); + ~blowHoleProcessor( void ); + + void setControls( blowHoleModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/blow_hole/logo.png b/plugins/stk/voices/blow_hole/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/blow_hole/logo.png differ diff --git a/plugins/stk/voices/bowed/Makefile.am b/plugins/stk/voices/bowed/Makefile.am new file mode 100644 index 000000000..34d2bd52d --- /dev/null +++ b/plugins/stk/voices/bowed/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="bowed" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./bowed_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libbowed.la + +libbowed_la_SOURCES = bowed_model.cpp \ + bowed_model.h \ + bowed_processor.cpp \ + bowed_processor.h \ + bowed_instrument.cpp \ + bowed_instrument.h \ + bowed_instrument_view.cpp \ + bowed_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libbowed_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libbowed_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/bowed/artwork.png b/plugins/stk/voices/bowed/artwork.png new file mode 100644 index 000000000..5cbf673a0 Binary files /dev/null and b/plugins/stk/voices/bowed/artwork.png differ diff --git a/plugins/stk/voices/bowed/bowed_instrument.cpp b/plugins/stk/voices/bowed/bowed_instrument.cpp new file mode 100644 index 000000000..0e9267023 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_instrument.cpp @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "bowed_instrument.h" +#include "bowed_instrument_view.h" +#include "bowed_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor bowed_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Bowed", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Bowed string" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +bowedInstrument::bowedInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &bowed_plugin_descriptor ) +{ + model()->bowPressure()->setTrack( _channel_track ); + model()->bowPosition()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); +} + + + + +bowedInstrument::~bowedInstrument() +{ +} + + + + +QString bowedInstrument::nodeName( void ) const +{ + return( bowed_plugin_descriptor.name ); +} + + + + +pluginView * bowedInstrument::instantiateView( QWidget * _parent ) +{ + return( new bowedInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new bowedInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/bowed/bowed_instrument.h b/plugins/stk/voices/bowed/bowed_instrument.h new file mode 100644 index 000000000..82fbb9017 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BOWED_INSTRUMENT_H +#define _BOWED_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "bowed_processor.h" +#include "bowed_model.h" + + +class bowedInstrument : public stkInstrument +{ +public: + bowedInstrument( instrumentTrack * _channel_track ); + virtual ~bowedInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/bowed/bowed_instrument_view.cpp b/plugins/stk/voices/bowed/bowed_instrument_view.cpp new file mode 100644 index 000000000..2493b2571 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_instrument_view.cpp @@ -0,0 +1,100 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "bowed_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +bowedInstrumentView::bowedInstrumentView( bowedInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout; + QHBoxLayout * h2 = new QHBoxLayout; + + m_bowPressure = new knob( knobSmall_17, m_topView, tr( "Pressure" ) ); + m_bowPressure->setLabel( tr( "Bow Pressure" ) ); + m_bowPressure->setHintText( tr( "Pressure:" ) + " ", "" ); + + m_bowPosition = new knob( knobSmall_17, m_topView, tr( "Position" ) ); + m_bowPosition->setLabel( tr( "Bow Position" ) ); + m_bowPosition->setHintText( tr( "Position:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Vib Freq:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "Vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + h1->addWidget( m_bowPressure ); + h1->addWidget( m_bowPosition ); + + h2->addWidget( m_vibratoFrequency ); + h2->addWidget( m_vibratoGain ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +bowedInstrumentView::~bowedInstrumentView() +{ +} + + + + +void bowedInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + bowedInstrument * inst = castModel(); + m_bowPressure->setModel( inst->model()->bowPressure() ); + m_bowPosition->setModel( inst->model()->bowPosition() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); +} + + + diff --git a/plugins/stk/voices/bowed/bowed_instrument_view.h b/plugins/stk/voices/bowed/bowed_instrument_view.h new file mode 100644 index 000000000..20237bf37 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_instrument_view.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BOWED_INSTRUMENT_VIEW_H +#define _BOWED_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "bowed_instrument.h" + + +class bowedInstrumentView: public stkInstrumentView +{ +public: + bowedInstrumentView( bowedInstrument * _instrument, QWidget * _parent ); + virtual ~bowedInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_bowPressure; + knob * m_bowPosition; + knob * m_vibratoFrequency; + knob * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/bowed/bowed_model.cpp b/plugins/stk/voices/bowed/bowed_model.cpp new file mode 100644 index 000000000..e5d9cab66 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_model.cpp @@ -0,0 +1,83 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "bowed_model.h" + + +bowedModel::bowedModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _bow_pressure, + StkFloat _bow_position, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_bowPressure( new floatModel( _bow_pressure, 0.0f, 128.0f, 0.1f, this ) ), + m_bowPosition( new floatModel( _bow_position, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +bowedModel::~bowedModel() +{ + delete m_bowPressure; + delete m_bowPosition; + delete m_vibratoFrequency; + delete m_vibratoGain; +} + + + + +void FASTCALL bowedModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_bowPressure->saveSettings( _doc, _parent, "bowpressure" ); + m_bowPosition->saveSettings( _doc, _parent, "bowgain" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); +} + + + + +void FASTCALL bowedModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_bowPressure->loadSettings( _this, "bowpressure" ); + m_bowPosition->loadSettings( _this, "bowposition" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); +} + diff --git a/plugins/stk/voices/bowed/bowed_model.h b/plugins/stk/voices/bowed/bowed_model.h new file mode 100644 index 000000000..7fd67a895 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_model.h @@ -0,0 +1,79 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BOWED_MODEL_H +#define _BOWED_MODEL_H + +#include "stk_model.h" + + +class bowedModel: public stkModel +{ +public: + bowedModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _bow_pressure = 64.0f, + StkFloat _bow_position = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f ); + ~bowedModel(); + + inline floatModel * bowPressure( void ) const + { + return( m_bowPressure ); + } + + inline floatModel * bowPosition( void ) const + { + return( m_bowPosition ); + } + + inline floatModel * vibratoFrequency( void ) const + { + return( m_vibratoFrequency ); + } + + inline floatModel * vibratoGain( void ) const + { + return( m_vibratoGain ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_bowPressure; + floatModel * m_bowPosition; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/bowed/bowed_processor.cpp b/plugins/stk/voices/bowed/bowed_processor.cpp new file mode 100644 index 000000000..ab165c6f9 --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_processor.cpp @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "bowed_processor.h" +#include "config_mgr.h" + + +bowedProcessor::bowedProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate, 20.0f ) +{ +} + + + + +bowedProcessor::~bowedProcessor() +{ +} + + + + +void bowedProcessor::setControls( bowedModel * _model ) +{ + voice()->controlChange( 2, _model->bowPressure()->value() ); + voice()->controlChange( 4, _model->bowPosition()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 1, _model->vibratoGain()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/bowed/bowed_processor.h b/plugins/stk/voices/bowed/bowed_processor.h new file mode 100644 index 000000000..6fd34cffa --- /dev/null +++ b/plugins/stk/voices/bowed/bowed_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BOWED_PROCESSOR_H +#define _BOWED_PROCESSOR_H + +#include "Bowed.h" + +#include "stk_processor.h" + +#include "bowed_model.h" + +class bowedProcessor: public stkProcessor +{ +public: + bowedProcessor( sample_rate_t _sample_rate ); + ~bowedProcessor( void ); + + void setControls( bowedModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/bowed/logo.png b/plugins/stk/voices/bowed/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/bowed/logo.png differ diff --git a/plugins/stk/voices/brass/Makefile.am b/plugins/stk/voices/brass/Makefile.am new file mode 100644 index 000000000..f774e101c --- /dev/null +++ b/plugins/stk/voices/brass/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="brass" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./brass_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libbrass.la + +libbrass_la_SOURCES = brass_model.cpp \ + brass_model.h \ + brass_processor.cpp \ + brass_processor.h \ + brass_instrument.cpp \ + brass_instrument.h \ + brass_instrument_view.cpp \ + brass_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libbrass_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libbrass_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/brass/artwork.png b/plugins/stk/voices/brass/artwork.png new file mode 100644 index 000000000..427a997a1 Binary files /dev/null and b/plugins/stk/voices/brass/artwork.png differ diff --git a/plugins/stk/voices/brass/brass_instrument.cpp b/plugins/stk/voices/brass/brass_instrument.cpp new file mode 100644 index 000000000..744817af8 --- /dev/null +++ b/plugins/stk/voices/brass/brass_instrument.cpp @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "brass_instrument.h" +#include "brass_instrument_view.h" +#include "brass_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor brass_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Brass", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Brass sounds" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +brassInstrument::brassInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &brass_plugin_descriptor ) +{ + model()->lipTension()->setTrack( _channel_track ); + model()->slideLength()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); +} + + + + +brassInstrument::~brassInstrument() +{ +} + + + + +QString brassInstrument::nodeName( void ) const +{ + return( brass_plugin_descriptor.name ); +} + + + + +pluginView * brassInstrument::instantiateView( QWidget * _parent ) +{ + return( new brassInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new brassInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/brass/brass_instrument.h b/plugins/stk/voices/brass/brass_instrument.h new file mode 100644 index 000000000..502414798 --- /dev/null +++ b/plugins/stk/voices/brass/brass_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BRASS_INSTRUMENT_H +#define _BRASS_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "brass_processor.h" +#include "brass_model.h" + + +class brassInstrument : public stkInstrument +{ +public: + brassInstrument( instrumentTrack * _channel_track ); + virtual ~brassInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/brass/brass_instrument_view.cpp b/plugins/stk/voices/brass/brass_instrument_view.cpp new file mode 100644 index 000000000..9b303aa97 --- /dev/null +++ b/plugins/stk/voices/brass/brass_instrument_view.cpp @@ -0,0 +1,100 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "brass_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +brassInstrumentView::brassInstrumentView( brassInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout; + QHBoxLayout * h2 = new QHBoxLayout; + + m_lipTension = new knob( knobSmall_17, m_topView, tr( "Tension" ) ); + m_lipTension->setLabel( tr( "Lip Tension" ) ); + m_lipTension->setHintText( tr( "Tension:" ) + " ", "" ); + + m_slideLength = new knob( knobSmall_17, m_topView, tr( "Length" ) ); + m_slideLength->setLabel( tr( "Slide Length" ) ); + m_slideLength->setHintText( tr( "Length:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Vib Freq:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "Vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + h1->addWidget( m_lipTension ); + h1->addWidget( m_slideLength ); + + h2->addWidget( m_vibratoFrequency ); + h2->addWidget( m_vibratoGain ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +brassInstrumentView::~brassInstrumentView() +{ +} + + + + +void brassInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + brassInstrument * inst = castModel(); + m_lipTension->setModel( inst->model()->lipTension() ); + m_slideLength->setModel( inst->model()->slideLength() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); +} + + + diff --git a/plugins/stk/voices/brass/brass_instrument_view.h b/plugins/stk/voices/brass/brass_instrument_view.h new file mode 100644 index 000000000..e06e5ae9d --- /dev/null +++ b/plugins/stk/voices/brass/brass_instrument_view.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _BRASS_INSTRUMENT_VIEW_H +#define _BRASS_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "brass_instrument.h" + + +class brassInstrumentView: public stkInstrumentView +{ +public: + brassInstrumentView( brassInstrument * _instrument, QWidget * _parent ); + virtual ~brassInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_lipTension; + knob * m_slideLength; + knob * m_vibratoFrequency; + knob * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/brass/brass_model.cpp b/plugins/stk/voices/brass/brass_model.cpp new file mode 100644 index 000000000..ffb08173b --- /dev/null +++ b/plugins/stk/voices/brass/brass_model.cpp @@ -0,0 +1,83 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "brass_model.h" + + +brassModel::brassModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _lip_tension, + StkFloat _slide_length, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_lipTension( new floatModel( _lip_tension, 0.0f, 128.0f, 0.1f, this ) ), + m_slideLength( new floatModel( _slide_length, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +brassModel::~brassModel() +{ + delete m_lipTension; + delete m_slideLength; + delete m_vibratoFrequency; + delete m_vibratoGain; +} + + + + +void FASTCALL brassModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_lipTension->saveSettings( _doc, _parent, "liptension" ); + m_slideLength->saveSettings( _doc, _parent, "slidelength" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); +} + + + + +void FASTCALL brassModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_lipTension->loadSettings( _this, "liptension" ); + m_slideLength->loadSettings( _this, "slidelength" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); +} + diff --git a/plugins/stk/voices/brass/brass_model.h b/plugins/stk/voices/brass/brass_model.h new file mode 100644 index 000000000..1bdecc609 --- /dev/null +++ b/plugins/stk/voices/brass/brass_model.h @@ -0,0 +1,79 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BRASS_MODEL_H +#define _BRASS_MODEL_H + +#include "stk_model.h" + + +class brassModel: public stkModel +{ +public: + brassModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _lip_tension = 64.0f, + StkFloat _slid_position = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f ); + ~brassModel(); + + inline floatModel * lipTension( void ) const + { + return( m_lipTension ); + } + + inline floatModel * slideLength( void ) const + { + return( m_slideLength ); + } + + inline floatModel * vibratoFrequency( void ) const + { + return( m_vibratoFrequency ); + } + + inline floatModel * vibratoGain( void ) const + { + return( m_vibratoGain ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_lipTension; + floatModel * m_slideLength; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/brass/brass_processor.cpp b/plugins/stk/voices/brass/brass_processor.cpp new file mode 100644 index 000000000..11057adfc --- /dev/null +++ b/plugins/stk/voices/brass/brass_processor.cpp @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "brass_processor.h" +#include "config_mgr.h" + + +brassProcessor::brassProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate, 20.0f ) +{ +} + + + + +brassProcessor::~brassProcessor() +{ +} + + + + +void brassProcessor::setControls( brassModel * _model ) +{ + voice()->controlChange( 2, _model->lipTension()->value() ); + voice()->controlChange( 4, _model->slideLength()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 1, _model->vibratoGain()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/brass/brass_processor.h b/plugins/stk/voices/brass/brass_processor.h new file mode 100644 index 000000000..b6c5d2c82 --- /dev/null +++ b/plugins/stk/voices/brass/brass_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _BRASS_PROCESSOR_H +#define _BRASS_PROCESSOR_H + +#include "Brass.h" + +#include "stk_processor.h" + +#include "brass_model.h" + +class brassProcessor: public stkProcessor +{ +public: + brassProcessor( sample_rate_t _sample_rate ); + ~brassProcessor( void ); + + void setControls( brassModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/brass/logo.png b/plugins/stk/voices/brass/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/brass/logo.png differ diff --git a/plugins/stk/voices/clarinet/Makefile.am b/plugins/stk/voices/clarinet/Makefile.am new file mode 100644 index 000000000..f84457b67 --- /dev/null +++ b/plugins/stk/voices/clarinet/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="clarinet" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./clarinet_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libclarinet.la + +libclarinet_la_SOURCES = clarinet_model.cpp \ + clarinet_model.h \ + clarinet_processor.cpp \ + clarinet_processor.h \ + clarinet_instrument.cpp \ + clarinet_instrument.h \ + clarinet_instrument_view.cpp \ + clarinet_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libclarinet_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libclarinet_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/clarinet/artwork.png b/plugins/stk/voices/clarinet/artwork.png new file mode 100644 index 000000000..d75c8f0e5 Binary files /dev/null and b/plugins/stk/voices/clarinet/artwork.png differ diff --git a/plugins/stk/voices/clarinet/clarinet_instrument.cpp b/plugins/stk/voices/clarinet/clarinet_instrument.cpp new file mode 100644 index 000000000..bc4b54777 --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "clarinet_instrument.h" +#include "clarinet_instrument_view.h" +#include "clarinet_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor clarinet_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Clarinet", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Clarinet noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +clarinetInstrument::clarinetInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &clarinet_plugin_descriptor ) +{ + model()->reedStiffness()->setTrack( _channel_track ); + model()->noiseGain()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); + model()->breathPressure()->setTrack( _channel_track ); +} + + + + +clarinetInstrument::~clarinetInstrument() +{ +} + + + + +QString clarinetInstrument::nodeName( void ) const +{ + return( clarinet_plugin_descriptor.name ); +} + + + + +pluginView * clarinetInstrument::instantiateView( QWidget * _parent ) +{ + return( new clarinetInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new clarinetInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/clarinet/clarinet_instrument.h b/plugins/stk/voices/clarinet/clarinet_instrument.h new file mode 100644 index 000000000..73c4b1a32 --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _CLARINET_INSTRUMENT_H +#define _CLARINET_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "clarinet_processor.h" +#include "clarinet_model.h" + + +class clarinetInstrument : public stkInstrument +{ +public: + clarinetInstrument( instrumentTrack * _channel_track ); + virtual ~clarinetInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/clarinet/clarinet_instrument_view.cpp b/plugins/stk/voices/clarinet/clarinet_instrument_view.cpp new file mode 100644 index 000000000..54a4de7e4 --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "clarinet_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +clarinetInstrumentView::clarinetInstrumentView( clarinetInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_reedStiffness = new knob( knobSmall_17, m_topView, tr( "Stiffness" ) ); + m_reedStiffness->setLabel( tr( "Reed Stiffness" ) ); + m_reedStiffness->setHintText( tr( "Stiffness:" ) + " ", "" ); + + m_noiseGain = new knob( knobSmall_17, m_topView, tr( "Noise" ) ); + m_noiseGain->setLabel( tr( "Noise Gain" ) ); + m_noiseGain->setHintText( tr( "Noise:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Tone Hole:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + m_breathPressure = new knob( knobSmall_17, m_topView, tr( "Breath Pres" ) ); + m_breathPressure->setLabel( tr( "Breath Pressure" ) ); + m_breathPressure->setHintText( tr( "Pressure:" ) + " ", "" ); + + h1->addWidget( m_reedStiffness ); + h1->addWidget( m_noiseGain ); + + h2->addWidget( m_vibratoFrequency ); + h2->addWidget( m_vibratoGain ); + + h3->addWidget( m_breathPressure ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +clarinetInstrumentView::~clarinetInstrumentView() +{ +} + + + + +void clarinetInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + clarinetInstrument * inst = castModel(); + m_reedStiffness->setModel( inst->model()->reedStiffness() ); + m_noiseGain->setModel( inst->model()->noiseGain() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); + m_breathPressure->setModel( inst->model()->breathPressure() ); +} + + + diff --git a/plugins/stk/voices/clarinet/clarinet_instrument_view.h b/plugins/stk/voices/clarinet/clarinet_instrument_view.h new file mode 100644 index 000000000..046b25536 --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _CLARINET_INSTRUMENT_VIEW_H +#define _CLARINET_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "clarinet_instrument.h" + + +class clarinetInstrumentView: public stkInstrumentView +{ +public: + clarinetInstrumentView( clarinetInstrument * _instrument, QWidget * _parent ); + virtual ~clarinetInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_reedStiffness; + knob * m_noiseGain; + knob * m_vibratoFrequency; + knob * m_vibratoGain; + knob * m_breathPressure; +}; + +#endif diff --git a/plugins/stk/voices/clarinet/clarinet_model.cpp b/plugins/stk/voices/clarinet/clarinet_model.cpp new file mode 100644 index 000000000..c1d2fdac1 --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "clarinet_model.h" + + +clarinetModel::clarinetModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _reed_stiffness, + StkFloat _noise_gain, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain, + StkFloat _breath_pressure ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_reedStiffness( new floatModel( _reed_stiffness, 0.0f, 128.0f, 0.1f, this ) ), + m_noiseGain( new floatModel( _noise_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_breathPressure( new floatModel( _breath_pressure, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +clarinetModel::~clarinetModel() +{ + delete m_reedStiffness; + delete m_noiseGain; + delete m_vibratoFrequency; + delete m_vibratoGain; + delete m_breathPressure; +} + + + + +void FASTCALL clarinetModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_reedStiffness->saveSettings( _doc, _parent, "reedstiffness" ); + m_noiseGain->saveSettings( _doc, _parent, "noisegain" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); + m_breathPressure->saveSettings( _doc, _parent, "breathpressure" ); +} + + + + +void FASTCALL clarinetModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_reedStiffness->loadSettings( _this, "reedstiffness" ); + m_noiseGain->loadSettings( _this, "noisegain" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); + m_breathPressure->loadSettings( _this, "breathpressure" ); +} + diff --git a/plugins/stk/voices/clarinet/clarinet_model.h b/plugins/stk/voices/clarinet/clarinet_model.h new file mode 100644 index 000000000..2636ccb39 --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _CLARINET_MODEL_H +#define _CLARINET_MODEL_H + +#include "stk_model.h" + + +class clarinetModel: public stkModel +{ +public: + clarinetModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _reed_stiffness = 64.0f, + StkFloat _noise_gain = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f, + StkFloat _breath_pressure = 64.0f ); + ~clarinetModel(); + + inline floatModel * reedStiffness( void ) const + { + return( m_reedStiffness ); + } + + inline floatModel * noiseGain( void ) const + { + return( m_noiseGain ); + } + + inline floatModel * vibratoFrequency( void ) + { + return( m_vibratoFrequency ); + } + + inline floatModel * vibratoGain( void ) const + { + return( m_vibratoGain ); + } + + inline floatModel * breathPressure( void ) const + { + return( m_breathPressure ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_reedStiffness; + floatModel * m_noiseGain; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; + floatModel * m_breathPressure; +}; + +#endif diff --git a/plugins/stk/voices/clarinet/clarinet_processor.cpp b/plugins/stk/voices/clarinet/clarinet_processor.cpp new file mode 100644 index 000000000..3151e53ee --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "clarinet_processor.h" +#include "config_mgr.h" + + +clarinetProcessor::clarinetProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate, 20.0f ) +{ +} + + + + +clarinetProcessor::~clarinetProcessor() +{ +} + + + + +void clarinetProcessor::setControls( clarinetModel * _model ) +{ + voice()->controlChange( 2, _model->reedStiffness()->value() ); + voice()->controlChange( 4, _model->noiseGain()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 1, _model->vibratoGain()->value() ); + voice()->controlChange( 128, _model->breathPressure()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/clarinet/clarinet_processor.h b/plugins/stk/voices/clarinet/clarinet_processor.h new file mode 100644 index 000000000..0a65c35ff --- /dev/null +++ b/plugins/stk/voices/clarinet/clarinet_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _CLARINET_PROCESSOR_H +#define _CLARINET_PROCESSOR_H + +#include "Clarinet.h" + +#include "stk_processor.h" + +#include "clarinet_model.h" + +class clarinetProcessor: public stkProcessor +{ +public: + clarinetProcessor( sample_rate_t _sample_rate ); + ~clarinetProcessor( void ); + + void setControls( clarinetModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/clarinet/logo.png b/plugins/stk/voices/clarinet/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/clarinet/logo.png differ diff --git a/plugins/stk/voices/flute/Makefile.am b/plugins/stk/voices/flute/Makefile.am new file mode 100644 index 000000000..6fe59d7ab --- /dev/null +++ b/plugins/stk/voices/flute/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="flute" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./flute_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libflute.la + +libflute_la_SOURCES = flute_model.cpp \ + flute_model.h \ + flute_processor.cpp \ + flute_processor.h \ + flute_instrument.cpp \ + flute_instrument.h \ + flute_instrument_view.cpp \ + flute_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libflute_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libflute_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/flute/artwork.png b/plugins/stk/voices/flute/artwork.png new file mode 100644 index 000000000..9f146b019 Binary files /dev/null and b/plugins/stk/voices/flute/artwork.png differ diff --git a/plugins/stk/voices/flute/flute_instrument.cpp b/plugins/stk/voices/flute/flute_instrument.cpp new file mode 100644 index 000000000..20d4ed31e --- /dev/null +++ b/plugins/stk/voices/flute/flute_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "flute_instrument.h" +#include "flute_instrument_view.h" +#include "flute_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor flute_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Flute", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Flute noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +fluteInstrument::fluteInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &flute_plugin_descriptor ) +{ + model()->jetDelay()->setTrack( _channel_track ); + model()->noiseGain()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); + model()->breathPressure()->setTrack( _channel_track ); +} + + + + +fluteInstrument::~fluteInstrument() +{ +} + + + + +QString fluteInstrument::nodeName( void ) const +{ + return( flute_plugin_descriptor.name ); +} + + + + +pluginView * fluteInstrument::instantiateView( QWidget * _parent ) +{ + return( new fluteInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new fluteInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/flute/flute_instrument.h b/plugins/stk/voices/flute/flute_instrument.h new file mode 100644 index 000000000..3715d811f --- /dev/null +++ b/plugins/stk/voices/flute/flute_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _FLUTE_INSTRUMENT_H +#define _FLUTE_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "flute_processor.h" +#include "flute_model.h" + + +class fluteInstrument : public stkInstrument +{ +public: + fluteInstrument( instrumentTrack * _channel_track ); + virtual ~fluteInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/flute/flute_instrument_view.cpp b/plugins/stk/voices/flute/flute_instrument_view.cpp new file mode 100644 index 000000000..c91e2ba6e --- /dev/null +++ b/plugins/stk/voices/flute/flute_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "flute_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +fluteInstrumentView::fluteInstrumentView( fluteInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_jetDelay = new knob( knobSmall_17, m_topView, tr( "Jet Delay" ) ); + m_jetDelay->setLabel( tr( "Jet Delay" ) ); + m_jetDelay->setHintText( tr( "Delay:" ) + " ", "" ); + + m_noiseGain = new knob( knobSmall_17, m_topView, tr( "Noise" ) ); + m_noiseGain->setLabel( tr( "Noise Gain" ) ); + m_noiseGain->setHintText( tr( "Noise:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Tone Hole:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + m_breathPressure = new knob( knobSmall_17, m_topView, tr( "Breath Pres" ) ); + m_breathPressure->setLabel( tr( "Breath Pressure" ) ); + m_breathPressure->setHintText( tr( "Pressure:" ) + " ", "" ); + + h1->addWidget( m_jetDelay ); + h1->addWidget( m_noiseGain ); + + h2->addWidget( m_vibratoFrequency ); + h2->addWidget( m_vibratoGain ); + + h3->addWidget( m_breathPressure ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +fluteInstrumentView::~fluteInstrumentView() +{ +} + + + + +void fluteInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + fluteInstrument * inst = castModel(); + m_jetDelay->setModel( inst->model()->jetDelay() ); + m_noiseGain->setModel( inst->model()->noiseGain() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); + m_breathPressure->setModel( inst->model()->breathPressure() ); +} + + + diff --git a/plugins/stk/voices/flute/flute_instrument_view.h b/plugins/stk/voices/flute/flute_instrument_view.h new file mode 100644 index 000000000..88349df40 --- /dev/null +++ b/plugins/stk/voices/flute/flute_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _FLUTE_INSTRUMENT_VIEW_H +#define _FLUTE_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "flute_instrument.h" + + +class fluteInstrumentView: public stkInstrumentView +{ +public: + fluteInstrumentView( fluteInstrument * _instrument, QWidget * _parent ); + virtual ~fluteInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_jetDelay; + knob * m_noiseGain; + knob * m_vibratoFrequency; + knob * m_vibratoGain; + knob * m_breathPressure; +}; + +#endif diff --git a/plugins/stk/voices/flute/flute_model.cpp b/plugins/stk/voices/flute/flute_model.cpp new file mode 100644 index 000000000..3c1e06640 --- /dev/null +++ b/plugins/stk/voices/flute/flute_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "flute_model.h" + + +fluteModel::fluteModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _jet_delay, + StkFloat _noise_gain, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain, + StkFloat _breath_pressure ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_jetDelay( new floatModel( _jet_delay, 0.0f, 128.0f, 0.1f, this ) ), + m_noiseGain( new floatModel( _noise_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ), + m_breathPressure( new floatModel( _breath_pressure, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +fluteModel::~fluteModel() +{ + delete m_jetDelay; + delete m_noiseGain; + delete m_vibratoFrequency; + delete m_vibratoGain; + delete m_breathPressure; +} + + + + +void FASTCALL fluteModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_jetDelay->saveSettings( _doc, _parent, "reedstiffness" ); + m_noiseGain->saveSettings( _doc, _parent, "noisegain" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); + m_breathPressure->saveSettings( _doc, _parent, "breathpressure" ); +} + + + + +void FASTCALL fluteModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_jetDelay->loadSettings( _this, "reedstiffness" ); + m_noiseGain->loadSettings( _this, "noisegain" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); + m_breathPressure->loadSettings( _this, "breathpressure" ); +} + diff --git a/plugins/stk/voices/flute/flute_model.h b/plugins/stk/voices/flute/flute_model.h new file mode 100644 index 000000000..a5a74c8ff --- /dev/null +++ b/plugins/stk/voices/flute/flute_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _FLUTE_MODEL_H +#define _FLUTE_MODEL_H + +#include "stk_model.h" + + +class fluteModel: public stkModel +{ +public: + fluteModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _jet_delay = 64.0f, + StkFloat _noise_gain = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f, + StkFloat _breath_pressure = 64.0f ); + ~fluteModel(); + + inline floatModel * jetDelay( void ) const + { + return( m_jetDelay ); + } + + inline floatModel * noiseGain( void ) const + { + return( m_noiseGain ); + } + + inline floatModel * vibratoFrequency( void ) + { + return( m_vibratoFrequency ); + } + + inline floatModel * vibratoGain( void ) const + { + return( m_vibratoGain ); + } + + inline floatModel * breathPressure( void ) const + { + return( m_breathPressure ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_jetDelay; + floatModel * m_noiseGain; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; + floatModel * m_breathPressure; +}; + +#endif diff --git a/plugins/stk/voices/flute/flute_processor.cpp b/plugins/stk/voices/flute/flute_processor.cpp new file mode 100644 index 000000000..5fb36bcf5 --- /dev/null +++ b/plugins/stk/voices/flute/flute_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "flute_processor.h" +#include "config_mgr.h" + + +fluteProcessor::fluteProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate, 20.0f ) +{ +} + + + + +fluteProcessor::~fluteProcessor() +{ +} + + + + +void fluteProcessor::setControls( fluteModel * _model ) +{ + voice()->controlChange( 2, _model->jetDelay()->value() ); + voice()->controlChange( 4, _model->noiseGain()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 1, _model->vibratoGain()->value() ); + voice()->controlChange( 128, _model->breathPressure()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/flute/flute_processor.h b/plugins/stk/voices/flute/flute_processor.h new file mode 100644 index 000000000..b5bcf7266 --- /dev/null +++ b/plugins/stk/voices/flute/flute_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _FLUTE_PROCESSOR_H +#define _FLUTE_PROCESSOR_H + +#include "Flute.h" + +#include "stk_processor.h" + +#include "flute_model.h" + +class fluteProcessor: public stkProcessor +{ +public: + fluteProcessor( sample_rate_t _sample_rate ); + ~fluteProcessor( void ); + + void setControls( fluteModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/flute/logo.png b/plugins/stk/voices/flute/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/flute/logo.png differ diff --git a/plugins/stk/voices/fmvoices/Makefile.am b/plugins/stk/voices/fmvoices/Makefile.am new file mode 100644 index 000000000..d6c5e130a --- /dev/null +++ b/plugins/stk/voices/fmvoices/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="fmvoices" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./fmvoices_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libfmvoices.la + +libfmvoices_la_SOURCES = fmvoices_model.cpp \ + fmvoices_model.h \ + fmvoices_processor.cpp \ + fmvoices_processor.h \ + fmvoices_instrument.cpp \ + fmvoices_instrument.h \ + fmvoices_instrument_view.cpp \ + fmvoices_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libfmvoices_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libfmvoices_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/fmvoices/artwork.png b/plugins/stk/voices/fmvoices/artwork.png new file mode 100644 index 000000000..1c5f7ebd4 Binary files /dev/null and b/plugins/stk/voices/fmvoices/artwork.png differ diff --git a/plugins/stk/voices/fmvoices/fmvoices_instrument.cpp b/plugins/stk/voices/fmvoices/fmvoices_instrument.cpp new file mode 100644 index 000000000..ebb6280ea --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "fmvoices_instrument.h" +#include "fmvoices_instrument_view.h" +#include "fmvoices_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor fmvoices_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "FM Voices", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Voice noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +fmvoicesInstrument::fmvoicesInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &fmvoices_plugin_descriptor ) +{ + model()->vowel()->setTrack( _channel_track ); + model()->spectralTilt()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +fmvoicesInstrument::~fmvoicesInstrument() +{ +} + + + + +QString fmvoicesInstrument::nodeName( void ) const +{ + return( fmvoices_plugin_descriptor.name ); +} + + + + +pluginView * fmvoicesInstrument::instantiateView( QWidget * _parent ) +{ + return( new fmvoicesInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new fmvoicesInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/fmvoices/fmvoices_instrument.h b/plugins/stk/voices/fmvoices/fmvoices_instrument.h new file mode 100644 index 000000000..d24046d06 --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _FMVOICES_INSTRUMENT_H +#define _FMVOICES_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "fmvoices_processor.h" +#include "fmvoices_model.h" + + +class fmvoicesInstrument : public stkInstrument +{ +public: + fmvoicesInstrument( instrumentTrack * _channel_track ); + virtual ~fmvoicesInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/fmvoices/fmvoices_instrument_view.cpp b/plugins/stk/voices/fmvoices/fmvoices_instrument_view.cpp new file mode 100644 index 000000000..59808bb9b --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "fmvoices_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +fmvoicesInstrumentView::fmvoicesInstrumentView( fmvoicesInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_vowel = new knob( knobSmall_17, m_topView, tr( "Vowel" ) ); + m_vowel->setLabel( tr( "Vowel" ) ); + m_vowel->setHintText( tr( "Vowel:" ) + " ", "" ); + + m_spectralTilt = new knob( knobSmall_17, m_topView, tr( "Tilt" ) ); + m_spectralTilt->setLabel( tr( "Spectral Tilt" ) ); + m_spectralTilt->setHintText( tr( "Tilt:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_vowel ); + h1->addWidget( m_spectralTilt ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +fmvoicesInstrumentView::~fmvoicesInstrumentView() +{ +} + + + + +void fmvoicesInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + fmvoicesInstrument * inst = castModel(); + m_vowel->setModel( inst->model()->vowel() ); + m_spectralTilt->setModel( inst->model()->spectralTilt() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/fmvoices/fmvoices_instrument_view.h b/plugins/stk/voices/fmvoices/fmvoices_instrument_view.h new file mode 100644 index 000000000..233e949c6 --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _FMVOICES_INSTRUMENT_VIEW_H +#define _FMVOICES_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "fmvoices_instrument.h" + + +class fmvoicesInstrumentView: public stkInstrumentView +{ +public: + fmvoicesInstrumentView( fmvoicesInstrument * _instrument, QWidget * _parent ); + virtual ~fmvoicesInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_vowel; + knob * m_spectralTilt; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/fmvoices/fmvoices_model.cpp b/plugins/stk/voices/fmvoices/fmvoices_model.cpp new file mode 100644 index 000000000..f742e905d --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "fmvoices_model.h" + + +fmvoicesModel::fmvoicesModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _vowel, + StkFloat _spectral_tilt, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_vowel( new floatModel( _vowel, 0.0f, 128.0f, 0.1f, this ) ), + m_spectralTilt( new floatModel( _spectral_tilt, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +fmvoicesModel::~fmvoicesModel() +{ + delete m_vowel; + delete m_spectralTilt; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL fmvoicesModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_vowel->saveSettings( _doc, _parent, "vowel" ); + m_spectralTilt->saveSettings( _doc, _parent, "spectraltilt" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL fmvoicesModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_vowel->loadSettings( _this, "vowel" ); + m_spectralTilt->loadSettings( _this, "spectraltilt" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/fmvoices/fmvoices_model.h b/plugins/stk/voices/fmvoices/fmvoices_model.h new file mode 100644 index 000000000..031da3dfb --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _FMVOICES_MODEL_H +#define _FMVOICES_MODEL_H + +#include "stk_model.h" + + +class fmvoicesModel: public stkModel +{ +public: + fmvoicesModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _vowel = 64.0f, + StkFloat _spectral_tilt = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~fmvoicesModel(); + + inline floatModel * vowel( void ) const + { + return( m_vowel ); + } + + inline floatModel * spectralTilt( void ) const + { + return( m_spectralTilt ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_vowel; + floatModel * m_spectralTilt; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/fmvoices/fmvoices_processor.cpp b/plugins/stk/voices/fmvoices/fmvoices_processor.cpp new file mode 100644 index 000000000..ee470f736 --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "fmvoices_processor.h" +#include "config_mgr.h" + + +fmvoicesProcessor::fmvoicesProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +fmvoicesProcessor::~fmvoicesProcessor() +{ +} + + + + +void fmvoicesProcessor::setControls( fmvoicesModel * _model ) +{ + voice()->controlChange( 2, _model->vowel()->value() ); + voice()->controlChange( 4, _model->spectralTilt()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/fmvoices/fmvoices_processor.h b/plugins/stk/voices/fmvoices/fmvoices_processor.h new file mode 100644 index 000000000..9c46047f3 --- /dev/null +++ b/plugins/stk/voices/fmvoices/fmvoices_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _FMVOICES_PROCESSOR_H +#define _FMVOICES_PROCESSOR_H + +#include "FMVoices.h" + +#include "stk_processor.h" + +#include "fmvoices_model.h" + +class fmvoicesProcessor: public stkProcessor +{ +public: + fmvoicesProcessor( sample_rate_t _sample_rate ); + ~fmvoicesProcessor( void ); + + void setControls( fmvoicesModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/fmvoices/logo.png b/plugins/stk/voices/fmvoices/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/fmvoices/logo.png differ diff --git a/plugins/stk/voices/include/stk_instrument.h b/plugins/stk/voices/include/stk_instrument.h new file mode 100644 index 000000000..0a1d41bd0 --- /dev/null +++ b/plugins/stk/voices/include/stk_instrument.h @@ -0,0 +1,168 @@ +/* + * stk_instrument.h - base class for stk interfaces to lmms + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _STK_INSTRUMENT_H +#define _STK_INSTRUMENT_H + +#include "instrument.h" + +#include "stk_voice.h" + + +template +class stkInstrument : public instrument +{ +public: + stkInstrument( instrumentTrack * _channel_track, + const descriptor * _descriptor, + Uint8 _polyphony = 64 ); + virtual ~stkInstrument(); + + void playNote( notePlayHandle * _n, bool _try_parallelizing ); + + void deleteNotePluginData( notePlayHandle * _n ); + + void saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void loadSettings( const QDomElement & _this ); + + MODEL * model( void ) const; + + void setMissingFile( bool _state ); + +private: + MODEL * m_model; + + stkVoice * m_voice; + + sampleFrame * m_buffer; + fpp_t m_frames; +}; + + + + +template +stkInstrument::stkInstrument( + instrumentTrack * _channel_track, + const descriptor * _descriptor, + Uint8 _polyphony ): + instrument( _channel_track, _descriptor ), + m_model( new MODEL() ), + m_voice( new stkVoice( _polyphony ) ), + m_buffer( new sampleFrame[engine::getMixer()->framesPerPeriod()] ) +{ + m_model->monophonic()->setTrack( _channel_track ); + m_model->portamento()->setTrack( _channel_track ); + m_model->bend()->setTrack( _channel_track ); + m_model->bendRange()->setTrack( _channel_track ); + m_model->velocitySensitiveLPF()->setTrack( _channel_track ); + m_model->velocitySensitiveQ()->setTrack( _channel_track ); + m_model->volume()->setTrack( _channel_track ); + m_model->pan()->setTrack( _channel_track ); + m_model->releaseTriggered()->setTrack( _channel_track ); + m_model->randomizeAttack()->setTrack( _channel_track ); + m_model->randomizeLength()->setTrack( _channel_track ); + m_model->randomizeVelocityAmount()->setTrack( _channel_track ); + m_model->randomizeFrequencyAmount()->setTrack( _channel_track ); + m_model->spread()->setTrack( _channel_track ); +} + + + + +template +stkInstrument::~stkInstrument() +{ + delete m_voice; + delete m_model; + delete[] m_buffer; +} + + + + +template +inline void stkInstrument::playNote( + notePlayHandle * _n, + bool _try_parallelizing ) +{ + m_frames = _n->framesLeftForCurrentPeriod(); + + m_buffer = m_voice->playNote( _n, m_model, m_buffer, m_frames ); + getInstrumentTrack()->processAudioBuffer( m_buffer, m_frames, _n ); +} + + + + +template +inline void stkInstrument::deleteNotePluginData( + notePlayHandle * _n ) +{ + static_cast( _n->m_pluginData )->setActive( FALSE ); + _n->m_pluginData = NULL; +} + + + + +template +void stkInstrument::saveSettings( + QDomDocument & _doc, + QDomElement & _parent ) +{ + m_model->saveSettings( _doc, _parent ); +} + + + + +template +inline void stkInstrument::loadSettings( + const QDomElement & _this ) +{ + m_model->loadSettings( _this ); +} + + + + +template +inline MODEL * stkInstrument::model( void ) const +{ + return( m_model ); +} + + + + +template +inline void stkInstrument::setMissingFile( bool _state ) +{ + m_voice->setMissingFile( _state ); +} + + +#endif diff --git a/plugins/stk/voices/include/stk_instrument_view.h b/plugins/stk/voices/include/stk_instrument_view.h new file mode 100644 index 000000000..dc161d3d7 --- /dev/null +++ b/plugins/stk/voices/include/stk_instrument_view.h @@ -0,0 +1,181 @@ +/* + * stk_instrument_view.h - base class for stk gui interfaces + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _STK_INSTRUMENT_VIEW_H +#define _STK_INSTRUMENT_VIEW_H + +#include +#include + +#include "config_mgr.h" +#include "instrument_view.h" +#include "led_checkbox.h" +#include "tempo_sync_knob.h" + + +template +class stkInstrumentView: public instrumentView +{ +public: + stkInstrumentView( INSTRUMENT * _instrument, QWidget * _parent ); + virtual ~stkInstrumentView(); + +protected: + virtual void modelChanged( void ); + + QWidget * m_topView; + ledCheckBox * m_monophonic; + tempoSyncKnob * m_portamento; + knob * m_bend; + knob * m_bendRange; + ledCheckBox * m_velocitySensitiveLPF; + knob * m_velocitySensitiveQ; + knob * m_volume; + knob * m_pan; + ledCheckBox * m_releaseTriggered; + ledCheckBox * m_randomizeAttack; + tempoSyncKnob * m_randomizeLength; + knob * m_randomizeVelocityAmount; + knob * m_randomizeFrequencyAmount; + knob * m_spread; +}; + + +template +stkInstrumentView::stkInstrumentView( INSTRUMENT * _instrument, + QWidget * _parent ): + instrumentView( _instrument, _parent ) +{ + bool filesMissing = + !QDir( configManager::inst()->stkDir() ).exists() || + !QFileInfo( configManager::inst()->stkDir() + + QDir::separator() + + "sinewave.raw" ).exists(); + + if( filesMissing ) + { + QMessageBox::information( 0, tr( "Missing files" ), + tr( "Your Stk-installation seems to be " + "incomplete. Please make sure " + "the full Stk-package is installed!" ), + QMessageBox::Ok ); + } + + _instrument->setMissingFile( filesMissing ); + + m_topView = new QWidget( this ); + m_topView->setGeometry( 6, 51, 237, 100 ); + + m_monophonic = new ledCheckBox( tr( "" ), this ); + m_monophonic->move( 115, 206 ); + + m_portamento = new tempoSyncKnob( knobSmall_17, this, + tr( "Portamento" ) ); + m_portamento->setHintText( tr( "Portamento:" ) + " ", "ms" ); + m_portamento->move( 19, 218 ); + + m_bend = new knob( knobSmall_17, this, tr( "Bend" ) ); + m_bend->setHintText( tr( "Bend:" ) + " ", " half steps" ); + m_bend->move( 12, 190 ); + + m_velocitySensitiveLPF = new ledCheckBox( tr( "" ), this ); + m_velocitySensitiveLPF->move( 13, 165 ); + + m_velocitySensitiveQ = new knob( knobSmall_17, this, tr( "Q" ) ); + m_velocitySensitiveQ->setHintText( tr( "Q:" ) + " ", "" ); + m_velocitySensitiveQ->move( 74, 164 ); + + m_bendRange = new knob( knobSmall_17, this, tr( "Range" ) ); + m_bendRange->setHintText( tr( "Range:" ) + " ", + " " + tr( "half steps" ) ); + m_bendRange->move( 55, 190 ); + + m_volume = new knob( knobSmall_17, this, tr( "Volume" ) ); + m_volume->setHintText( tr( "Volume:" ) + " ", "" ); + m_volume->move( 158, 16 ); + + m_pan = new knob( knobSmall_17, this, tr( "Pan" ) ); + m_pan->setHintText( tr( "Pan:" ) + " ", "" ); + m_pan->move( 181, 16 ); + + m_releaseTriggered = new ledCheckBox( tr( "" ), this ); + m_releaseTriggered->move( 115, 222 ); + + m_randomizeAttack = new ledCheckBox( tr( "" ), this ); + m_randomizeAttack->move( 110, 166 ); + + m_randomizeLength = new tempoSyncKnob( knobSmall_17, this, + tr( "Length" ) ); + m_randomizeLength->setHintText( tr( "Length:" ) + " ", "ms" ); + m_randomizeLength->move( 197, 180 ); + + m_randomizeVelocityAmount = new knob( knobSmall_17, this, + tr( "Velocity" ) ); + m_randomizeVelocityAmount->setHintText( tr( "Velocity:" ) + " ", "" ); + m_randomizeVelocityAmount->move( 123, 180 ); + + m_randomizeFrequencyAmount = new knob( knobSmall_17, this, + tr( "Frequency" ) ); + m_randomizeFrequencyAmount->setHintText( tr( "Frequency:" ) + " ", + " " + tr( "half steps" ) ); + m_randomizeFrequencyAmount->move( 158, 180 ); + + m_spread = new knob( knobSmall_17, this, tr( "Spread" ) ); + m_spread->setHintText( tr( "Spread:" ) + " ", "" ); + m_spread->move( 212, 16 ); +} + + + + +template +stkInstrumentView::~stkInstrumentView() +{ +} + + + + +template +void stkInstrumentView::modelChanged() +{ + INSTRUMENT * inst = castModel(); + m_monophonic->setModel( inst->model()->monophonic() ); + m_portamento->setModel( inst->model()->portamento() ); + m_bend->setModel( inst->model()->bend() ); + m_bendRange->setModel( inst->model()->bendRange() ); + m_velocitySensitiveLPF->setModel( inst->model()->velocitySensitiveLPF() ); + m_velocitySensitiveQ->setModel( inst->model()->velocitySensitiveQ() ); + m_volume->setModel( inst->model()->volume() ); + m_pan->setModel( inst->model()->pan() ); + m_releaseTriggered->setModel( inst->model()->releaseTriggered() ); + m_randomizeAttack->setModel( inst->model()->randomizeAttack() ); + m_randomizeLength->setModel( inst->model()->randomizeLength() ); + m_randomizeVelocityAmount->setModel( inst->model()->randomizeVelocityAmount() ); + m_randomizeFrequencyAmount->setModel( inst->model()->randomizeFrequencyAmount() ); + m_spread->setModel( inst->model()->spread() ); +} + + +#endif diff --git a/plugins/stk/voices/include/stk_model.h b/plugins/stk/voices/include/stk_model.h new file mode 100644 index 000000000..6e7e62bbf --- /dev/null +++ b/plugins/stk/voices/include/stk_model.h @@ -0,0 +1,184 @@ +/* + * stk_model.h - base class for stk instrument models + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _STK_MODEL_H +#define _STK_MODEL_H + +#include "Instrmnt.h" + +#include "automatable_model_templates.h" +#include "basic_filters.h" + + +class stkModel: public model +{ +public: + stkModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + bool _release_triggered = FALSE, + bool _randomize_attack = FALSE, + StkFloat _randomize_length = 0.0f, + StkFloat _randomize_velocity_amount = 0.5f, + StkFloat _randomize_frequency_amount = 0.5f, + StkFloat _spread = 0.0f ); + virtual ~stkModel(); + + // Indicates whether or not the instrument should use multiple voices + // when generating the signal. + inline boolModel * monophonic( void ) const + { + return( m_monophonic ); + } + + // Stores the time in ms over which a note will slide from the previous + // frequency. + inline floatModel * portamento( void ) const + { + return( m_portamento ); + } + + // Stores the pitch bend setting. Scaled by bendRange. + inline floatModel * bend( void ) const + { + return( m_bend ); + } + + // Stores the range in half steps over which a note can be bent. + inline floatModel * bendRange( void ) const + { + return( m_bendRange ); + } + + // Indicates whether or not to apply a low pass filter to the notes + // where the cutoff frequency is scaled by the notes' velocities. + inline boolModel * velocitySensitiveLPF( void ) const + { + return( m_velocitySensitiveLPF ); + } + + // Stores the Q value for the low pass filter. + inline floatModel * velocitySensitiveQ( void ) const + { + return( m_velocitySensitiveQ ); + } + + // Stores the volume setting for the voice. + inline floatModel * volume( void ) const + { + return( m_volume ); + } + + // Stores the pan setting for the voice. + inline floatModel * pan( void ) const + { + return( m_pan ); + } + + // Indicates whether or not only the release portion of the envelope + // should be played. + inline boolModel * releaseTriggered( void ) const + { + return( m_releaseTriggered ); + } + + // Indicates whether or not random offsets should be generated for + // the volume and pitch. The offsets will move linearly to + // zero over the length of time defined by randomizeLength. + inline boolModel * randomizeAttack( void ) const + { + return( m_randomizeAttack ); + } + + // Stores the length of time in ms over which random offsets should + // be applied. + inline floatModel * randomizeLength( void ) const + { + return( m_randomizeLength ); + } + + // Stores the range for the random offset generated for the + // volume of a note. + inline floatModel * randomizeVelocityAmount( void ) const + { + return( m_randomizeVelocityAmount ); + } + + // Stores the range in half steps for the random offset generated + // for the pitch of a note. + inline floatModel * randomizeFrequencyAmount( void ) const + { + return( m_randomizeFrequencyAmount ); + } + + // Sets a delay for the right channel. Provides a quick and dirty + // way to create a stereo spread effect. + inline floatModel * spread( void ) const + { + return( m_spread ); + } + + // Calculates the amount to scale a frequency in order to provide + // a "bend" in a note. + inline float bendScaler() const + { + return( pow( 2.0f, ( m_bendRange->value() * m_bend->value() / + 49152.0f ) ) ); + } + + // Generates a random number between -1.0 and 1.0. + inline float offset( void ) const + { + return( 2.0f * ( static_cast( rand() ) / + static_cast( RAND_MAX ) - 0.5f ) ); + } + + virtual void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + virtual void FASTCALL loadSettings( const QDomElement & _this ); + +private: + boolModel * m_monophonic; // multiple voice indicator + floatModel * m_portamento; // time for slide between notes + floatModel * m_bend; // bend state of note + floatModel * m_bendRange; // range of bend in half steps + boolModel * m_velocitySensitiveLPF; // turns on a LPF + floatModel * m_velocitySensitiveQ; // Q setting for the LPF + floatModel * m_volume; // volume of the voice + floatModel * m_pan; // pan position of the voice + boolModel * m_releaseTriggered; // only play release + boolModel * m_randomizeAttack; // turns on randomization + floatModel * m_randomizeLength; // time for randomization + floatModel * m_randomizeVelocityAmount; // velocity randomization + floatModel * m_randomizeFrequencyAmount;// pitch randomization + floatModel * m_spread; // stereo width +}; + + + +#endif diff --git a/plugins/stk/voices/include/stk_processor.h b/plugins/stk/voices/include/stk_processor.h new file mode 100644 index 000000000..412ab0f85 --- /dev/null +++ b/plugins/stk/voices/include/stk_processor.h @@ -0,0 +1,363 @@ +/* + * stk_processor.h - base class for stk sound generators + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _STK_PROCESSOR_H +#define _STK_PROCESSOR_H + +#include "Instrmnt.h" + +#include "config_mgr.h" +#include "note_play_handle.h" +#include "types.h" + + +template +class stkProcessor +{ +public: + stkProcessor( sample_rate_t _sample_rate ); + stkProcessor( sample_rate_t _sample_rate, + StkFloat _lowest_frequency ); + virtual ~stkProcessor( void ); + + StkFloat nextSampleLeft( void ); + StkFloat nextSampleRight( void ); + + Instrmnt * voice( void ); + bool active( void ); + float lastFrequency( void ); + notePlayHandle * note( void ); + fpp_t attackFrame( void ); + float deltaVelocity( void ); + float deltaFrequency( void ); + basicFilters<> * velocitySensitiveLPF( void ); + float velocity( void ); + void clearBuffer( void ); + + void setActive( bool _state ); + void setLastFrequency( float _frequency ); + void setNote( notePlayHandle * _note ); + void setAttackFrame( fpp_t _frame ); + void setDeltaVelocity( float _velocity ); + void setDeltaFrequency( float _frequency ); + void setVelocity( float _velocity ); + void noteOn( StkFloat _pitch, StkFloat _velocity ); + +protected: + Uint8 m_delayRead; + Uint8 m_delayWrite; + +private: + Instrmnt * m_voice; + + StkFloat m_delay[256]; + bool m_active; + StkFloat m_sample; + Uint16 m_bufferIndex; + float m_lastFrequency; + float m_velocity; + notePlayHandle * m_note; + fpp_t m_attackFrame; + float m_deltaVelocity; + float m_deltaFrequency; + basicFilters<> * m_velocitySensitiveLPF; +}; + + + + +template + inline stkProcessor::stkProcessor( + sample_rate_t _sample_rate ): + m_delayWrite( 0 ), + m_lastFrequency( 440.0f ) +{ + try + { + Stk::setSampleRate( _sample_rate ); + Stk::setRawwavePath( + configManager::inst()->stkDir().toAscii().constData() ); + + m_voice = new STKVOICE(); + } + catch( ... ) + { + m_voice = NULL; + } + + setActive( FALSE ); + + m_velocitySensitiveLPF = + new basicFilters<>( engine::getMixer()->sampleRate() ); + + m_velocitySensitiveLPF->setFilterType( basicFilters<>::LOWPASS ); +} + + + + +template + inline stkProcessor::stkProcessor( + sample_rate_t _sample_rate, + StkFloat _lowest_frequency ): + m_delayWrite( 0 ), + m_lastFrequency( 440.0f ) +{ + try + { + Stk::setSampleRate( _sample_rate ); + Stk::setRawwavePath( + configManager::inst()->stkDir().toAscii().constData() ); + + m_voice = new STKVOICE( _lowest_frequency ); + } + catch( ... ) + { + m_voice = NULL; + } + + setActive( FALSE ); + + m_velocitySensitiveLPF = + new basicFilters<>( engine::getMixer()->sampleRate() ); + + m_velocitySensitiveLPF->setFilterType( basicFilters<>::LOWPASS ); +} + + + + +template +inline stkProcessor::~stkProcessor( void ) +{ + m_voice->noteOff( 0.0 ); + delete m_voice; + delete m_velocitySensitiveLPF; +} + + + + +template +inline StkFloat stkProcessor::nextSampleLeft( void ) +{ + if( m_voice == NULL ) + { + return( 0.0f ); + } + else + { + m_sample = m_voice->tick(); + m_delay[m_delayWrite] = m_sample; + m_delayWrite++; + return( m_sample ); + } +} + + + + +template +inline StkFloat stkProcessor::nextSampleRight( void ) +{ + m_sample = m_delay[m_delayRead]; + m_delayRead++; + return( m_sample ); +} + + + + +template +inline Instrmnt * stkProcessor::voice( void ) +{ + return( m_voice ); +} + + + + +template +inline bool stkProcessor::active( void ) +{ + return( m_active ); +} + + + + +template +inline float stkProcessor::lastFrequency( void ) +{ + return( m_lastFrequency ); +} + + + + +template +inline notePlayHandle * stkProcessor::note( void ) +{ + return( m_note ); +} + + + + +template +inline fpp_t stkProcessor::attackFrame( void ) +{ + return( m_attackFrame ); +} + + + + +template +inline float stkProcessor::deltaVelocity( void ) +{ + return( m_deltaVelocity ); +} + + + + +template +inline float stkProcessor::deltaFrequency( void ) +{ + return( m_deltaFrequency ); +} + + + + +template +inline basicFilters<> * stkProcessor::velocitySensitiveLPF( void ) +{ + return( m_velocitySensitiveLPF ); +} + + + + +template +inline float stkProcessor::velocity( void ) +{ + return( m_velocity ); +} + + + + +template +void stkProcessor::setActive( bool _state ) +{ + m_active = _state; + + if( !m_active && m_voice != NULL ) + { + clearBuffer(); + m_voice->noteOff( 0.0f ); + m_note = NULL; + } +} + + + +template +void stkProcessor::setLastFrequency( float _frequency ) +{ + m_lastFrequency = _frequency; +} + + + + +template +void stkProcessor::setNote( notePlayHandle * _note ) +{ + m_note = _note; +} + + + + +template +void stkProcessor::setAttackFrame( fpp_t _frame ) +{ + m_attackFrame = _frame; +} + + + + +template +void stkProcessor::setDeltaVelocity( float _velocity ) +{ + m_deltaVelocity = _velocity; +} + + + + +template +void stkProcessor::setDeltaFrequency( float _frequency ) +{ + m_deltaFrequency = _frequency; +} + + + + +template +void stkProcessor::clearBuffer( void ) +{ + for( m_bufferIndex = 0; m_bufferIndex < 256; m_bufferIndex++ ) + { + m_delay[m_bufferIndex] = 0.0; + } +} + + + + +template +void stkProcessor::noteOn( StkFloat _pitch, + StkFloat _velocity ) +{ + m_voice->noteOn( _pitch, _velocity ); +} + + + + +template +void stkProcessor::setVelocity( float _velocity ) +{ + m_velocity = _velocity; +} + + + +#endif diff --git a/plugins/stk/voices/include/stk_voice.h b/plugins/stk/voices/include/stk_voice.h new file mode 100644 index 000000000..1c246329e --- /dev/null +++ b/plugins/stk/voices/include/stk_voice.h @@ -0,0 +1,369 @@ +/* + * stk_voice.h - base class for stk voices + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _STK_VOICE_H +#define _STK_VOICE_H + +#include "note_play_handle.h" + + +template +class stkVoice +{ +public: + stkVoice( Uint8 _polyphony = 64 ); + virtual ~stkVoice(); + + sampleFrame * FASTCALL playNote( notePlayHandle * _n, + MODEL * _model, + sampleFrame * _buffer, + const fpp_t _frames ); + + void setMissingFile( bool _state ); + +private: + bool m_filesMissing; + + float m_targetFrequency; + float m_currentFrequency; + float m_lastFrequency; + PROCESSOR * m_processor; + fpp_t m_frame; + sample_t m_leftSample; + sample_t m_rightSample; + Uint8 m_channel; + float m_leftRMS; + float m_rightRMS; + float m_pan; + fpp_t m_totalAttackFrames; + fpp_t m_attackFrame; + float m_deltaVelocity; + float m_deltaFrequency; + float m_attackVelocity; + float m_attackFrequency; + + QVector m_voices; + Uint8 m_voiceIndex; + Uint8 m_polyphony; + + sample_rate_t m_sampleRate; + int m_portamentoFrames; +}; + + +template +stkVoice::stkVoice( Uint8 _polyphony ): + m_lastFrequency( 440.0f ), + m_polyphony( _polyphony ), + m_sampleRate( engine::getMixer()->sampleRate() ), + m_portamentoFrames( 0 ) +{ + for( m_voiceIndex = 0; m_voiceIndex < m_polyphony; m_voiceIndex++ ) + { + m_voices.append( new PROCESSOR( m_sampleRate ) ); + } +} + + + + +template +stkVoice::~stkVoice() +{ + for( m_voiceIndex = 0; m_voiceIndex < m_polyphony; m_voiceIndex++ ) + { + delete m_voices[m_voiceIndex]; + } +} + + + +template +sampleFrame * FASTCALL stkVoice::playNote( + notePlayHandle * _n, + MODEL * _model, + sampleFrame * _buffer, + const fpp_t _frames ) +{ + // Don't do anything if STK isn't installed properly. + if( m_filesMissing ) + { + return _buffer; + } + + // Don't do anything if the instrument is release triggered and we + // haven't released yet. + if( _model->releaseTriggered()->value() && !_n->released() ) + { + return _buffer; + } + + // If it's a new note, we need to get a voice. + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) + { + // Monophonic instruments only use the first defined voice. + if( _model->monophonic()->value() ) + { + if( m_voices[0]->active() && + m_voices[0]->note() != NULL ) + { + m_voices[0]->note()->noteOff( 0 ); + } + m_processor = m_voices[0]; + } + // Otherwise, search for a voice that isn't in use. + else + { + m_processor = NULL; + for( m_voiceIndex = 0; m_voiceIndex < m_polyphony; + m_voiceIndex++ ) + { + if( !m_voices[m_voiceIndex]->active() ) + { + m_processor = m_voices[m_voiceIndex]; + break; + } + } + + // Don't do anything if no voices are available. + if( m_processor == NULL ) + { + return( _buffer ); + } + } + + // Assign the voice and label it as active. + _n->m_pluginData = m_processor; + m_processor->setActive( TRUE ); + + // Initialize the velocity and the number of frames played + // so far. + m_processor->setVelocity( + static_cast( _n->getVolume() ) / + 100.0f ); + m_processor->setAttackFrame( 0 ); + + // Initialize the number of frames for the portamento + // transition. + m_portamentoFrames = static_cast( + engine::getMixer()->sampleRate() * + _model->portamento()->value() / + 1000.0f ); + + // If the attack is randomized, calculate the number of frames + // over which the modifications should take place and + // generate a pair of offsets. + if( _model->randomizeAttack()->value() ) + { + m_totalAttackFrames = static_cast( + engine::getMixer()->sampleRate() * + _model->randomizeLength()->value() / + 1000.0f ); + + m_attackVelocity = + _model->randomizeVelocityAmount()->value() * + _model->offset(); + if( m_processor->velocity() + m_attackVelocity < 0.0f ) + { + m_attackVelocity = -m_processor->velocity(); + } + if( m_processor->velocity() + + m_attackVelocity > 1.0f ) + { + m_attackVelocity = 1.0f - m_processor->velocity(); + } + + m_processor->setDeltaVelocity( m_attackVelocity ); + + m_attackFrequency = + _model->randomizeFrequencyAmount()->value() * + _model->offset(); + + m_processor->setDeltaFrequency( m_attackFrequency ); + } + else + { + m_totalAttackFrames = 0; + m_processor->setDeltaVelocity( 0.0f ); + m_processor->setDeltaFrequency( 0.0f ); + } + + // If the velocity sensitive filter is turned on, calculate the + // coefficients and clear the taps. The filter cutoff is set + // as: + // cutoff = max_freq * ( 10^velocity ) / 10 + if( _model->velocitySensitiveLPF()->value() ) + { + m_processor->velocitySensitiveLPF()->calcFilterCoeffs( + pow( 10.0f, m_processor->velocity() + + m_processor->deltaVelocity() ) * + engine::getMixer()->sampleRate() / 20.0f, + _model->velocitySensitiveQ()->value() ); + m_processor->velocitySensitiveLPF()->clearHistory(); + } + } + + // Used to keep track of the level across the buffer. + m_leftRMS = 0.0f; + m_rightRMS = 0.0f; + + // Get the processing unit assigned to the note. + m_processor = static_cast( _n->m_pluginData ); + + // Initialize the pitch settings. + m_targetFrequency = _n->frequency(); + m_lastFrequency = m_processor->lastFrequency(); + m_currentFrequency = m_lastFrequency; + + m_processor->setControls( _model ); + + // Initialize the attack offset calculation variables. + m_attackVelocity = 0.0f; + m_attackFrequency = 1.0f; + m_attackFrame = m_processor->attackFrame(); + m_deltaVelocity = m_processor->deltaVelocity(); + m_deltaFrequency = m_processor->deltaFrequency(); + + // Generate the buffer. + for( m_frame = 0; m_frame < _frames; ++m_frame ) + { + // Slide across the randomized attack offsets. + // Will be ignored if randomization is turned off because + // both m_attackFrame and m_totalAttackFrames will be + // zero. Just a linear iterpolation. + if( m_attackFrame < m_totalAttackFrames ) + { + m_attackVelocity = m_deltaVelocity - m_deltaVelocity * + m_attackFrame / + m_totalAttackFrames; + + if( m_processor->velocity() + m_attackVelocity < 0.0f ) + { + m_attackVelocity = -m_processor->velocity(); + } + else if( m_processor->velocity() + m_attackVelocity > 1.0f ) + { + m_attackVelocity = 1.0f - m_processor->velocity(); + } + + + m_attackFrequency = m_deltaFrequency - + m_deltaFrequency * + m_attackFrame / + m_totalAttackFrames; + + // Convert m_attackFrequency to a half step based + // scaling factor for the pitch. + m_attackFrequency = pow( 2.0f, m_attackFrequency / + 12.0f ); + + m_attackFrame++; + } + + // If there are any portamento frames to be processed, + // calculate the pitch slide based on whatever the most + // recently used frequency was. + if( m_portamentoFrames > 0 ) + { + m_currentFrequency += ( m_targetFrequency - + m_lastFrequency ) / + static_cast( m_portamentoFrames ); + + // Sliding polyphonic instruments can end up with + // negative frequencies, so stop the slid as long + // as the situation persists. + if( m_currentFrequency < 0.0f ) + { + m_currentFrequency -= + ( m_targetFrequency - m_lastFrequency ) / + static_cast( m_portamentoFrames ); + } + + m_processor->noteOn( m_currentFrequency * + _model->bendScaler(), + m_processor->velocity() + + m_attackVelocity ); + } + else + { + m_processor->noteOn( m_targetFrequency * + _model->bendScaler() * + m_attackFrequency, + m_processor->velocity() + + m_attackVelocity ); + } + + // Calculate the pan level for the right channel. + m_pan = ( 1.0f + _model->pan()->value() ) / 2.0f; + + // Generate the samples. + m_leftSample = m_processor->nextSampleLeft() * + _model->volume()->value() * ( 1.0f - m_pan ); + m_rightSample = m_processor->nextSampleRight() * + _model->volume()->value() * m_pan; + + // Process the velocity sensitive filter. + if( _model->velocitySensitiveLPF()->value() ) + { + m_leftSample = m_processor->velocitySensitiveLPF()->update( m_leftSample, 0 ); + m_rightSample = m_processor->velocitySensitiveLPF()->update( m_rightSample, 1 ); + } + + // Keep track of the levels. + m_leftRMS += m_leftSample * m_leftSample; + m_rightRMS += m_rightSample * m_rightSample; + + // Stuff the samples into the channels. + for( m_channel = 0; m_channel < DEFAULT_CHANNELS / 2; + ++m_channel ) + { + _buffer[m_frame][m_channel * DEFAULT_CHANNELS / 2] = m_leftSample; + _buffer[m_frame][( m_channel + 1 ) * DEFAULT_CHANNELS / 2] = m_rightSample; + } + } + + // Remember the frequency and the number of frames processed. + m_processor->setLastFrequency( m_currentFrequency ); + m_processor->setAttackFrame( m_attackFrame ); + + // Keep track of the portamento frames. + if( m_portamentoFrames > 0 ) + { + m_portamentoFrames -= _frames; + } + + return( _buffer ); +} + + + + +template + void stkVoice::setMissingFile( bool _state ) +{ + m_filesMissing = _state; +} + + +#endif diff --git a/plugins/stk/voices/metal/Makefile.am b/plugins/stk/voices/metal/Makefile.am new file mode 100644 index 000000000..63a340767 --- /dev/null +++ b/plugins/stk/voices/metal/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="metal" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./metal_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libmetal.la + +libmetal_la_SOURCES = metal_model.cpp \ + metal_model.h \ + metal_processor.cpp \ + metal_processor.h \ + metal_instrument.cpp \ + metal_instrument.h \ + metal_instrument_view.cpp \ + metal_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libmetal_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libmetal_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/metal/artwork.png b/plugins/stk/voices/metal/artwork.png new file mode 100644 index 000000000..55d1ce0fc Binary files /dev/null and b/plugins/stk/voices/metal/artwork.png differ diff --git a/plugins/stk/voices/metal/logo.png b/plugins/stk/voices/metal/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/metal/logo.png differ diff --git a/plugins/stk/voices/metal/metal_instrument.cpp b/plugins/stk/voices/metal/metal_instrument.cpp new file mode 100644 index 000000000..1a08f49c6 --- /dev/null +++ b/plugins/stk/voices/metal/metal_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "metal_instrument.h" +#include "metal_instrument_view.h" +#include "metal_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor metal_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Metal", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Buzzy noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +metalInstrument::metalInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &metal_plugin_descriptor ) +{ + model()->index()->setTrack( _channel_track ); + model()->crossfade()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +metalInstrument::~metalInstrument() +{ +} + + + + +QString metalInstrument::nodeName( void ) const +{ + return( metal_plugin_descriptor.name ); +} + + + + +pluginView * metalInstrument::instantiateView( QWidget * _parent ) +{ + return( new metalInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new metalInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/metal/metal_instrument.h b/plugins/stk/voices/metal/metal_instrument.h new file mode 100644 index 000000000..73b9bcb90 --- /dev/null +++ b/plugins/stk/voices/metal/metal_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _METAL_INSTRUMENT_H +#define _METAL_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "metal_processor.h" +#include "metal_model.h" + + +class metalInstrument : public stkInstrument +{ +public: + metalInstrument( instrumentTrack * _channel_track ); + virtual ~metalInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/metal/metal_instrument_view.cpp b/plugins/stk/voices/metal/metal_instrument_view.cpp new file mode 100644 index 000000000..06ab9fba4 --- /dev/null +++ b/plugins/stk/voices/metal/metal_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "metal_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +metalInstrumentView::metalInstrumentView( metalInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_index = new knob( knobSmall_17, m_topView, tr( "Index" ) ); + m_index->setLabel( tr( "Modulator Index" ) ); + m_index->setHintText( tr( "Index:" ) + " ", "" ); + + m_crossfade = new knob( knobSmall_17, m_topView, tr( "Crossfade" ) ); + m_crossfade->setLabel( tr( "Modulator Crossfade" ) ); + m_crossfade->setHintText( tr( "Crossfade:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_index ); + h1->addWidget( m_crossfade ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +metalInstrumentView::~metalInstrumentView() +{ +} + + + + +void metalInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + metalInstrument * inst = castModel(); + m_index->setModel( inst->model()->index() ); + m_crossfade->setModel( inst->model()->crossfade() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/metal/metal_instrument_view.h b/plugins/stk/voices/metal/metal_instrument_view.h new file mode 100644 index 000000000..751dd1200 --- /dev/null +++ b/plugins/stk/voices/metal/metal_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _METAL_INSTRUMENT_VIEW_H +#define _METAL_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "metal_instrument.h" + + +class metalInstrumentView: public stkInstrumentView +{ +public: + metalInstrumentView( metalInstrument * _instrument, QWidget * _parent ); + virtual ~metalInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_index; + knob * m_crossfade; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/metal/metal_model.cpp b/plugins/stk/voices/metal/metal_model.cpp new file mode 100644 index 000000000..bd9b84301 --- /dev/null +++ b/plugins/stk/voices/metal/metal_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "metal_model.h" + + +metalModel::metalModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _index, + StkFloat _crossfade, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_index( new floatModel( _index, 0.0f, 128.0f, 0.1f, this ) ), + m_crossfade( new floatModel( _crossfade, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +metalModel::~metalModel() +{ + delete m_index; + delete m_crossfade; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL metalModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_index->saveSettings( _doc, _parent, "index" ); + m_crossfade->saveSettings( _doc, _parent, "crossfade" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL metalModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_index->loadSettings( _this, "index" ); + m_crossfade->loadSettings( _this, "crossfade" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/metal/metal_model.h b/plugins/stk/voices/metal/metal_model.h new file mode 100644 index 000000000..7bdb3024c --- /dev/null +++ b/plugins/stk/voices/metal/metal_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _METAL_MODEL_H +#define _METAL_MODEL_H + +#include "stk_model.h" + + +class metalModel: public stkModel +{ +public: + metalModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _index = 64.0f, + StkFloat _crossfade = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~metalModel(); + + inline floatModel * index( void ) const + { + return( m_index ); + } + + inline floatModel * crossfade( void ) const + { + return( m_crossfade ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_index; + floatModel * m_crossfade; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/metal/metal_processor.cpp b/plugins/stk/voices/metal/metal_processor.cpp new file mode 100644 index 000000000..178f4584a --- /dev/null +++ b/plugins/stk/voices/metal/metal_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "metal_processor.h" +#include "config_mgr.h" + + +metalProcessor::metalProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +metalProcessor::~metalProcessor() +{ +} + + + + +void metalProcessor::setControls( metalModel * _model ) +{ + voice()->controlChange( 2, _model->index()->value() ); + voice()->controlChange( 4, _model->crossfade()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/metal/metal_processor.h b/plugins/stk/voices/metal/metal_processor.h new file mode 100644 index 000000000..07e846283 --- /dev/null +++ b/plugins/stk/voices/metal/metal_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _METAL_PROCESSOR_H +#define _METAL_PROCESSOR_H + +#include "HevyMetl.h" + +#include "stk_processor.h" + +#include "metal_model.h" + +class metalProcessor: public stkProcessor +{ +public: + metalProcessor( sample_rate_t _sample_rate ); + ~metalProcessor( void ); + + void setControls( metalModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/moog/Makefile.am b/plugins/stk/voices/moog/Makefile.am new file mode 100644 index 000000000..634c5b9eb --- /dev/null +++ b/plugins/stk/voices/moog/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="moog" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./moog_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libmoog.la + +libmoog_la_SOURCES = moog_model.cpp \ + moog_model.h \ + moog_processor.cpp \ + moog_processor.h \ + moog_instrument.cpp \ + moog_instrument.h \ + moog_instrument_view.cpp \ + moog_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libmoog_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libmoog_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/moog/artwork.png b/plugins/stk/voices/moog/artwork.png new file mode 100644 index 000000000..2abdb5171 Binary files /dev/null and b/plugins/stk/voices/moog/artwork.png differ diff --git a/plugins/stk/voices/moog/logo.png b/plugins/stk/voices/moog/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/moog/logo.png differ diff --git a/plugins/stk/voices/moog/moog_instrument.cpp b/plugins/stk/voices/moog/moog_instrument.cpp new file mode 100644 index 000000000..917cb5035 --- /dev/null +++ b/plugins/stk/voices/moog/moog_instrument.cpp @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "moog_instrument.h" +#include "moog_instrument_view.h" +#include "moog_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor moog_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Moog", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Moogy sounds" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +moogInstrument::moogInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &moog_plugin_descriptor ) +{ + model()->filterQ()->setTrack( _channel_track ); + model()->filterSweepRate()->setTrack( _channel_track ); + model()->vibratoFrequency()->setTrack( _channel_track ); + model()->vibratoGain()->setTrack( _channel_track ); +} + + + + +moogInstrument::~moogInstrument() +{ +} + + + + +QString moogInstrument::nodeName( void ) const +{ + return( moog_plugin_descriptor.name ); +} + + + + +pluginView * moogInstrument::instantiateView( QWidget * _parent ) +{ + return( new moogInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new moogInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/moog/moog_instrument.h b/plugins/stk/voices/moog/moog_instrument.h new file mode 100644 index 000000000..4b7ffe876 --- /dev/null +++ b/plugins/stk/voices/moog/moog_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _MOOG_INSTRUMENT_H +#define _MOOG_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "moog_processor.h" +#include "moog_model.h" + + +class moogInstrument : public stkInstrument +{ +public: + moogInstrument( instrumentTrack * _channel_track ); + virtual ~moogInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/moog/moog_instrument_view.cpp b/plugins/stk/voices/moog/moog_instrument_view.cpp new file mode 100644 index 000000000..719f3a55e --- /dev/null +++ b/plugins/stk/voices/moog/moog_instrument_view.cpp @@ -0,0 +1,100 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "moog_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +moogInstrumentView::moogInstrumentView( moogInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout; + QHBoxLayout * h2 = new QHBoxLayout; + + m_filterQ = new knob( knobSmall_17, m_topView, tr( "Filter Q" ) ); + m_filterQ->setLabel( tr( "Filter Q" ) ); + m_filterQ->setHintText( tr( "Q:" ) + " ", "" ); + + m_filterSweepRate = new knob( knobSmall_17, m_topView, tr( "Sweep Rate" ) ); + m_filterSweepRate->setLabel( tr( "Sweep Rate" ) ); + m_filterSweepRate->setHintText( tr( "Rate:" ) + " ", "" ); + + m_vibratoFrequency = new knob( knobSmall_17, m_topView, tr( "Vib Freq" ) ); + m_vibratoFrequency->setLabel( tr( "Vibrato Frequency" ) ); + m_vibratoFrequency->setHintText( tr( "Vib Freq:" ) + " ", "" ); + + m_vibratoGain = new knob( knobSmall_17, m_topView, tr( "Vib Gain" ) ); + m_vibratoGain->setLabel( tr( "Vibrato Gain" ) ); + m_vibratoGain->setHintText( tr( "Vib Gain:" ) + " ", "" ); + + h1->addWidget( m_filterQ ); + h1->addWidget( m_filterSweepRate ); + + h2->addWidget( m_vibratoFrequency ); + h2->addWidget( m_vibratoGain ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +moogInstrumentView::~moogInstrumentView() +{ +} + + + + +void moogInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + moogInstrument * inst = castModel(); + m_filterQ->setModel( inst->model()->filterQ() ); + m_filterSweepRate->setModel( inst->model()->filterSweepRate() ); + m_vibratoFrequency->setModel( inst->model()->vibratoFrequency() ); + m_vibratoGain->setModel( inst->model()->vibratoGain() ); +} + + + diff --git a/plugins/stk/voices/moog/moog_instrument_view.h b/plugins/stk/voices/moog/moog_instrument_view.h new file mode 100644 index 000000000..ee3365381 --- /dev/null +++ b/plugins/stk/voices/moog/moog_instrument_view.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _MOOG_INSTRUMENT_VIEW_H +#define _MOOG_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "moog_instrument.h" + + +class moogInstrumentView: public stkInstrumentView +{ +public: + moogInstrumentView( moogInstrument * _instrument, QWidget * _parent ); + virtual ~moogInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_filterQ; + knob * m_filterSweepRate; + knob * m_vibratoFrequency; + knob * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/moog/moog_model.cpp b/plugins/stk/voices/moog/moog_model.cpp new file mode 100644 index 000000000..0919627db --- /dev/null +++ b/plugins/stk/voices/moog/moog_model.cpp @@ -0,0 +1,83 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "moog_model.h" + + +moogModel::moogModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _filter_q, + StkFloat _filter_sweep_rate, + StkFloat _vibrato_frequency, + StkFloat _vibrato_gain ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_filterQ( new floatModel( _filter_q, 0.0f, 128.0f, 0.1f, this ) ), + m_filterSweepRate( new floatModel( _filter_sweep_rate, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoFrequency( new floatModel( _vibrato_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_vibratoGain( new floatModel( _vibrato_gain, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +moogModel::~moogModel() +{ + delete m_filterQ; + delete m_filterSweepRate; + delete m_vibratoFrequency; + delete m_vibratoGain; +} + + + + +void FASTCALL moogModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_filterQ->saveSettings( _doc, _parent, "filterq" ); + m_filterSweepRate->saveSettings( _doc, _parent, "filtersweeprate" ); + m_vibratoFrequency->saveSettings( _doc, _parent, "vibratofrequency" ); + m_vibratoGain->saveSettings( _doc, _parent, "vibratogain" ); +} + + + + +void FASTCALL moogModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_filterQ->loadSettings( _this, "filterq" ); + m_filterSweepRate->loadSettings( _this, "filtersweeprate" ); + m_vibratoFrequency->loadSettings( _this, "vibratofrequency" ); + m_vibratoGain->loadSettings( _this, "vibratogain" ); +} + diff --git a/plugins/stk/voices/moog/moog_model.h b/plugins/stk/voices/moog/moog_model.h new file mode 100644 index 000000000..e904d9d41 --- /dev/null +++ b/plugins/stk/voices/moog/moog_model.h @@ -0,0 +1,79 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _MOOG_MODEL_H +#define _MOOG_MODEL_H + +#include "stk_model.h" + + +class moogModel: public stkModel +{ +public: + moogModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _filter_q = 64.0f, + StkFloat _filter_sweep_rate = 64.0f, + StkFloat _vibrato_frequency = 64.0f, + StkFloat _vibrato_gain = 64.0f ); + ~moogModel(); + + inline floatModel * filterQ( void ) const + { + return( m_filterQ ); + } + + inline floatModel * filterSweepRate( void ) const + { + return( m_filterSweepRate ); + } + + inline floatModel * vibratoFrequency( void ) const + { + return( m_vibratoFrequency ); + } + + inline floatModel * vibratoGain( void ) const + { + return( m_vibratoGain ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_filterQ; + floatModel * m_filterSweepRate; + floatModel * m_vibratoFrequency; + floatModel * m_vibratoGain; +}; + +#endif diff --git a/plugins/stk/voices/moog/moog_processor.cpp b/plugins/stk/voices/moog/moog_processor.cpp new file mode 100644 index 000000000..958c1ca4f --- /dev/null +++ b/plugins/stk/voices/moog/moog_processor.cpp @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "moog_processor.h" +#include "config_mgr.h" + + +moogProcessor::moogProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +moogProcessor::~moogProcessor() +{ +} + + + + +void moogProcessor::setControls( moogModel * _model ) +{ + voice()->controlChange( 2, _model->filterQ()->value() ); + voice()->controlChange( 4, _model->filterSweepRate()->value() ); + voice()->controlChange( 11, _model->vibratoFrequency()->value() ); + voice()->controlChange( 1, _model->vibratoGain()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/moog/moog_processor.h b/plugins/stk/voices/moog/moog_processor.h new file mode 100644 index 000000000..6bbc01ed3 --- /dev/null +++ b/plugins/stk/voices/moog/moog_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _MOOG_PROCESSOR_H +#define _MOOG_PROCESSOR_H + +#include "Moog.h" + +#include "stk_processor.h" + +#include "moog_model.h" + +class moogProcessor: public stkProcessor +{ +public: + moogProcessor( sample_rate_t _sample_rate ); + ~moogProcessor( void ); + + void setControls( moogModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/percflute/Makefile.am b/plugins/stk/voices/percflute/Makefile.am new file mode 100644 index 000000000..bdacf3b80 --- /dev/null +++ b/plugins/stk/voices/percflute/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="percflute" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./percflute_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libpercflute.la + +libpercflute_la_SOURCES = percflute_model.cpp \ + percflute_model.h \ + percflute_processor.cpp \ + percflute_processor.h \ + percflute_instrument.cpp \ + percflute_instrument.h \ + percflute_instrument_view.cpp \ + percflute_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libpercflute_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libpercflute_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/percflute/artwork.png b/plugins/stk/voices/percflute/artwork.png new file mode 100644 index 000000000..a0aad9db5 Binary files /dev/null and b/plugins/stk/voices/percflute/artwork.png differ diff --git a/plugins/stk/voices/percflute/logo.png b/plugins/stk/voices/percflute/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/percflute/logo.png differ diff --git a/plugins/stk/voices/percflute/percflute_instrument.cpp b/plugins/stk/voices/percflute/percflute_instrument.cpp new file mode 100644 index 000000000..2331f59a7 --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "percflute_instrument.h" +#include "percflute_instrument_view.h" +#include "percflute_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor percflute_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Perc Flute", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Flute noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +percfluteInstrument::percfluteInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &percflute_plugin_descriptor ) +{ + model()->index()->setTrack( _channel_track ); + model()->crossfade()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +percfluteInstrument::~percfluteInstrument() +{ +} + + + + +QString percfluteInstrument::nodeName( void ) const +{ + return( percflute_plugin_descriptor.name ); +} + + + + +pluginView * percfluteInstrument::instantiateView( QWidget * _parent ) +{ + return( new percfluteInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new percfluteInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/percflute/percflute_instrument.h b/plugins/stk/voices/percflute/percflute_instrument.h new file mode 100644 index 000000000..2db4e5e3a --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _PERCFLUTE_INSTRUMENT_H +#define _PERCFLUTE_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "percflute_processor.h" +#include "percflute_model.h" + + +class percfluteInstrument : public stkInstrument +{ +public: + percfluteInstrument( instrumentTrack * _channel_track ); + virtual ~percfluteInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/percflute/percflute_instrument_view.cpp b/plugins/stk/voices/percflute/percflute_instrument_view.cpp new file mode 100644 index 000000000..0d03c66b2 --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "percflute_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +percfluteInstrumentView::percfluteInstrumentView( percfluteInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_index = new knob( knobSmall_17, m_topView, tr( "Index" ) ); + m_index->setLabel( tr( "Modulator Index" ) ); + m_index->setHintText( tr( "Index:" ) + " ", "" ); + + m_crossfade = new knob( knobSmall_17, m_topView, tr( "Crossfade" ) ); + m_crossfade->setLabel( tr( "Modulator Crossfade" ) ); + m_crossfade->setHintText( tr( "Crossfade:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_index ); + h1->addWidget( m_crossfade ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +percfluteInstrumentView::~percfluteInstrumentView() +{ +} + + + + +void percfluteInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + percfluteInstrument * inst = castModel(); + m_index->setModel( inst->model()->index() ); + m_crossfade->setModel( inst->model()->crossfade() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/percflute/percflute_instrument_view.h b/plugins/stk/voices/percflute/percflute_instrument_view.h new file mode 100644 index 000000000..c4bdc6194 --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _PERCFLUTE_INSTRUMENT_VIEW_H +#define _PERCFLUTE_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "percflute_instrument.h" + + +class percfluteInstrumentView: public stkInstrumentView +{ +public: + percfluteInstrumentView( percfluteInstrument * _instrument, QWidget * _parent ); + virtual ~percfluteInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_index; + knob * m_crossfade; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/percflute/percflute_model.cpp b/plugins/stk/voices/percflute/percflute_model.cpp new file mode 100644 index 000000000..7eef710f6 --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "percflute_model.h" + + +percfluteModel::percfluteModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _index, + StkFloat _crossfade, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_index( new floatModel( _index, 0.0f, 128.0f, 0.1f, this ) ), + m_crossfade( new floatModel( _crossfade, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +percfluteModel::~percfluteModel() +{ + delete m_index; + delete m_crossfade; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL percfluteModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_index->saveSettings( _doc, _parent, "index" ); + m_crossfade->saveSettings( _doc, _parent, "crossfade" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL percfluteModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_index->loadSettings( _this, "index" ); + m_crossfade->loadSettings( _this, "crossfade" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/percflute/percflute_model.h b/plugins/stk/voices/percflute/percflute_model.h new file mode 100644 index 000000000..5d4c62112 --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _PERCFLUTE_MODEL_H +#define _PERCFLUTE_MODEL_H + +#include "stk_model.h" + + +class percfluteModel: public stkModel +{ +public: + percfluteModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _index = 64.0f, + StkFloat _crossfade = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~percfluteModel(); + + inline floatModel * index( void ) const + { + return( m_index ); + } + + inline floatModel * crossfade( void ) const + { + return( m_crossfade ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_index; + floatModel * m_crossfade; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/percflute/percflute_processor.cpp b/plugins/stk/voices/percflute/percflute_processor.cpp new file mode 100644 index 000000000..74bae72fe --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "percflute_processor.h" +#include "config_mgr.h" + + +percfluteProcessor::percfluteProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +percfluteProcessor::~percfluteProcessor() +{ +} + + + + +void percfluteProcessor::setControls( percfluteModel * _model ) +{ + voice()->controlChange( 2, _model->index()->value() ); + voice()->controlChange( 4, _model->crossfade()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/percflute/percflute_processor.h b/plugins/stk/voices/percflute/percflute_processor.h new file mode 100644 index 000000000..19e5ab507 --- /dev/null +++ b/plugins/stk/voices/percflute/percflute_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _PERCFLUTE_PROCESSOR_H +#define _PERCFLUTE_PROCESSOR_H + +#include "PercFlut.h" + +#include "stk_processor.h" + +#include "percflute_model.h" + +class percfluteProcessor: public stkProcessor +{ +public: + percfluteProcessor( sample_rate_t _sample_rate ); + ~percfluteProcessor( void ); + + void setControls( percfluteModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/resonate/Makefile.am b/plugins/stk/voices/resonate/Makefile.am new file mode 100644 index 000000000..58fe47db2 --- /dev/null +++ b/plugins/stk/voices/resonate/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="resonate" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./resonate_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libresonate.la + +libresonate_la_SOURCES = resonate_model.cpp \ + resonate_model.h \ + resonate_processor.cpp \ + resonate_processor.h \ + resonate_instrument.cpp \ + resonate_instrument.h \ + resonate_instrument_view.cpp \ + resonate_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libresonate_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libresonate_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/resonate/artwork.png b/plugins/stk/voices/resonate/artwork.png new file mode 100644 index 000000000..5d4eb3877 Binary files /dev/null and b/plugins/stk/voices/resonate/artwork.png differ diff --git a/plugins/stk/voices/resonate/logo.png b/plugins/stk/voices/resonate/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/resonate/logo.png differ diff --git a/plugins/stk/voices/resonate/resonate_instrument.cpp b/plugins/stk/voices/resonate/resonate_instrument.cpp new file mode 100644 index 000000000..2b2a18c92 --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_instrument.cpp @@ -0,0 +1,102 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "resonate_instrument.h" +#include "resonate_instrument_view.h" +#include "resonate_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor resonate_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Resonate", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Filered noise" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +resonateInstrument::resonateInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &resonate_plugin_descriptor ) +{ + model()->resonanceFrequency()->setTrack( _channel_track ); + model()->poleRadii()->setTrack( _channel_track ); + model()->notchFrequency()->setTrack( _channel_track ); + model()->zeroRadii()->setTrack( _channel_track ); +} + + + + +resonateInstrument::~resonateInstrument() +{ +} + + + + +QString resonateInstrument::nodeName( void ) const +{ + return( resonate_plugin_descriptor.name ); +} + + + + +pluginView * resonateInstrument::instantiateView( QWidget * _parent ) +{ + return( new resonateInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new resonateInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/resonate/resonate_instrument.h b/plugins/stk/voices/resonate/resonate_instrument.h new file mode 100644 index 000000000..5024241bd --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _RESONATE_INSTRUMENT_H +#define _RESONATE_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "resonate_processor.h" +#include "resonate_model.h" + + +class resonateInstrument : public stkInstrument +{ +public: + resonateInstrument( instrumentTrack * _channel_track ); + virtual ~resonateInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/resonate/resonate_instrument_view.cpp b/plugins/stk/voices/resonate/resonate_instrument_view.cpp new file mode 100644 index 000000000..ca31572e8 --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_instrument_view.cpp @@ -0,0 +1,100 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "resonate_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +resonateInstrumentView::resonateInstrumentView( resonateInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout; + QHBoxLayout * h2 = new QHBoxLayout; + + m_resonanceFrequency = new knob( knobSmall_17, m_topView, tr( "Resonance" ) ); + m_resonanceFrequency->setLabel( tr( "Resonance Frequency" ) ); + m_resonanceFrequency->setHintText( tr( "Frequency:" ) + " ", "" ); + + m_poleRadii = new knob( knobSmall_17, m_topView, tr( "Pole Radii" ) ); + m_poleRadii->setLabel( tr( "Pole Radii" ) ); + m_poleRadii->setHintText( tr( "Radii:" ) + " ", "" ); + + m_notchFrequency = new knob( knobSmall_17, m_topView, tr( "Notch" ) ); + m_notchFrequency->setLabel( tr( "Notch Frequency" ) ); + m_notchFrequency->setHintText( tr( "Frequency:" ) + " ", "" ); + + m_zeroRadii = new knob( knobSmall_17, m_topView, tr( "Zero Radii" ) ); + m_zeroRadii->setLabel( tr( "Zero Radii" ) ); + m_zeroRadii->setHintText( tr( "Radii:" ) + " ", "" ); + + h1->addWidget( m_resonanceFrequency ); + h1->addWidget( m_poleRadii ); + + h2->addWidget( m_notchFrequency ); + h2->addWidget( m_zeroRadii ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +resonateInstrumentView::~resonateInstrumentView() +{ +} + + + + +void resonateInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + resonateInstrument * inst = castModel(); + m_resonanceFrequency->setModel( inst->model()->resonanceFrequency() ); + m_poleRadii->setModel( inst->model()->poleRadii() ); + m_notchFrequency->setModel( inst->model()->notchFrequency() ); + m_zeroRadii->setModel( inst->model()->zeroRadii() ); +} + + + diff --git a/plugins/stk/voices/resonate/resonate_instrument_view.h b/plugins/stk/voices/resonate/resonate_instrument_view.h new file mode 100644 index 000000000..811455283 --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_instrument_view.h @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _RESONATE_INSTRUMENT_VIEW_H +#define _RESONATE_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "resonate_instrument.h" + + +class resonateInstrumentView: public stkInstrumentView +{ +public: + resonateInstrumentView( resonateInstrument * _instrument, QWidget * _parent ); + virtual ~resonateInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_resonanceFrequency; + knob * m_poleRadii; + knob * m_notchFrequency; + knob * m_zeroRadii; +}; + +#endif diff --git a/plugins/stk/voices/resonate/resonate_model.cpp b/plugins/stk/voices/resonate/resonate_model.cpp new file mode 100644 index 000000000..cc7a383f3 --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_model.cpp @@ -0,0 +1,83 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "resonate_model.h" + + +resonateModel::resonateModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _resonance_frequency, + StkFloat _pole_radii, + StkFloat _notch_frequency, + StkFloat _zero_radii ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_resonanceFrequency( new floatModel( _resonance_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_poleRadii( new floatModel( _pole_radii, 0.0f, 128.0f, 0.1f, this ) ), + m_notchFrequency( new floatModel( _notch_frequency, 0.0f, 128.0f, 0.1f, this ) ), + m_zeroRadii( new floatModel( _zero_radii, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +resonateModel::~resonateModel() +{ + delete m_resonanceFrequency; + delete m_poleRadii; + delete m_notchFrequency; + delete m_zeroRadii; +} + + + + +void FASTCALL resonateModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_resonanceFrequency->saveSettings( _doc, _parent, "resonancefrequency" ); + m_poleRadii->saveSettings( _doc, _parent, "poleradii" ); + m_notchFrequency->saveSettings( _doc, _parent, "notchfrequency" ); + m_zeroRadii->saveSettings( _doc, _parent, "zeroradii" ); +} + + + + +void FASTCALL resonateModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_resonanceFrequency->loadSettings( _this, "resonancefrequency" ); + m_poleRadii->loadSettings( _this, "poleradii" ); + m_notchFrequency->loadSettings( _this, "notchfrequency" ); + m_zeroRadii->loadSettings( _this, "zeroradii" ); +} + diff --git a/plugins/stk/voices/resonate/resonate_model.h b/plugins/stk/voices/resonate/resonate_model.h new file mode 100644 index 000000000..bf2b648ee --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_model.h @@ -0,0 +1,79 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _RESONATE_MODEL_H +#define _RESONATE_MODEL_H + +#include "stk_model.h" + + +class resonateModel: public stkModel +{ +public: + resonateModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _resonance_frequency = 64.0f, + StkFloat _pole_radii = 64.0f, + StkFloat _notch_frequency = 64.0f, + StkFloat _zero_radii = 64.0f ); + ~resonateModel(); + + inline floatModel * resonanceFrequency( void ) const + { + return( m_resonanceFrequency ); + } + + inline floatModel * poleRadii( void ) const + { + return( m_poleRadii ); + } + + inline floatModel * notchFrequency( void ) const + { + return( m_notchFrequency ); + } + + inline floatModel * zeroRadii( void ) const + { + return( m_zeroRadii ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_resonanceFrequency; + floatModel * m_poleRadii; + floatModel * m_notchFrequency; + floatModel * m_zeroRadii; +}; + +#endif diff --git a/plugins/stk/voices/resonate/resonate_processor.cpp b/plugins/stk/voices/resonate/resonate_processor.cpp new file mode 100644 index 000000000..6a1e86fe8 --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_processor.cpp @@ -0,0 +1,50 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "resonate_processor.h" +#include "config_mgr.h" + + +resonateProcessor::resonateProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +resonateProcessor::~resonateProcessor() +{ +} + + + + +void resonateProcessor::setControls( resonateModel * _model ) +{ + voice()->controlChange( 2, _model->resonanceFrequency()->value() ); + voice()->controlChange( 4, _model->poleRadii()->value() ); + voice()->controlChange( 11, _model->notchFrequency()->value() ); + voice()->controlChange( 1, _model->zeroRadii()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/resonate/resonate_processor.h b/plugins/stk/voices/resonate/resonate_processor.h new file mode 100644 index 000000000..1ad005825 --- /dev/null +++ b/plugins/stk/voices/resonate/resonate_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _RESONATE_PROCESSOR_H +#define _RESONATE_PROCESSOR_H + +#include "Resonate.h" + +#include "stk_processor.h" + +#include "resonate_model.h" + +class resonateProcessor: public stkProcessor +{ +public: + resonateProcessor( sample_rate_t _sample_rate ); + ~resonateProcessor( void ); + + void setControls( resonateModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/rhodey/Makefile.am b/plugins/stk/voices/rhodey/Makefile.am new file mode 100644 index 000000000..b00bba26a --- /dev/null +++ b/plugins/stk/voices/rhodey/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="rhodey" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./rhodey_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = librhodey.la + +librhodey_la_SOURCES = rhodey_model.cpp \ + rhodey_model.h \ + rhodey_processor.cpp \ + rhodey_processor.h \ + rhodey_instrument.cpp \ + rhodey_instrument.h \ + rhodey_instrument_view.cpp \ + rhodey_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +librhodey_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(librhodey_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/rhodey/artwork.png b/plugins/stk/voices/rhodey/artwork.png new file mode 100644 index 000000000..75b6a353a Binary files /dev/null and b/plugins/stk/voices/rhodey/artwork.png differ diff --git a/plugins/stk/voices/rhodey/logo.png b/plugins/stk/voices/rhodey/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/rhodey/logo.png differ diff --git a/plugins/stk/voices/rhodey/rhodey_instrument.cpp b/plugins/stk/voices/rhodey/rhodey_instrument.cpp new file mode 100644 index 000000000..853c5babc --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "rhodey_instrument.h" +#include "rhodey_instrument_view.h" +#include "rhodey_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor rhodey_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Rhodey", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Rhodes noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +rhodeyInstrument::rhodeyInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &rhodey_plugin_descriptor ) +{ + model()->index()->setTrack( _channel_track ); + model()->crossfade()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +rhodeyInstrument::~rhodeyInstrument() +{ +} + + + + +QString rhodeyInstrument::nodeName( void ) const +{ + return( rhodey_plugin_descriptor.name ); +} + + + + +pluginView * rhodeyInstrument::instantiateView( QWidget * _parent ) +{ + return( new rhodeyInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new rhodeyInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/rhodey/rhodey_instrument.h b/plugins/stk/voices/rhodey/rhodey_instrument.h new file mode 100644 index 000000000..4fdfa7b8d --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _RHODEY_INSTRUMENT_H +#define _RHODEY_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "rhodey_processor.h" +#include "rhodey_model.h" + + +class rhodeyInstrument : public stkInstrument +{ +public: + rhodeyInstrument( instrumentTrack * _channel_track ); + virtual ~rhodeyInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/rhodey/rhodey_instrument_view.cpp b/plugins/stk/voices/rhodey/rhodey_instrument_view.cpp new file mode 100644 index 000000000..34a204cd7 --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "rhodey_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +rhodeyInstrumentView::rhodeyInstrumentView( rhodeyInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_index = new knob( knobSmall_17, m_topView, tr( "Index" ) ); + m_index->setLabel( tr( "Modulator Index" ) ); + m_index->setHintText( tr( "Index:" ) + " ", "" ); + + m_crossfade = new knob( knobSmall_17, m_topView, tr( "Crossfade" ) ); + m_crossfade->setLabel( tr( "Modulator Crossfade" ) ); + m_crossfade->setHintText( tr( "Crossfade:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_index ); + h1->addWidget( m_crossfade ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +rhodeyInstrumentView::~rhodeyInstrumentView() +{ +} + + + + +void rhodeyInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + rhodeyInstrument * inst = castModel(); + m_index->setModel( inst->model()->index() ); + m_crossfade->setModel( inst->model()->crossfade() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/rhodey/rhodey_instrument_view.h b/plugins/stk/voices/rhodey/rhodey_instrument_view.h new file mode 100644 index 000000000..607c3697b --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _RHODEY_INSTRUMENT_VIEW_H +#define _RHODEY_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "rhodey_instrument.h" + + +class rhodeyInstrumentView: public stkInstrumentView +{ +public: + rhodeyInstrumentView( rhodeyInstrument * _instrument, QWidget * _parent ); + virtual ~rhodeyInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_index; + knob * m_crossfade; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/rhodey/rhodey_model.cpp b/plugins/stk/voices/rhodey/rhodey_model.cpp new file mode 100644 index 000000000..472d03291 --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "rhodey_model.h" + + +rhodeyModel::rhodeyModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _index, + StkFloat _crossfade, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_index( new floatModel( _index, 0.0f, 128.0f, 0.1f, this ) ), + m_crossfade( new floatModel( _crossfade, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +rhodeyModel::~rhodeyModel() +{ + delete m_index; + delete m_crossfade; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL rhodeyModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_index->saveSettings( _doc, _parent, "index" ); + m_crossfade->saveSettings( _doc, _parent, "crossfade" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL rhodeyModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_index->loadSettings( _this, "index" ); + m_crossfade->loadSettings( _this, "crossfade" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/rhodey/rhodey_model.h b/plugins/stk/voices/rhodey/rhodey_model.h new file mode 100644 index 000000000..9be409fb7 --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _RHODEY_MODEL_H +#define _RHODEY_MODEL_H + +#include "stk_model.h" + + +class rhodeyModel: public stkModel +{ +public: + rhodeyModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _index = 64.0f, + StkFloat _crossfade = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~rhodeyModel(); + + inline floatModel * index( void ) const + { + return( m_index ); + } + + inline floatModel * crossfade( void ) const + { + return( m_crossfade ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_index; + floatModel * m_crossfade; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/rhodey/rhodey_processor.cpp b/plugins/stk/voices/rhodey/rhodey_processor.cpp new file mode 100644 index 000000000..64a220ccf --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "rhodey_processor.h" +#include "config_mgr.h" + + +rhodeyProcessor::rhodeyProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +rhodeyProcessor::~rhodeyProcessor() +{ +} + + + + +void rhodeyProcessor::setControls( rhodeyModel * _model ) +{ + voice()->controlChange( 2, _model->index()->value() ); + voice()->controlChange( 4, _model->crossfade()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/rhodey/rhodey_processor.h b/plugins/stk/voices/rhodey/rhodey_processor.h new file mode 100644 index 000000000..77dc26069 --- /dev/null +++ b/plugins/stk/voices/rhodey/rhodey_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _RHODEY_PROCESSOR_H +#define _RHODEY_PROCESSOR_H + +#include "Rhodey.h" + +#include "stk_processor.h" + +#include "rhodey_model.h" + +class rhodeyProcessor: public stkProcessor +{ +public: + rhodeyProcessor( sample_rate_t _sample_rate ); + ~rhodeyProcessor( void ); + + void setControls( rhodeyModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/src/stk_model.cpp b/plugins/stk/voices/src/stk_model.cpp new file mode 100644 index 000000000..1bc8d042d --- /dev/null +++ b/plugins/stk/voices/src/stk_model.cpp @@ -0,0 +1,122 @@ +/* + * stk_model.cpp - base class for stk instrument models + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "stk_model.h" + + +stkModel::stkModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + bool _release_triggered, + bool _randomize_attack, + StkFloat _randomize_length, + StkFloat _randomize_velocity_amount, + StkFloat _randomize_frequency_amount, + StkFloat _spread ): + model( NULL ), + m_monophonic( new boolModel( _monophonic, this ) ), + m_portamento( new floatModel( _portamento, 0.0f, 1000.0f, 1.0f, this ) ), + m_bend( new floatModel( _bend, -4096.0f, 4096.0f, 8.192f, this ) ), + m_bendRange( new floatModel( _bend_range, 0.0f, 24.0f, 0.24f, this ) ), + m_velocitySensitiveLPF( new boolModel( _velocity_sensitive_lpf, this ) ), + m_velocitySensitiveQ( new floatModel( _velocity_sensitive_q, basicFilters<>::minQ(), 10.0f, 0.01f, this ) ), + m_volume( new floatModel( _volume, 0.0f, 1.0f, 0.01f, this ) ), + m_pan( new floatModel( _pan, -1.0f, 1.0f, 0.02f, this ) ), + m_releaseTriggered( new boolModel( _release_triggered, this ) ), + m_randomizeAttack( new boolModel( _randomize_attack, this ) ), + m_randomizeLength( new floatModel( _randomize_length, 0.0f, 1000.0f, 1.0f, this ) ), + m_randomizeVelocityAmount( new floatModel( _randomize_velocity_amount, 0.0f, 1.0f, 0.01f, this ) ), + m_randomizeFrequencyAmount( new floatModel( _randomize_frequency_amount, 0.0f, 4.0f, 0.04f, this ) ), + m_spread( new floatModel( _spread, 0.0f, 255.0f, 1.0f, this ) ) +{ +} + + + + +stkModel::~stkModel() +{ + delete m_portamento; + delete m_bend; + delete m_bendRange; + delete m_velocitySensitiveLPF; + delete m_velocitySensitiveQ; + delete m_volume; + delete m_pan; + delete m_releaseTriggered; + delete m_randomizeAttack; + delete m_randomizeVelocityAmount; + delete m_randomizeFrequencyAmount; + delete m_spread; +} + + + + +void FASTCALL stkModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + m_monophonic->saveSettings( _doc, _parent, "monophonic" ); + m_portamento->saveSettings( _doc, _parent, "portamento" ); + m_bend->saveSettings( _doc, _parent, "bend" ); + m_bendRange->saveSettings( _doc, _parent, "bendrange" ); + m_velocitySensitiveLPF->saveSettings( _doc, _parent, "velocitysensitivelpf" ); + m_velocitySensitiveQ->saveSettings( _doc, _parent, "velocitysensitiveq" ); + m_volume->saveSettings( _doc, _parent, "volume" ); + m_pan->saveSettings( _doc, _parent, "pan" ); + m_releaseTriggered->saveSettings( _doc, _parent, "releasetriggered" ); + m_randomizeAttack->saveSettings( _doc, _parent, "randomizeattack" ); + m_randomizeLength->saveSettings( _doc, _parent, "randomizelength" ); + m_randomizeVelocityAmount->saveSettings( _doc, _parent, "randomizevelocityamount" ); + m_randomizeFrequencyAmount->saveSettings( _doc, _parent, "randomizefrequencyamount" ); + m_spread->saveSettings( _doc, _parent, "spread" ); +} + + + + +void FASTCALL stkModel::loadSettings( const QDomElement & _this ) +{ + m_monophonic->loadSettings( _this, "monophonic" ); + m_portamento->loadSettings( _this, "portamento" ); + m_bend->loadSettings( _this, "bend" ); + m_bendRange->loadSettings( _this, "bendrange" ); + m_velocitySensitiveLPF->loadSettings( _this, "velocitysensitivelpf" ); + m_velocitySensitiveQ->loadSettings( _this, "velocitysensitiveq" ); + m_volume->loadSettings( _this, "volume" ); + m_pan->loadSettings( _this, "pan" ); + m_releaseTriggered->loadSettings( _this, "releasetriggered" ); + m_randomizeAttack->loadSettings( _this, "randomizeattack" ); + m_randomizeLength->loadSettings( _this, "randomizelength" ); + m_randomizeVelocityAmount->loadSettings( _this, "randomizevelocityamount" ); + m_randomizeFrequencyAmount->loadSettings( _this, "randomizefrequencyamount" ); + m_spread->loadSettings( _this, "spread" ); +} + + diff --git a/plugins/stk/voices/tubebell/Makefile.am b/plugins/stk/voices/tubebell/Makefile.am new file mode 100644 index 000000000..cb68f3b4b --- /dev/null +++ b/plugins/stk/voices/tubebell/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="tubebell" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./tubebell_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libtubebell.la + +libtubebell_la_SOURCES = tubebell_model.cpp \ + tubebell_model.h \ + tubebell_processor.cpp \ + tubebell_processor.h \ + tubebell_instrument.cpp \ + tubebell_instrument.h \ + tubebell_instrument_view.cpp \ + tubebell_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libtubebell_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libtubebell_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/tubebell/artwork.png b/plugins/stk/voices/tubebell/artwork.png new file mode 100644 index 000000000..0ff9d1e97 Binary files /dev/null and b/plugins/stk/voices/tubebell/artwork.png differ diff --git a/plugins/stk/voices/tubebell/logo.png b/plugins/stk/voices/tubebell/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/tubebell/logo.png differ diff --git a/plugins/stk/voices/tubebell/tubebell_instrument.cpp b/plugins/stk/voices/tubebell/tubebell_instrument.cpp new file mode 100644 index 000000000..000d2ec0d --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "tubebell_instrument.h" +#include "tubebell_instrument_view.h" +#include "tubebell_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor tubebell_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Tube Bell", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Bell noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +tubebellInstrument::tubebellInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &tubebell_plugin_descriptor ) +{ + model()->index()->setTrack( _channel_track ); + model()->crossfade()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +tubebellInstrument::~tubebellInstrument() +{ +} + + + + +QString tubebellInstrument::nodeName( void ) const +{ + return( tubebell_plugin_descriptor.name ); +} + + + + +pluginView * tubebellInstrument::instantiateView( QWidget * _parent ) +{ + return( new tubebellInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new tubebellInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/tubebell/tubebell_instrument.h b/plugins/stk/voices/tubebell/tubebell_instrument.h new file mode 100644 index 000000000..c79aff760 --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _TUBEBELL_INSTRUMENT_H +#define _TUBEBELL_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "tubebell_processor.h" +#include "tubebell_model.h" + + +class tubebellInstrument : public stkInstrument +{ +public: + tubebellInstrument( instrumentTrack * _channel_track ); + virtual ~tubebellInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/tubebell/tubebell_instrument_view.cpp b/plugins/stk/voices/tubebell/tubebell_instrument_view.cpp new file mode 100644 index 000000000..03e5489d6 --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "tubebell_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +tubebellInstrumentView::tubebellInstrumentView( tubebellInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_index = new knob( knobSmall_17, m_topView, tr( "Index" ) ); + m_index->setLabel( tr( "Modulator Index" ) ); + m_index->setHintText( tr( "Index:" ) + " ", "" ); + + m_crossfade = new knob( knobSmall_17, m_topView, tr( "Crossfade" ) ); + m_crossfade->setLabel( tr( "Modulator Crossfade" ) ); + m_crossfade->setHintText( tr( "Crossfade:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_index ); + h1->addWidget( m_crossfade ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +tubebellInstrumentView::~tubebellInstrumentView() +{ +} + + + + +void tubebellInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + tubebellInstrument * inst = castModel(); + m_index->setModel( inst->model()->index() ); + m_crossfade->setModel( inst->model()->crossfade() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/tubebell/tubebell_instrument_view.h b/plugins/stk/voices/tubebell/tubebell_instrument_view.h new file mode 100644 index 000000000..c3e8ae03a --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _TUBEBELL_INSTRUMENT_VIEW_H +#define _TUBEBELL_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "tubebell_instrument.h" + + +class tubebellInstrumentView: public stkInstrumentView +{ +public: + tubebellInstrumentView( tubebellInstrument * _instrument, QWidget * _parent ); + virtual ~tubebellInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_index; + knob * m_crossfade; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/tubebell/tubebell_model.cpp b/plugins/stk/voices/tubebell/tubebell_model.cpp new file mode 100644 index 000000000..a8df61bc6 --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "tubebell_model.h" + + +tubebellModel::tubebellModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _index, + StkFloat _crossfade, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_index( new floatModel( _index, 0.0f, 128.0f, 0.1f, this ) ), + m_crossfade( new floatModel( _crossfade, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +tubebellModel::~tubebellModel() +{ + delete m_index; + delete m_crossfade; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL tubebellModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_index->saveSettings( _doc, _parent, "index" ); + m_crossfade->saveSettings( _doc, _parent, "crossfade" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL tubebellModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_index->loadSettings( _this, "index" ); + m_crossfade->loadSettings( _this, "crossfade" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/tubebell/tubebell_model.h b/plugins/stk/voices/tubebell/tubebell_model.h new file mode 100644 index 000000000..ab10f05cd --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _TUBEBELL_MODEL_H +#define _TUBEBELL_MODEL_H + +#include "stk_model.h" + + +class tubebellModel: public stkModel +{ +public: + tubebellModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _index = 64.0f, + StkFloat _crossfade = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~tubebellModel(); + + inline floatModel * index( void ) const + { + return( m_index ); + } + + inline floatModel * crossfade( void ) const + { + return( m_crossfade ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_index; + floatModel * m_crossfade; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/tubebell/tubebell_processor.cpp b/plugins/stk/voices/tubebell/tubebell_processor.cpp new file mode 100644 index 000000000..8c39a717c --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "tubebell_processor.h" +#include "config_mgr.h" + + +tubebellProcessor::tubebellProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +tubebellProcessor::~tubebellProcessor() +{ +} + + + + +void tubebellProcessor::setControls( tubebellModel * _model ) +{ + voice()->controlChange( 2, _model->index()->value() ); + voice()->controlChange( 4, _model->crossfade()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/tubebell/tubebell_processor.h b/plugins/stk/voices/tubebell/tubebell_processor.h new file mode 100644 index 000000000..7cff391d1 --- /dev/null +++ b/plugins/stk/voices/tubebell/tubebell_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _TUBEBELL_PROCESSOR_H +#define _TUBEBELL_PROCESSOR_H + +#include "TubeBell.h" + +#include "stk_processor.h" + +#include "tubebell_model.h" + +class tubebellProcessor: public stkProcessor +{ +public: + tubebellProcessor( sample_rate_t _sample_rate ); + ~tubebellProcessor( void ); + + void setControls( tubebellModel * _model ); +}; + +#endif diff --git a/plugins/stk/voices/wurley/Makefile.am b/plugins/stk/voices/wurley/Makefile.am new file mode 100644 index 000000000..d7c5cdeec --- /dev/null +++ b/plugins/stk/voices/wurley/Makefile.am @@ -0,0 +1,46 @@ +AUTOMAKE_OPTIONS = foreign 1.4 + + +INCLUDES = -I@stk_includes@ -I$(top_srcdir)/include -I$(top_srcdir)/src/lib -I. -I$(top_srcdir)/plugins/stk/voices/include + + +AM_CXXFLAGS := $(AM_CXXFLAGS) $(QT_CXXFLAGS) -DPLUGIN_NAME="wurley" + + +%.moc: ./%.h + $(MOC) -o $@ $< + + +MOC_FILES = ./wurley_model.moc + +BUILT_SOURCES = $(MOC_FILES) ./embedded_resources.h +EMBEDDED_RESOURCES = $(wildcard *png) + +./embedded_resources.h: $(EMBEDDED_RESOURCES) + $(BIN2RES) $(EMBEDDED_RESOURCES) > $@ + +EXTRA_DIST = $(EMBEDDED_RESOURCES) + + +CLEANFILES = $(MOC_FILES) ./embedded_resources.h + + + +pkglib_LTLIBRARIES = libwurley.la + +libwurley_la_SOURCES = wurley_model.cpp \ + wurley_model.h \ + wurley_processor.cpp \ + wurley_processor.h \ + wurley_instrument.cpp \ + wurley_instrument.h \ + wurley_instrument_view.cpp \ + wurley_instrument_view.h \ + $(top_srcdir)/plugins/stk/voices/src/stk_model.cpp \ + stk_model.h + + + +libwurley_la_LDFLAGS = -L@stk_lib@ -lstk -Wl,-export-dynamic + +$(libwurley_la_SOURCES): ./embedded_resources.h diff --git a/plugins/stk/voices/wurley/artwork.png b/plugins/stk/voices/wurley/artwork.png new file mode 100644 index 000000000..378c980fd Binary files /dev/null and b/plugins/stk/voices/wurley/artwork.png differ diff --git a/plugins/stk/voices/wurley/logo.png b/plugins/stk/voices/wurley/logo.png new file mode 100644 index 000000000..20a608101 Binary files /dev/null and b/plugins/stk/voices/wurley/logo.png differ diff --git a/plugins/stk/voices/wurley/wurley_instrument.cpp b/plugins/stk/voices/wurley/wurley_instrument.cpp new file mode 100644 index 000000000..f924deed3 --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_instrument.cpp @@ -0,0 +1,103 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "engine.h" +#include "note_play_handle.h" + +#include "wurley_instrument.h" +#include "wurley_instrument_view.h" +#include "wurley_processor.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embedded_resources.h" + + +extern "C" +{ + +plugin::descriptor wurley_plugin_descriptor = +{ + STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ), + "Wurley", + QT_TRANSLATE_NOOP( "pluginBrowser", + "Wurlitzer noises" ), + "Danny McRae ", + 0x0100, + plugin::Instrument, + new QPixmap( PLUGIN_NAME::getIconPixmap( "logo" ) ), + NULL +} ; + +} + + +wurleyInstrument::wurleyInstrument( instrumentTrack * _channel_track ): + stkInstrument( _channel_track, &wurley_plugin_descriptor ) +{ + model()->index()->setTrack( _channel_track ); + model()->crossfade()->setTrack( _channel_track ); + model()->lfoSpeed()->setTrack( _channel_track ); + model()->lfoDepth()->setTrack( _channel_track ); + model()->adsrTarget()->setTrack( _channel_track ); +} + + + + +wurleyInstrument::~wurleyInstrument() +{ +} + + + + +QString wurleyInstrument::nodeName( void ) const +{ + return( wurley_plugin_descriptor.name ); +} + + + + +pluginView * wurleyInstrument::instantiateView( QWidget * _parent ) +{ + return( new wurleyInstrumentView( this, _parent ) ); +} + + + + +extern "C" +{ + +// neccessary for getting instance out of shared lib +plugin * lmms_plugin_main( model * _model, void * _data ) +{ + return( new wurleyInstrument( static_cast( _data ) ) ); +} + + +} + + diff --git a/plugins/stk/voices/wurley/wurley_instrument.h b/plugins/stk/voices/wurley/wurley_instrument.h new file mode 100644 index 000000000..fd654ba79 --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_instrument.h @@ -0,0 +1,46 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _WURLEY_INSTRUMENT_H +#define _WURLEY_INSTRUMENT_H + +#include "stk_instrument.h" + +#include "wurley_processor.h" +#include "wurley_model.h" + + +class wurleyInstrument : public stkInstrument +{ +public: + wurleyInstrument( instrumentTrack * _channel_track ); + virtual ~wurleyInstrument( void ); + + QString nodeName( void ) const; + + pluginView * instantiateView( QWidget * _parent ); +}; + +#endif diff --git a/plugins/stk/voices/wurley/wurley_instrument_view.cpp b/plugins/stk/voices/wurley/wurley_instrument_view.cpp new file mode 100644 index 000000000..12cd275db --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_instrument_view.cpp @@ -0,0 +1,110 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include +#include +#include + +#include "wurley_instrument_view.h" + +#include +#include + +#include "engine.h" +#include "gui_templates.h" + +#undef SINGLE_SOURCE_COMPILE +#include "embed.cpp" + + +wurleyInstrumentView::wurleyInstrumentView( wurleyInstrument * _instrument, QWidget * _parent ) : + stkInstrumentView( _instrument, _parent ) +{ + QVBoxLayout * vl = new QVBoxLayout( m_topView ); + QHBoxLayout * h1 = new QHBoxLayout(); + QHBoxLayout * h2 = new QHBoxLayout(); + QHBoxLayout * h3 = new QHBoxLayout(); + + + m_index = new knob( knobSmall_17, m_topView, tr( "Index" ) ); + m_index->setLabel( tr( "Modulator Index" ) ); + m_index->setHintText( tr( "Index:" ) + " ", "" ); + + m_crossfade = new knob( knobSmall_17, m_topView, tr( "Crossfade" ) ); + m_crossfade->setLabel( tr( "Modulator Crossfade" ) ); + m_crossfade->setHintText( tr( "Crossfade:" ) + " ", "" ); + + m_lfoSpeed = new knob( knobSmall_17, m_topView, tr( "LFO Speed" ) ); + m_lfoSpeed->setLabel( tr( "LFO Speed" ) ); + m_lfoSpeed->setHintText( tr( "LFO Speed:" ) + " ", "" ); + + m_lfoDepth = new knob( knobSmall_17, m_topView, tr( "LFO Depth" ) ); + m_lfoDepth->setLabel( tr( "LFO Depth" ) ); + m_lfoDepth->setHintText( tr( "LFO Depth:" ) + " ", "" ); + + m_adsrTarget = new knob( knobSmall_17, m_topView, tr( "ADSR Target" ) ); + m_adsrTarget->setLabel( tr( "ADSR Target" ) ); + m_adsrTarget->setHintText( tr( "ADSR Target:" ) + " ", "" ); + + h1->addWidget( m_index ); + h1->addWidget( m_crossfade ); + + h2->addWidget( m_lfoSpeed ); + h2->addWidget( m_lfoDepth ); + + h3->addWidget( m_adsrTarget ); + + vl->addLayout( h1 ); + vl->addLayout( h2 ); + vl->addLayout( h3 ); + + setAutoFillBackground( TRUE ); + QPalette pal; + pal.setBrush( backgroundRole(), PLUGIN_NAME::getIconPixmap( "artwork" ) ); + setPalette( pal ); +} + + + + +wurleyInstrumentView::~wurleyInstrumentView() +{ +} + + + + +void wurleyInstrumentView::modelChanged( void ) +{ + stkInstrumentView::modelChanged(); + + wurleyInstrument * inst = castModel(); + m_index->setModel( inst->model()->index() ); + m_crossfade->setModel( inst->model()->crossfade() ); + m_lfoSpeed->setModel( inst->model()->lfoSpeed() ); + m_lfoDepth->setModel( inst->model()->lfoDepth() ); + m_adsrTarget->setModel( inst->model()->adsrTarget() ); +} + + + diff --git a/plugins/stk/voices/wurley/wurley_instrument_view.h b/plugins/stk/voices/wurley/wurley_instrument_view.h new file mode 100644 index 000000000..a021833f4 --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_instrument_view.h @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#ifndef _WURLEY_INSTRUMENT_VIEW_H +#define _WURLEY_INSTRUMENT_VIEW_H + +#include "knob.h" + +#include "stk_instrument_view.h" +#include "wurley_instrument.h" + + +class wurleyInstrumentView: public stkInstrumentView +{ +public: + wurleyInstrumentView( wurleyInstrument * _instrument, QWidget * _parent ); + virtual ~wurleyInstrumentView( void ); + +private: + virtual void modelChanged( void ); + + knob * m_index; + knob * m_crossfade; + knob * m_lfoSpeed; + knob * m_lfoDepth; + knob * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/wurley/wurley_model.cpp b/plugins/stk/voices/wurley/wurley_model.cpp new file mode 100644 index 000000000..8d12e23ed --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_model.cpp @@ -0,0 +1,88 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + + +#include "wurley_model.h" + + +wurleyModel::wurleyModel( bool _monophonic, + StkFloat _portamento, + StkFloat _bend, + StkFloat _bend_range, + bool _velocity_sensitive_lpf, + StkFloat _velocity_sensitive_q, + StkFloat _volume, + StkFloat _pan, + StkFloat _spread, + StkFloat _index, + StkFloat _crossfade, + StkFloat _lfo_speed, + StkFloat _lfo_depth, + StkFloat _adsr_target ): + stkModel( _monophonic, _portamento, _bend, _bend_range, _velocity_sensitive_lpf, _velocity_sensitive_q, _volume, _pan, _spread ), + m_index( new floatModel( _index, 0.0f, 128.0f, 0.1f, this ) ), + m_crossfade( new floatModel( _crossfade, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoSpeed( new floatModel( _lfo_speed, 0.0f, 128.0f, 0.1f, this ) ), + m_lfoDepth( new floatModel( _lfo_depth, 0.0f, 128.0f, 0.1f, this ) ), + m_adsrTarget( new floatModel( _adsr_target, 0.0f, 128.0f, 0.1f, this ) ) +{ +} + + + + +wurleyModel::~wurleyModel() +{ + delete m_index; + delete m_crossfade; + delete m_lfoSpeed; + delete m_lfoDepth; + delete m_adsrTarget; +} + + + + +void FASTCALL wurleyModel::saveSettings( QDomDocument & _doc, QDomElement & _parent ) +{ + stkModel::saveSettings( _doc, _parent ); + m_index->saveSettings( _doc, _parent, "index" ); + m_crossfade->saveSettings( _doc, _parent, "crossfade" ); + m_lfoSpeed->saveSettings( _doc, _parent, "lfospeed" ); + m_lfoDepth->saveSettings( _doc, _parent, "lfodepth" ); + m_adsrTarget->saveSettings( _doc, _parent, "adsrtarget" ); +} + + + + +void FASTCALL wurleyModel::loadSettings( const QDomElement & _this ) +{ + stkModel::loadSettings( _this ); + m_index->loadSettings( _this, "index" ); + m_crossfade->loadSettings( _this, "crossfade" ); + m_lfoSpeed->loadSettings( _this, "lfospeed" ); + m_lfoDepth->loadSettings( _this, "lfodepth" ); + m_adsrTarget->loadSettings( _this, "adsrtarget" ); +} + diff --git a/plugins/stk/voices/wurley/wurley_model.h b/plugins/stk/voices/wurley/wurley_model.h new file mode 100644 index 000000000..949b1f0cf --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_model.h @@ -0,0 +1,86 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _WURLEY_MODEL_H +#define _WURLEY_MODEL_H + +#include "stk_model.h" + + +class wurleyModel: public stkModel +{ +public: + wurleyModel( bool _monophonic = FALSE, + StkFloat _portamento = 0.0f, + StkFloat _bend = 0.0f, + StkFloat _bend_range = 2.0f, + bool _velocity_sensitive_lpf = TRUE, + StkFloat _velocity_sensitive_q = 0.5f, + StkFloat _volume = 1.0f, + StkFloat _pan = 0.0f, + StkFloat _spread = 0.0f, + StkFloat _index = 64.0f, + StkFloat _crossfade = 64.0f, + StkFloat _lfo_speed = 64.0f, + StkFloat _lfo_depth = 64.0f, + StkFloat _adsr_target = 64.0f ); + ~wurleyModel(); + + inline floatModel * index( void ) const + { + return( m_index ); + } + + inline floatModel * crossfade( void ) const + { + return( m_crossfade ); + } + + inline floatModel * lfoSpeed( void ) + { + return( m_lfoSpeed ); + } + + inline floatModel * lfoDepth( void ) const + { + return( m_lfoDepth ); + } + + inline floatModel * adsrTarget( void ) const + { + return( m_adsrTarget ); + } + + void FASTCALL saveSettings( QDomDocument & _doc, QDomElement & _parent ); + + void FASTCALL loadSettings( const QDomElement & _this ); + +private: + floatModel * m_index; + floatModel * m_crossfade; + floatModel * m_lfoSpeed; + floatModel * m_lfoDepth; + floatModel * m_adsrTarget; +}; + +#endif diff --git a/plugins/stk/voices/wurley/wurley_processor.cpp b/plugins/stk/voices/wurley/wurley_processor.cpp new file mode 100644 index 000000000..7d989e880 --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_processor.cpp @@ -0,0 +1,51 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ + +#include "wurley_processor.h" +#include "config_mgr.h" + + +wurleyProcessor::wurleyProcessor( sample_rate_t _sample_rate ): + stkProcessor( _sample_rate ) +{ +} + + + + +wurleyProcessor::~wurleyProcessor() +{ +} + + + + +void wurleyProcessor::setControls( wurleyModel * _model ) +{ + voice()->controlChange( 2, _model->index()->value() ); + voice()->controlChange( 4, _model->crossfade()->value() ); + voice()->controlChange( 11, _model->lfoSpeed()->value() ); + voice()->controlChange( 1, _model->lfoDepth()->value() ); + voice()->controlChange( 128, _model->adsrTarget()->value() ); + m_delayRead = m_delayWrite - static_cast( _model->spread()->value() ); +} diff --git a/plugins/stk/voices/wurley/wurley_processor.h b/plugins/stk/voices/wurley/wurley_processor.h new file mode 100644 index 000000000..e84a8ac46 --- /dev/null +++ b/plugins/stk/voices/wurley/wurley_processor.h @@ -0,0 +1,42 @@ +/* + * + * Copyright (c) 2008 Danny McRae + * + * + * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public + * License along with this program (see COPYING); if not, write to the + * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301 USA. + * + */ +#ifndef _WURLEY_PROCESSOR_H +#define _WURLEY_PROCESSOR_H + +#include "Wurley.h" + +#include "stk_processor.h" + +#include "wurley_model.h" + +class wurleyProcessor: public stkProcessor +{ +public: + wurleyProcessor( sample_rate_t _sample_rate ); + ~wurleyProcessor( void ); + + void setControls( wurleyModel * _model ); +}; + +#endif