From 725ff59f0edb800d9ab3ef400680cfe2f313f433 Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Sun, 26 Jan 2014 16:44:54 +0100 Subject: [PATCH] NotePlayHandle: added property to track origin Using the origin property we can track where a NotePlayHandle instance originates from (Pattern, MIDI, ...) and build new functions around this. --- include/note_play_handle.h | 13 ++++++++++++- src/core/note_play_handle.cpp | 6 ++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/include/note_play_handle.h b/include/note_play_handle.h index 859498b69..9c22eea3b 100644 --- a/include/note_play_handle.h +++ b/include/note_play_handle.h @@ -48,12 +48,22 @@ public: void * m_pluginData; basicFilters<> * m_filter; + // specifies origin of NotePlayHandle + enum Origins + { + OriginPattern, /*! playback of a note from a pattern */ + OriginMidiInput, /*! playback of a MIDI note input event */ + OriginCount + }; + typedef Origins Origin; + notePlayHandle( InstrumentTrack * _instrument_track, const f_cnt_t _offset, const f_cnt_t _frames, const note & _n, notePlayHandle * _parent = NULL, const bool _part_of_arp = false, - int midiEventChannel = -1 ); + int midiEventChannel = -1, + Origin origin = OriginPattern ); virtual ~notePlayHandle(); virtual void setVolume( const volume_t volume = DefaultVolume ); @@ -281,6 +291,7 @@ private: MidiTime m_songGlobalParentOffset; const int m_midiChannel; + const Origin m_origin; } ; diff --git a/src/core/note_play_handle.cpp b/src/core/note_play_handle.cpp index c22d2c645..96d93c3de 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/note_play_handle.cpp @@ -50,7 +50,8 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it, const note & _n, notePlayHandle *parent, const bool _part_of_arp, - int midiEventChannel ) : + int midiEventChannel, + Origin origin ) : playHandle( NotePlayHandle, _offset ), note( _n.length(), _n.pos(), _n.key(), _n.getVolume(), _n.getPanning(), _n.detuning() ), @@ -76,7 +77,8 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it, m_unpitchedFrequency( 0 ), m_baseDetuning( NULL ), m_songGlobalParentOffset( 0 ), - m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack()->midiPort()->realOutputChannel() ) + m_midiChannel( midiEventChannel >= 0 ? midiEventChannel : instrumentTrack()->midiPort()->realOutputChannel() ), + m_origin( origin ) { if( isTopNote() ) {