diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index cb9abffe375..a6974a1a1c3 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -166,7 +166,7 @@ class EXPORT InstrumentTrack : public Track, public MidiEventProcessor { return &m_baseNoteModel; } - + int baseNote() const; Piano *pianoModel() @@ -207,6 +207,8 @@ class EXPORT InstrumentTrack : public Track, public MidiEventProcessor return &m_effectChannelModel; } + void setPreviewMode( const bool ); + signals: void instrumentChanged(); @@ -242,15 +244,17 @@ protected slots: bool m_silentBuffersProcessed; + bool m_previewMode; + IntModel m_baseNoteModel; NotePlayHandleList m_processHandles; FloatModel m_volumeModel; FloatModel m_panningModel; - + AudioPort m_audioPort; - + FloatModel m_pitchModel; IntModel m_pitchRangeModel; IntModel m_effectChannelModel; diff --git a/src/core/PresetPreviewPlayHandle.cpp b/src/core/PresetPreviewPlayHandle.cpp index 94b25ae5f14..dd57e9f9c8e 100644 --- a/src/core/PresetPreviewPlayHandle.cpp +++ b/src/core/PresetPreviewPlayHandle.cpp @@ -47,6 +47,7 @@ class PreviewTrackContainer : public TrackContainer setJournalling( false ); m_previewInstrumentTrack = dynamic_cast( Track::create( Track::InstrumentTrack, this ) ); m_previewInstrumentTrack->setJournalling( false ); + m_previewInstrumentTrack->setPreviewMode( true ); } virtual ~PreviewTrackContainer() diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index 1466eb64514..80b5427b17a 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -95,6 +95,7 @@ InstrumentTrack::InstrumentTrack( TrackContainer* tc ) : m_notes(), m_sustainPedalPressed( false ), m_silentBuffersProcessed( false ), + m_previewMode( false ), m_baseNoteModel( 0, 0, KeysPerOctave * NumOctaves - 1, this, tr( "Base note" ) ), m_volumeModel( DefaultVolume, MinVolume, MaxVolume, 0.1f, this, tr( "Volume" ) ), @@ -724,7 +725,10 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement m_pitchRangeModel.loadSettings( thisElement, "pitchrange" ); m_pitchModel.loadSettings( thisElement, "pitch" ); m_effectChannelModel.setRange( 0, Engine::fxMixer()->numChannels()-1 ); - m_effectChannelModel.loadSettings( thisElement, "fxch" ); + if ( !m_previewMode ) + { + m_effectChannelModel.loadSettings( thisElement, "fxch" ); + } m_baseNoteModel.loadSettings( thisElement, "basenote" ); m_useMasterPitchModel.loadSettings( thisElement, "usemasterpitch"); @@ -791,6 +795,14 @@ void InstrumentTrack::loadTrackSpecificSettings( const QDomElement & thisElement +void InstrumentTrack::setPreviewMode( const bool value ) +{ + m_previewMode = value; +} + + + + Instrument * InstrumentTrack::loadInstrument( const QString & _plugin_name ) { silenceAllNotes( true ); @@ -1774,7 +1786,7 @@ void InstrumentTrackWindow::viewInstrumentInDirection(int d) idxOfNext = (idxOfNext + d + trackViews.size()) % trackViews.size(); newView = dynamic_cast(trackViews[idxOfNext]); // the window that should be brought to focus is the FIRST InstrumentTrackView that comes after us - if (bringToFront == nullptr && newView != nullptr) + if (bringToFront == nullptr && newView != nullptr) { bringToFront = newView; } @@ -1791,7 +1803,7 @@ void InstrumentTrackWindow::viewInstrumentInDirection(int d) // save current window pos and then hide the window by unchecking its button in the track list QPoint curPos = parentWidget()->pos(); m_itv->m_tlb->setChecked(false); - + // enable the new window by checking its track list button & moving it to where our window just was newView->m_tlb->setChecked(true); newView->getInstrumentTrackWindow()->parentWidget()->move(curPos);