diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index 66f9b58a1..a459768d3 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -48,6 +48,8 @@ float frnd(float range) #include "templates.h" #include "tooltip.h" #include "song.h" +#include "MidiEvent.h" +#include "MidiTime.h" #include "embed.cpp" @@ -319,6 +321,7 @@ bool SfxrSynth::isPlaying() const sfxrInstrument::sfxrInstrument( InstrumentTrack * _instrument_track ) : Instrument( _instrument_track, &sfxr_plugin_descriptor ), + m_instrumentTrack(_instrument_track), m_attModel(0.0f, this), m_holdModel(0.3f, this), m_susModel(0.0f, this), @@ -449,7 +452,7 @@ QString sfxrInstrument::nodeName() const void sfxrInstrument::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) { fpp_t frameNum = _n->framesLeftForCurrentPeriod(); - if ( _n->totalFramesPlayed() == 0 ) + if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) { _n->m_pluginData = new SfxrSynth( this ); } @@ -466,7 +469,7 @@ void sfxrInstrument::playNote( notePlayHandle * _n, sampleFrame * _working_buffe { for( ch_cnt_t j=0; j(); + InstrumentTrack * it = s->m_instrumentTrack; + it->silenceAllNotes(); + it->processInEvent( MidiEvent( MidiNoteOn, 0, it->baseNoteModel()->value(), MidiMaxVelocity ), MidiTime() ); +} + + + extern "C" { diff --git a/plugins/sfxr/sfxr.h b/plugins/sfxr/sfxr.h index 20250db70..524f67314 100644 --- a/plugins/sfxr/sfxr.h +++ b/plugins/sfxr/sfxr.h @@ -184,6 +184,7 @@ public: private: + InstrumentTrack * m_instrumentTrack; SfxrZeroToOneFloatModel m_attModel; SfxrZeroToOneFloatModel m_holdModel; SfxrZeroToOneFloatModel m_susModel; @@ -241,6 +242,8 @@ protected slots: void randomize(); void mutate(); + void previewSound(); + private: virtual void modelChanged();