diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index 66f9b58a1..070be1358 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -319,6 +319,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), @@ -651,6 +652,17 @@ sfxrInstrumentView::sfxrInstrumentView( Instrument * _instrument, connect( m_mutateBtn, SIGNAL ( clicked() ), this, SLOT ( mutate() ) ); + //preview sound on generator/random/mutate button clicked + connect( m_pickupBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_laserBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_explosionBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_powerupBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_hitBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_jumpBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_blipBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_randomizeBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + connect( m_mutateBtn, SIGNAL ( clicked() ), this, SLOT ( previewSound() ) ); + } @@ -1046,6 +1058,16 @@ void sfxrInstrumentView::mutate() +void sfxrInstrumentView::previewSound() +{ + sfxrInstrument * s = castModel(); + InstrumentTrack * it = s->m_instrumentTrack; + it->processInEvent( midiEvent( MidiNoteOff, 0, it->baseNoteModel()->value(), 0 ), midiTime() ); + 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();