From ca0e413fd3de23964347ea7131e06166ac6cd2bf Mon Sep 17 00:00:00 2001 From: Tobias Doerffel Date: Wed, 29 Jan 2014 23:52:57 +0100 Subject: [PATCH] Renamed PlayHandle classes and some functions with bool return values Next big coding style update - this time all PlayHandle classes are affected. Functions like done() and released() were renamed to isFinished() and isReleased(). --- include/AutomationEditor.h | 2 +- include/DummyInstrument.h | 2 +- include/Instrument.h | 10 +- include/InstrumentFunctions.h | 6 +- include/InstrumentPlayHandle.h | 17 +- include/InstrumentSoundShaping.h | 6 +- include/InstrumentTrack.h | 15 +- include/Mixer.h | 14 +- .../{note_play_handle.h => NotePlayHandle.h} | 156 ++++++++++-------- include/{play_handle.h => PlayHandle.h} | 52 +++--- ...lay_handle.h => PresetPreviewPlayHandle.h} | 34 ++-- include/SamplePlayHandle.h | 4 +- include/SampleRecordHandle.h | 5 +- include/file_browser.h | 4 +- include/piano_roll.h | 2 +- .../audio_file_processor.cpp | 8 +- .../audio_file_processor.h | 6 +- plugins/bit_invader/bit_invader.cpp | 8 +- plugins/bit_invader/bit_invader.h | 8 +- plugins/flp_import/FlpImport.cpp | 2 +- plugins/kicker/kicker.cpp | 12 +- plugins/kicker/kicker.h | 6 +- plugins/lb302/lb302.cpp | 6 +- plugins/lb302/lb302.h | 6 +- plugins/lb303/lb303.cpp | 6 +- plugins/lb303/lb303.h | 6 +- plugins/organic/organic.cpp | 6 +- plugins/organic/organic.h | 6 +- plugins/papu/papu_instrument.cpp | 7 +- plugins/papu/papu_instrument.h | 6 +- plugins/patman/patman.cpp | 8 +- plugins/patman/patman.h | 6 +- .../peak_controller_effect_controls.cpp | 4 +- plugins/sf2_player/sf2_player.cpp | 6 +- plugins/sf2_player/sf2_player.h | 6 +- plugins/sfxr/sfxr.cpp | 6 +- plugins/sfxr/sfxr.h | 4 +- plugins/sid/sid_instrument.cpp | 8 +- plugins/sid/sid_instrument.h | 6 +- plugins/stk/mallets/mallets.cpp | 4 +- plugins/stk/mallets/mallets.h | 6 +- .../triple_oscillator/TripleOscillator.cpp | 6 +- plugins/triple_oscillator/TripleOscillator.h | 6 +- plugins/vibed/vibed.cpp | 6 +- plugins/vibed/vibed.h | 6 +- plugins/zynaddsubfx/ZynAddSubFx.h | 2 +- src/core/Instrument.cpp | 9 +- src/core/InstrumentFunctions.cpp | 22 ++- src/core/InstrumentSoundShaping.cpp | 10 +- src/core/Mixer.cpp | 27 ++- ...ote_play_handle.cpp => NotePlayHandle.cpp} | 106 ++++++------ ...handle.cpp => PresetPreviewPlayHandle.cpp} | 60 ++++--- src/core/SamplePlayHandle.cpp | 18 +- src/core/SampleRecordHandle.cpp | 4 +- src/core/engine.cpp | 8 +- src/core/song.cpp | 6 +- src/gui/file_browser.cpp | 10 +- src/tracks/InstrumentTrack.cpp | 32 ++-- src/tracks/SampleTrack.cpp | 2 +- 59 files changed, 413 insertions(+), 419 deletions(-) rename include/{note_play_handle.h => NotePlayHandle.h} (50%) rename include/{play_handle.h => PlayHandle.h} (61%) rename include/{preset_preview_play_handle.h => PresetPreviewPlayHandle.h} (61%) rename src/core/{note_play_handle.cpp => NotePlayHandle.cpp} (81%) rename src/core/{preset_preview_play_handle.cpp => PresetPreviewPlayHandle.cpp} (73%) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 1e37cd9b4..7e3c0d289 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -41,7 +41,7 @@ class QPixmap; class QScrollBar; class comboBox; -class notePlayHandle; +class NotePlayHandle; class timeLine; class toolButton; diff --git a/include/DummyInstrument.h b/include/DummyInstrument.h index f5ef60d0c..091fedc0e 100644 --- a/include/DummyInstrument.h +++ b/include/DummyInstrument.h @@ -42,7 +42,7 @@ public: { } - virtual void playNote( notePlayHandle *, bool, sampleFrame * ) + virtual void playNote( NotePlayHandle *, bool, sampleFrame * ) { } diff --git a/include/Instrument.h b/include/Instrument.h index 0a840daa3..c937cf064 100644 --- a/include/Instrument.h +++ b/include/Instrument.h @@ -37,7 +37,7 @@ class InstrumentTrack; class InstrumentView; class MidiEvent; class MidiTime; -class notePlayHandle; +class NotePlayHandle; class track; @@ -58,7 +58,7 @@ public: virtual void play( sampleFrame * _working_buffer ); // to be implemented by actual plugin - virtual void playNote( notePlayHandle * /* _note_to_play */, + virtual void playNote( NotePlayHandle * /* _note_to_play */, sampleFrame * /* _working_buf */ ) { } @@ -66,13 +66,13 @@ public: // needed for deleting plugin-specific-data of a note - plugin has to // cast void-ptr so that the plugin-data is deleted properly // (call of dtor if it's a class etc.) - virtual void deleteNotePluginData( notePlayHandle * _note_to_play ); + virtual void deleteNotePluginData( NotePlayHandle * _note_to_play ); // Get number of sample-frames that should be used when playing beat // (note with unspecified length) // Per default this function returns 0. In this case, channel is using // the length of the longest envelope (if one active). - virtual f_cnt_t beatLen( notePlayHandle * _n ) const; + virtual f_cnt_t beatLen( NotePlayHandle * _n ) const; // some instruments need a certain number of release-frames even @@ -127,7 +127,7 @@ protected: // instruments may use this to apply a soft fade out at the end of // notes - method does this only if really less or equal // desiredReleaseFrames() frames are left - void applyRelease( sampleFrame * buf, const notePlayHandle * _n ); + void applyRelease( sampleFrame * buf, const NotePlayHandle * _n ); private: diff --git a/include/InstrumentFunctions.h b/include/InstrumentFunctions.h index 14b1ae618..c8981f04d 100644 --- a/include/InstrumentFunctions.h +++ b/include/InstrumentFunctions.h @@ -33,7 +33,7 @@ class InstrumentTrack; -class notePlayHandle; +class NotePlayHandle; @@ -51,7 +51,7 @@ public: InstrumentFunctionNoteStacking( Model * _parent ); virtual ~InstrumentFunctionNoteStacking(); - void processNote( notePlayHandle * _n ); + void processNote( NotePlayHandle* n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); @@ -172,7 +172,7 @@ public: InstrumentFunctionArpeggio( Model * _parent ); virtual ~InstrumentFunctionArpeggio(); - void processNote( notePlayHandle * _n ); + void processNote( NotePlayHandle* n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/include/InstrumentPlayHandle.h b/include/InstrumentPlayHandle.h index b34675e4a..cf472db9e 100644 --- a/include/InstrumentPlayHandle.h +++ b/include/InstrumentPlayHandle.h @@ -25,16 +25,16 @@ #ifndef _INSTRUMENT_PLAY_HANDLE_H #define _INSTRUMENT_PLAY_HANDLE_H -#include "play_handle.h" +#include "PlayHandle.h" #include "Instrument.h" -class InstrumentPlayHandle : public playHandle +class InstrumentPlayHandle : public PlayHandle { public: - InstrumentPlayHandle( Instrument * _instrument ) : - playHandle( playHandle::InstrumentPlayHandle ), - m_instrument( _instrument ) + InstrumentPlayHandle( Instrument* instrument ) : + PlayHandle( TypeInstrumentPlayHandle ), + m_instrument( instrument ) { } @@ -48,21 +48,20 @@ public: m_instrument->play( _working_buffer ); } - virtual bool done() const + virtual bool isFinished() const { return false; } - virtual bool isFromTrack( const track * _track ) const + virtual bool isFromTrack( const track* _track ) const { return m_instrument->isFromTrack( _track ); } private: - Instrument * m_instrument; + Instrument* m_instrument; } ; - #endif diff --git a/include/InstrumentSoundShaping.h b/include/InstrumentSoundShaping.h index eae4b9b69..a6f812fc5 100644 --- a/include/InstrumentSoundShaping.h +++ b/include/InstrumentSoundShaping.h @@ -31,7 +31,7 @@ class InstrumentTrack; class EnvelopeAndLfoParameters; -class notePlayHandle; +class NotePlayHandle; class InstrumentSoundShaping : public Model, public JournallingObject @@ -42,7 +42,7 @@ public: virtual ~InstrumentSoundShaping(); void processAudioBuffer( sampleFrame * _ab, const fpp_t _frames, - notePlayHandle * _n ); + NotePlayHandle * _n ); enum Targets { @@ -55,7 +55,7 @@ public: f_cnt_t envFrames( const bool _only_vol = false ) const; f_cnt_t releaseFrames() const; - float volumeLevel( notePlayHandle * _n, const f_cnt_t _frame ); + float volumeLevel( NotePlayHandle * _n, const f_cnt_t _frame ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/include/InstrumentTrack.h b/include/InstrumentTrack.h index d4ca720c3..b3639521d 100644 --- a/include/InstrumentTrack.h +++ b/include/InstrumentTrack.h @@ -31,7 +31,7 @@ #include "InstrumentSoundShaping.h" #include "MidiEventProcessor.h" #include "MidiPort.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "Piano.h" #include "PianoView.h" #include "Pitch.h" @@ -52,7 +52,6 @@ class knob; class lcdSpinBox; class midiPortMenu; class multimediaProject; -class notePlayHandle; class PluginView; class tabWidget; class trackLabelButton; @@ -68,7 +67,7 @@ public: // used by instrument void processAudioBuffer( sampleFrame * _buf, const fpp_t _frames, - notePlayHandle * _n ); + NotePlayHandle * _n ); MidiEvent applyMasterKey( const MidiEvent& event ); @@ -82,12 +81,12 @@ public: return m_sustainPedalPressed; } - f_cnt_t beatLen( notePlayHandle * _n ) const; + f_cnt_t beatLen( NotePlayHandle * _n ) const; // for capturing note-play-events -> need that for arpeggio, // filter and so on - void playNote( notePlayHandle * _n, sampleFrame * _working_buffer ); + void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); QString instrumentName() const; const Instrument *instrument() const @@ -100,7 +99,7 @@ public: return m_instrument; } - void deleteNotePluginData( notePlayHandle * _n ); + void deleteNotePluginData( NotePlayHandle * _n ); // name-stuff virtual void setName( const QString & _new_name ); @@ -226,7 +225,7 @@ private: AudioPort m_audioPort; MidiPort m_midiPort; - notePlayHandle * m_notes[NumKeys]; + NotePlayHandle* m_notes[NumKeys]; int m_runningMidiNotes[NumKeys]; bool m_sustainPedalPressed; @@ -251,7 +250,7 @@ private: friend class InstrumentTrackView; friend class InstrumentTrackWindow; - friend class notePlayHandle; + friend class NotePlayHandle; friend class FlpImport; } ; diff --git a/include/Mixer.h b/include/Mixer.h index e3c1781e9..f35c24bed 100644 --- a/include/Mixer.h +++ b/include/Mixer.h @@ -69,7 +69,7 @@ const Keys BaseKey = Key_A; const Octaves BaseOctave = DefaultOctave; -#include "play_handle.h" +#include "PlayHandle.h" class MixerWorkerThread; @@ -218,22 +218,24 @@ public: // play-handle stuff - inline bool addPlayHandle( playHandle * _ph ) + bool addPlayHandle( PlayHandle* handle ) { if( criticalXRuns() == false ) { lock(); - m_playHandles.push_back( _ph ); + m_playHandles.push_back( handle ); unlock(); return true; } - delete _ph; + + delete handle; + return false; } - void removePlayHandle( playHandle * _ph ); + void removePlayHandle( PlayHandle* handle ); - inline PlayHandleList & playHandles() + inline PlayHandleList& playHandles() { return m_playHandles; } diff --git a/include/note_play_handle.h b/include/NotePlayHandle.h similarity index 50% rename from include/note_play_handle.h rename to include/NotePlayHandle.h index 9c22eea3b..fd6c8bf14 100644 --- a/include/note_play_handle.h +++ b/include/NotePlayHandle.h @@ -1,9 +1,9 @@ /* - * note_play_handle.h - declaration of class notePlayHandle which is needed - * by LMMS-Play-Engine + * NotePlayHandle.h - declaration of class NotePlayHandle which manages + * playback of a single note by an instrument * * Copyright (c) 2004-2014 Tobias Doerffel - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -23,26 +23,24 @@ * */ - -#ifndef _NOTE_PLAY_HANDLE_H -#define _NOTE_PLAY_HANDLE_H +#ifndef NOTE_PLAY_HANDLE_H +#define NOTE_PLAY_HANDLE_H #include "lmmsconfig.h" -#include "Mixer.h" #include "note.h" -#include "engine.h" +#include "PlayHandle.h" #include "track.h" class InstrumentTrack; -class notePlayHandle; +class NotePlayHandle; template class basicFilters; -typedef QList NotePlayHandleList; -typedef QList ConstNotePlayHandleList; +typedef QList NotePlayHandleList; +typedef QList ConstNotePlayHandleList; -class EXPORT notePlayHandle : public playHandle, public note +class EXPORT NotePlayHandle : public PlayHandle, public note { public: void * m_pluginData; @@ -57,14 +55,15 @@ public: }; 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, + NotePlayHandle( InstrumentTrack* instrumentTrack, + const f_cnt_t offset, + const f_cnt_t frames, + const note& noteToPlay, + NotePlayHandle* parent = NULL, + const bool isPartOfArp = false, int midiEventChannel = -1, Origin origin = OriginPattern ); - virtual ~notePlayHandle(); + virtual ~NotePlayHandle(); virtual void setVolume( const volume_t volume = DefaultVolume ); virtual void setPanning( const panning_t panning = DefaultPanning ); @@ -76,144 +75,159 @@ public: return m_midiChannel; } - const float & frequency() const + const float& frequency() const { return m_frequency; } void updateFrequency(); - // returns frequency without pitch-wheel influence + /*! Returns frequency without pitch wheel influence */ float unpitchedFrequency() const { return m_unpitchedFrequency; } - virtual void play( sampleFrame * _working_buffer ); + /*! Renders one chunk using the attached instrument into the buffer */ + virtual void play( sampleFrame* buffer ); - virtual inline bool done() const + /*! Returns whether playback of note is finished and thus handle can be deleted */ + virtual bool isFinished() const { return m_released && framesLeft() <= 0; } + /*! Returns number of frames left for playback */ f_cnt_t framesLeft() const; - inline fpp_t framesLeftForCurrentPeriod() const - { - return (fpp_t) qMin( framesLeft(), - engine::mixer()->framesPerPeriod() ); - } + /*! Returns how many frames have to be rendered in current period */ + fpp_t framesLeftForCurrentPeriod() const; + /*! Returns whether the play handle plays on a certain track */ + virtual bool isFromTrack( const track* _track ) const; - virtual bool isFromTrack( const track * _track ) const; + /*! Releases the note (and plays release frames */ + void noteOff( const f_cnt_t offset = 0 ); - - void noteOff( const f_cnt_t _s = 0 ); - - inline f_cnt_t framesBeforeRelease() const + /*! Returns number of frames to be played until the note is going to be released */ + f_cnt_t framesBeforeRelease() const { return m_framesBeforeRelease; } - inline f_cnt_t releaseFramesDone() const + /*! Returns how many frames were played since release */ + f_cnt_t releaseFramesDone() const { return m_releaseFramesDone; } + /*! Returns the number of frames to be played after release according to + the release times in the envelopes */ f_cnt_t actualReleaseFramesToDo() const; - - // returns total numbers of frames to play - inline f_cnt_t frames() const + /*! Returns total numbers of frames to play (including release frames) */ + f_cnt_t frames() const { return m_frames; } + /*! Sets the total number of frames to play (including release frames) */ void setFrames( const f_cnt_t _frames ); - // returns whether note was released - inline bool released() const + /*! Returns whether note was released */ + bool isReleased() const { return m_released; } - // returns total numbers of played frames - inline f_cnt_t totalFramesPlayed() const + /*! Returns total numbers of frames played so far */ + f_cnt_t totalFramesPlayed() const { return m_totalFramesPlayed; } - // returns volume-level at frame _frame (envelope/LFO) - float volumeLevel( const f_cnt_t _frame ); + /*! Returns volume level at given frame (envelope/LFO) */ + float volumeLevel( const f_cnt_t frame ); - // returns instrument-track this note-play-handle plays - const InstrumentTrack *instrumentTrack() const + /*! Returns instrument track which is being played by this handle (const version) */ + const InstrumentTrack* instrumentTrack() const { return m_instrumentTrack; } - InstrumentTrack *instrumentTrack() + /*! Returns instrument track which is being played by this handle */ + InstrumentTrack* instrumentTrack() { return m_instrumentTrack; } - // returns whether note is a top note, e.g. is not part of an arpeggio - // or a chord - inline bool isTopNote() const + /*! Returns whether note is a top note, e.g. is not part of an arpeggio or a chord */ + bool isTopNote() const { return m_topNote; } - inline bool isPartOfArpeggio() const + /*! Returns whether note is part of an arpeggio playback */ + bool isPartOfArpeggio() const { return m_partOfArpeggio; } - inline void setPartOfArpeggio( const bool _on ) + /*! Sets whether note is part of an arpeggio playback */ + void setPartOfArpeggio( const bool _on ) { m_partOfArpeggio = _on; } - // returns whether note is base-note for arpeggio + /*! Returns whether note is base note for arpeggio */ bool isArpeggioBaseNote() const; - inline bool isMuted() const + /*! Returns whether note is muted */ + bool isMuted() const { return m_muted; } + /*! Mutes playback of note */ void mute(); - // returns index of note-play-handle in vector of note-play-handles - // belonging to this instrument-track - used by arpeggiator + /*! Returns index of NotePlayHandle in vector of note-play-handles + belonging to this instrument track - used by arpeggiator */ int index() const; - // note-play-handles belonging to given channel, if _all_ph = true, - // also released note-play-handles are returned - static ConstNotePlayHandleList nphsOfInstrumentTrack( - const InstrumentTrack * _ct, bool _all_ph = false ); + /*! returns list of note-play-handles belonging to given instrument track, + if allPlayHandles = true, also released note-play-handles are returned */ + static ConstNotePlayHandleList nphsOfInstrumentTrack( const InstrumentTrack* track, bool allPlayHandles = false ); - // return whether given note-play-handle is equal to *this - bool operator==( const notePlayHandle & _nph ) const; + /*! Returns whether given NotePlayHandle instance is equal to *this */ + bool operator==( const NotePlayHandle & _nph ) const; - inline bool bbTrackMuted() + /*! Returns whether NotePlayHandle belongs to BB track and BB track is muted */ + bool isBbTrackMuted() { return m_bbTrack && m_bbTrack->isMuted(); } - void setBBTrack( track * _bb_track ) + + /*! Sets attached BB track */ + void setBBTrack( track* t ) { - m_bbTrack = _bb_track; + m_bbTrack = t; } - void processMidiTime( const MidiTime & _time ); - void resize( const bpm_t _new_tempo ); + /*! Process note detuning automation */ + void processMidiTime( const MidiTime& time ); - void setSongGlobalParentOffset( const MidiTime &offset ) + /*! Updates total length (m_frames) depending on a new tempo */ + void resize( const bpm_t newTempo ); + + /*! Set song-global offset (relative to containing pattern) in order to properly perform the note detuning */ + void setSongGlobalParentOffset( const MidiTime& offset ) { m_songGlobalParentOffset = offset; } - const MidiTime &songGlobalParentOffset() const + /*! Returns song-global offset */ + const MidiTime& songGlobalParentOffset() const { return m_songGlobalParentOffset; } @@ -235,7 +249,7 @@ private: class BaseDetuning { public: - BaseDetuning( DetuningHelper *detuning ); + BaseDetuning( DetuningHelper* detuning ); void setValue( float val ) { @@ -253,7 +267,7 @@ private: } ; - InstrumentTrack * m_instrumentTrack; // needed for calling + InstrumentTrack* m_instrumentTrack; // needed for calling // InstrumentTrack::playNote f_cnt_t m_frames; // total frames to play f_cnt_t m_totalFramesPlayed; // total frame-counter - used for @@ -273,7 +287,7 @@ private: // an arpeggio (either base-note or // sub-note) bool m_muted; // indicates whether note is muted - track * m_bbTrack; // related BB track + track* m_bbTrack; // related BB track #ifdef LMMS_SINGERBOT_SUPPORT int m_patternIndex; // position among relevant notes #endif @@ -287,7 +301,7 @@ private: float m_frequency; float m_unpitchedFrequency; - BaseDetuning * m_baseDetuning; + BaseDetuning* m_baseDetuning; MidiTime m_songGlobalParentOffset; const int m_midiChannel; diff --git a/include/play_handle.h b/include/PlayHandle.h similarity index 61% rename from include/play_handle.h rename to include/PlayHandle.h index 27aa27573..f4d32571a 100644 --- a/include/play_handle.h +++ b/include/PlayHandle.h @@ -1,7 +1,7 @@ /* - * play_handle.h - base-class playHandle - core of rendering engine + * PlayHandle.h - base class PlayHandle - core of rendering engine * - * Copyright (c) 2004-2009 Tobias Doerffel + * Copyright (c) 2004-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -22,8 +22,8 @@ * */ -#ifndef _PLAY_HANDLE_H -#define _PLAY_HANDLE_H +#ifndef PLAY_HANDLE_H +#define PLAY_HANDLE_H #include #include @@ -33,54 +33,56 @@ class track; -class playHandle +class PlayHandle { public: - enum types + enum Types { - NotePlayHandle, - InstrumentPlayHandle, - SamplePlayHandle, - PresetPreviewHandle + TypeNotePlayHandle, + TypeInstrumentPlayHandle, + TypeSamplePlayHandle, + TypePresetPreviewHandle, + TypeCount } ; + typedef Types Type; - playHandle( const types _type, f_cnt_t _offset = 0 ) : - m_type( _type ), - m_offset( _offset ), + PlayHandle( const Type type, f_cnt_t offset = 0 ) : + m_type( type ), + m_offset( offset ), m_affinity( QThread::currentThread() ) { } - virtual inline ~playHandle() + virtual ~PlayHandle() { } - virtual inline bool affinityMatters( void ) const + virtual bool affinityMatters() const { return false; } - const QThread * affinity( void ) const + const QThread* affinity() const { return m_affinity; } - inline types type( void ) const + Type type() const { return m_type; } - virtual void play( sampleFrame * _working_buffer ) = 0; - virtual bool done( void ) const = 0; + virtual void play( sampleFrame* buffer ) = 0; + virtual bool isFinished( void ) const = 0; // returns how many frames this play-handle is aligned ahead, i.e. // at which position it is inserted in the according buffer - inline f_cnt_t offset( void ) const + f_cnt_t offset() const { return m_offset; } - inline void setOffset( f_cnt_t _offset ) + void setOffset( f_cnt_t _offset ) { m_offset = _offset; } @@ -90,15 +92,15 @@ public: private: - types m_type; + Type m_type; f_cnt_t m_offset; - const QThread * m_affinity; + const QThread* m_affinity; } ; -typedef QList PlayHandleList; -typedef QList ConstPlayHandleList; +typedef QList PlayHandleList; +typedef QList ConstPlayHandleList; #endif diff --git a/include/preset_preview_play_handle.h b/include/PresetPreviewPlayHandle.h similarity index 61% rename from include/preset_preview_play_handle.h rename to include/PresetPreviewPlayHandle.h index abef2c78b..19b3e468c 100644 --- a/include/preset_preview_play_handle.h +++ b/include/PresetPreviewPlayHandle.h @@ -1,9 +1,9 @@ /* - * preset_preview_play_handle.h - play-handle for playing a short preview-sound - * of a preset or a file processed by a plugin + * PresetPreviewPlayHandle.h - a PlayHandle specialization for playback of a short + * preview of a preset or a file processed by a plugin * * Copyright (c) 2005-2014 Tobias Doerffel - * + * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * * This program is free software; you can redistribute it and/or @@ -23,41 +23,37 @@ * */ - #ifndef _PRESET_PREVIEW_PLAY_HANDLE_H #define _PRESET_PREVIEW_PLAY_HANDLE_H -#include "note_play_handle.h" +#include "NotePlayHandle.h" class InstrumentTrack; -class previewTrackContainer; +class PreviewTrackContainer; - -class EXPORT presetPreviewPlayHandle : public playHandle +class EXPORT PresetPreviewPlayHandle : public PlayHandle { public: - presetPreviewPlayHandle( const QString & _preset_file, - bool _load_by_plugin = false ); - virtual ~presetPreviewPlayHandle(); + PresetPreviewPlayHandle( const QString& presetFile, bool loadByPlugin = false ); + virtual ~PresetPreviewPlayHandle(); - virtual void play( sampleFrame * _working_buffer ); - virtual bool done( void ) const; + virtual void play( sampleFrame* buffer ); + virtual bool isFinished() const; virtual bool isFromTrack( const track * _track ) const; - static void init( void ); - static void cleanup( void ); - static ConstNotePlayHandleList nphsOfInstrumentTrack( - const InstrumentTrack * _ct ); + static void init(); + static void cleanup(); + static ConstNotePlayHandleList nphsOfInstrumentTrack( const InstrumentTrack* instrumentTrack ); static bool isPreviewing(); private: - static previewTrackContainer * s_previewTC; + static PreviewTrackContainer* s_previewTC; - notePlayHandle * m_previewNote; + NotePlayHandle* m_previewNote; } ; diff --git a/include/SamplePlayHandle.h b/include/SamplePlayHandle.h index a9ffd4112..86eb97cca 100644 --- a/include/SamplePlayHandle.h +++ b/include/SamplePlayHandle.h @@ -36,7 +36,7 @@ class track; class AudioPort; -class SamplePlayHandle : public playHandle +class SamplePlayHandle : public PlayHandle { public: SamplePlayHandle( const QString& sampleFile ); @@ -52,7 +52,7 @@ public: virtual void play( sampleFrame * _working_buffer ); - virtual bool done() const; + virtual bool isFinished() const; virtual bool isFromTrack( const track * _track ) const; diff --git a/include/SampleRecordHandle.h b/include/SampleRecordHandle.h index 6ff8a3d63..9e50699ca 100644 --- a/include/SampleRecordHandle.h +++ b/include/SampleRecordHandle.h @@ -28,7 +28,6 @@ #include #include -#include #include "Mixer.h" #include "SampleBuffer.h" @@ -39,14 +38,14 @@ class SampleTCO; class track; -class SampleRecordHandle : public playHandle +class SampleRecordHandle : public PlayHandle { public: SampleRecordHandle( SampleTCO* tco ); virtual ~SampleRecordHandle(); virtual void play( sampleFrame * _working_buffer ); - virtual bool done() const; + virtual bool isFinished() const; virtual bool isFromTrack( const track * _track ) const; diff --git a/include/file_browser.h b/include/file_browser.h index 6420ca3fe..d3aa501bf 100644 --- a/include/file_browser.h +++ b/include/file_browser.h @@ -39,7 +39,7 @@ class QLineEdit; class fileItem; class InstrumentTrack; class fileBrowserTreeWidget; -class playHandle; +class PlayHandle; class TrackContainer; @@ -102,7 +102,7 @@ private: bool m_mousePressed; QPoint m_pressPos; - playHandle * m_previewPlayHandle; + PlayHandle* m_previewPlayHandle; QMutex m_pphMutex; fileItem * m_contextMenuItem; diff --git a/include/piano_roll.h b/include/piano_roll.h index 596a29f1a..162a6723c 100644 --- a/include/piano_roll.h +++ b/include/piano_roll.h @@ -45,7 +45,7 @@ class QMenu; class QSignalMapper; class comboBox; -class notePlayHandle; +class NotePlayHandle; class pattern; class timeLine; class toolButton; diff --git a/plugins/audio_file_processor/audio_file_processor.cpp b/plugins/audio_file_processor/audio_file_processor.cpp index 2ef2f8a96..c0a707f9e 100644 --- a/plugins/audio_file_processor/audio_file_processor.cpp +++ b/plugins/audio_file_processor/audio_file_processor.cpp @@ -34,7 +34,7 @@ #include "engine.h" #include "song.h" #include "InstrumentTrack.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "interpolation.h" #include "gui_templates.h" #include "tooltip.h" @@ -101,7 +101,7 @@ audioFileProcessor::~audioFileProcessor() -void audioFileProcessor::playNote( notePlayHandle * _n, +void audioFileProcessor::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { const fpp_t frames = _n->framesLeftForCurrentPeriod(); @@ -159,7 +159,7 @@ void audioFileProcessor::playNote( notePlayHandle * _n, -void audioFileProcessor::deleteNotePluginData( notePlayHandle * _n ) +void audioFileProcessor::deleteNotePluginData( NotePlayHandle * _n ) { delete (handleState *)_n->m_pluginData; } @@ -225,7 +225,7 @@ QString audioFileProcessor::nodeName( void ) const -int audioFileProcessor::getBeatLen( notePlayHandle * _n ) const +int audioFileProcessor::getBeatLen( NotePlayHandle * _n ) const { const float freq_factor = BaseFreq / _n->frequency() * engine::mixer()->processingSampleRate() / engine::mixer()->baseSampleRate(); diff --git a/plugins/audio_file_processor/audio_file_processor.h b/plugins/audio_file_processor/audio_file_processor.h index e9d6a44e6..1bc81e73f 100644 --- a/plugins/audio_file_processor/audio_file_processor.h +++ b/plugins/audio_file_processor/audio_file_processor.h @@ -44,9 +44,9 @@ public: audioFileProcessor( InstrumentTrack * _instrument_track ); virtual ~audioFileProcessor(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); @@ -56,7 +56,7 @@ public: virtual QString nodeName() const; - virtual int getBeatLen( notePlayHandle * _n ) const; + virtual int getBeatLen( NotePlayHandle * _n ) const; virtual f_cnt_t desiredReleaseFrames() const { diff --git a/plugins/bit_invader/bit_invader.cpp b/plugins/bit_invader/bit_invader.cpp index 080c424f3..cb9524d92 100644 --- a/plugins/bit_invader/bit_invader.cpp +++ b/plugins/bit_invader/bit_invader.cpp @@ -31,7 +31,7 @@ #include "InstrumentTrack.h" #include "knob.h" #include "led_checkbox.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "Oscillator.h" #include "pixmap_button.h" #include "song_editor.h" @@ -61,7 +61,7 @@ Plugin::Descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor = } -bSynth::bSynth( float * _shape, int _length, notePlayHandle * _nph, bool _interpolation, +bSynth::bSynth( float * _shape, int _length, NotePlayHandle * _nph, bool _interpolation, float _factor, const sample_rate_t _sample_rate ) : sample_index( 0 ), sample_realindex( 0 ), @@ -257,7 +257,7 @@ QString bitInvader::nodeName() const -void bitInvader::playNote( notePlayHandle * _n, +void bitInvader::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) @@ -301,7 +301,7 @@ void bitInvader::playNote( notePlayHandle * _n, -void bitInvader::deleteNotePluginData( notePlayHandle * _n ) +void bitInvader::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/bit_invader/bit_invader.h b/plugins/bit_invader/bit_invader.h index 7a3217b47..39fc747ee 100644 --- a/plugins/bit_invader/bit_invader.h +++ b/plugins/bit_invader/bit_invader.h @@ -40,7 +40,7 @@ class bitInvaderView; class bSynth { public: - bSynth( float * sample, int length, notePlayHandle * _nph, + bSynth( float * sample, int length, NotePlayHandle * _nph, bool _interpolation, float factor, const sample_rate_t _sample_rate ); virtual ~bSynth(); @@ -52,7 +52,7 @@ private: int sample_index; float sample_realindex; float* sample_shape; - notePlayHandle* nph; + NotePlayHandle* nph; const int sample_length; const sample_rate_t sample_rate; @@ -67,9 +67,9 @@ public: bitInvader(InstrumentTrack * _instrument_track ); virtual ~bitInvader(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, diff --git a/plugins/flp_import/FlpImport.cpp b/plugins/flp_import/FlpImport.cpp index c238fee10..5d9c7a83a 100644 --- a/plugins/flp_import/FlpImport.cpp +++ b/plugins/flp_import/FlpImport.cpp @@ -29,7 +29,7 @@ #include #include "FlpImport.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "AutomationPattern.h" #include "basic_filters.h" #include "bb_track.h" diff --git a/plugins/kicker/kicker.cpp b/plugins/kicker/kicker.cpp index 14f90cd12..ae52d8c81 100644 --- a/plugins/kicker/kicker.cpp +++ b/plugins/kicker/kicker.cpp @@ -30,7 +30,7 @@ #include "engine.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "SweepOscillator.h" #include "embed.cpp" @@ -113,7 +113,7 @@ typedef effectLib::distortion DistFX; typedef SweepOscillator > SweepOsc; -void kickerInstrument::playNote( notePlayHandle * _n, +void kickerInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { const float decfr = m_decayModel.value() * @@ -126,14 +126,14 @@ void kickerInstrument::playNote( notePlayHandle * _n, DistFX( m_distModel.value(), m_gainModel.value() ) ); } - else if( tfp > decfr && !_n->released() ) + else if( tfp > decfr && !_n->isReleased() ) { _n->noteOff(); } //const float freq = instrumentTrack()->frequency( _n ) / 2; const float fdiff = m_endFreqModel.value() - m_startFreqModel.value(); -/* const fpp_t frames = _n->released() ? +/* const fpp_t frames = _n->isReleased() ? tMax( tMin( desiredReleaseFrames() - _n->releaseFramesDone(), engine::mixer()->framesPerAudioBuffer() ), 0 ) @@ -148,7 +148,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, so->update( _working_buffer, frames, f1, f2, engine::mixer()->processingSampleRate() ); - if( _n->released() ) + if( _n->isReleased() ) { const float rfd = _n->releaseFramesDone(); const float drf = desiredReleaseFrames(); @@ -166,7 +166,7 @@ void kickerInstrument::playNote( notePlayHandle * _n, -void kickerInstrument::deleteNotePluginData( notePlayHandle * _n ) +void kickerInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/kicker/kicker.h b/plugins/kicker/kicker.h index 1543fac5f..f6633b07e 100644 --- a/plugins/kicker/kicker.h +++ b/plugins/kicker/kicker.h @@ -33,7 +33,7 @@ class kickerInstrumentView; -class notePlayHandle; +class NotePlayHandle; class kickerInstrument : public Instrument @@ -42,9 +42,9 @@ public: kickerInstrument( InstrumentTrack * _instrument_track ); virtual ~kickerInstrument(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/lb302/lb302.cpp b/plugins/lb302/lb302.cpp index 9856c0cfa..d2dccb93e 100644 --- a/plugins/lb302/lb302.cpp +++ b/plugins/lb302/lb302.cpp @@ -34,7 +34,7 @@ #include "InstrumentPlayHandle.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "Oscillator.h" #include "pixmap_button.h" #include "templates.h" @@ -709,7 +709,7 @@ void lb302Synth::initNote( lb302Note *n) } -void lb302Synth::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) +void lb302Synth::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { //fpp_t framesPerPeriod = engine::mixer()->framesPerPeriod(); @@ -780,7 +780,7 @@ void lb302Synth::play( sampleFrame * _working_buffer ) -void lb302Synth::deleteNotePluginData( notePlayHandle * _n ) +void lb302Synth::deleteNotePluginData( NotePlayHandle * _n ) { //printf("GONE\n"); if( _n->unpitchedFrequency() == current_freq ) diff --git a/plugins/lb302/lb302.h b/plugins/lb302/lb302.h index a7721bb37..7c6475562 100644 --- a/plugins/lb302/lb302.h +++ b/plugins/lb302/lb302.h @@ -40,7 +40,7 @@ #include "Mixer.h" class lb302SynthView; -class notePlayHandle; +class NotePlayHandle; class lb302FilterKnobState { @@ -139,9 +139,9 @@ public: virtual ~lb302Synth(); virtual void play( sampleFrame * _working_buffer ); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/lb303/lb303.cpp b/plugins/lb303/lb303.cpp index fa4c91a37..6e0099249 100644 --- a/plugins/lb303/lb303.cpp +++ b/plugins/lb303/lb303.cpp @@ -36,7 +36,7 @@ #include "InstrumentPlayHandle.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "templates.h" #include "audio_port.h" @@ -665,7 +665,7 @@ void lb303Synth::initNote( lb303Note *n) } -void lb303Synth::playNote( notePlayHandle * _n, +void lb303Synth::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if( _n->arpBaseNote() ) @@ -719,7 +719,7 @@ void lb303Synth::play( sampleFrame * _working_buffer ) -void lb303Synth::deleteNotePluginData( notePlayHandle * _n ) +void lb303Synth::deleteNotePluginData( NotePlayHandle * _n ) { //printf("GONE\n"); if( _n->unpitchedFrequency() == current_freq ) diff --git a/plugins/lb303/lb303.h b/plugins/lb303/lb303.h index 87b6f256c..903775c79 100644 --- a/plugins/lb303/lb303.h +++ b/plugins/lb303/lb303.h @@ -40,7 +40,7 @@ #include "Mixer.h" class lb303SynthView; -class notePlayHandle; +class NotePlayHandle; class lb303FilterKnobState { @@ -140,9 +140,9 @@ public: virtual ~lb303Synth(); virtual void play( sampleFrame * _working_buffer ); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/organic/organic.cpp b/plugins/organic/organic.cpp index e2b0241b8..51a13d381 100644 --- a/plugins/organic/organic.cpp +++ b/plugins/organic/organic.cpp @@ -33,7 +33,7 @@ #include "engine.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "Oscillator.h" #include "pixmap_button.h" #include "templates.h" @@ -182,7 +182,7 @@ QString organicInstrument::nodeName() const -void organicInstrument::playNote( notePlayHandle * _n, +void organicInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) @@ -281,7 +281,7 @@ void organicInstrument::playNote( notePlayHandle * _n, -void organicInstrument::deleteNotePluginData( notePlayHandle * _n ) +void organicInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( static_cast( _n->m_pluginData )->oscLeft ); diff --git a/plugins/organic/organic.h b/plugins/organic/organic.h index 14f4c37e6..926dce1f1 100644 --- a/plugins/organic/organic.h +++ b/plugins/organic/organic.h @@ -34,7 +34,7 @@ class QPixmap; class knob; -class notePlayHandle; +class NotePlayHandle; class pixmapButton; @@ -81,9 +81,9 @@ public: organicInstrument( InstrumentTrack * _instrument_track ); virtual ~organicInstrument(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/papu/papu_instrument.cpp b/plugins/papu/papu_instrument.cpp index 2cd42cbd2..510042a4c 100644 --- a/plugins/papu/papu_instrument.cpp +++ b/plugins/papu/papu_instrument.cpp @@ -31,9 +31,10 @@ #include "papu_instrument.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pixmap_button.h" #include "tooltip.h" +#include "engine.h" #include "graph.h" #include "embed.cpp" @@ -231,7 +232,7 @@ f_cnt_t papuInstrument::desiredReleaseFrames() const -void papuInstrument::playNote( notePlayHandle * _n, +void papuInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { const f_cnt_t tfp = _n->totalFramesPlayed(); @@ -409,7 +410,7 @@ void papuInstrument::playNote( notePlayHandle * _n, -void papuInstrument::deleteNotePluginData( notePlayHandle * _n ) +void papuInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/papu/papu_instrument.h b/plugins/papu/papu_instrument.h index a4700aad0..f462306a7 100644 --- a/plugins/papu/papu_instrument.h +++ b/plugins/papu/papu_instrument.h @@ -33,7 +33,7 @@ #include "graph.h" class papuInstrumentView; -class notePlayHandle; +class NotePlayHandle; class pixmapButton; class papuInstrument : public Instrument @@ -44,9 +44,9 @@ public: papuInstrument( InstrumentTrack * _instrument_track ); virtual ~papuInstrument(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/patman/patman.cpp b/plugins/patman/patman.cpp index b2cdc9d1b..f5f24335f 100644 --- a/plugins/patman/patman.cpp +++ b/plugins/patman/patman.cpp @@ -33,7 +33,7 @@ #include "engine.h" #include "gui_templates.h" #include "InstrumentTrack.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pixmap_button.h" #include "song.h" #include "string_pair_drag.h" @@ -129,7 +129,7 @@ QString patmanInstrument::nodeName( void ) const -void patmanInstrument::playNote( notePlayHandle * _n, +void patmanInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if( m_patchFile == "" ) @@ -160,7 +160,7 @@ void patmanInstrument::playNote( notePlayHandle * _n, -void patmanInstrument::deleteNotePluginData( notePlayHandle * _n ) +void patmanInstrument::deleteNotePluginData( NotePlayHandle * _n ) { handle_data * hdata = (handle_data *)_n->m_pluginData; sharedObject::unref( hdata->sample ); @@ -384,7 +384,7 @@ void patmanInstrument::unloadCurrentPatch( void ) -void patmanInstrument::selectSample( notePlayHandle * _n ) +void patmanInstrument::selectSample( NotePlayHandle * _n ) { const float freq = _n->frequency(); diff --git a/plugins/patman/patman.h b/plugins/patman/patman.h index 046ac41dd..e9740402a 100644 --- a/plugins/patman/patman.h +++ b/plugins/patman/patman.h @@ -52,9 +52,9 @@ public: patmanInstrument( InstrumentTrack * _track ); virtual ~patmanInstrument(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); @@ -103,7 +103,7 @@ private: LoadErrors loadPatch( const QString & _filename ); void unloadCurrentPatch( void ); - void selectSample( notePlayHandle * _n ); + void selectSample( NotePlayHandle * _n ); friend class PatmanView; diff --git a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp index aaeec368a..6104df138 100644 --- a/plugins/peak_controller_effect/peak_controller_effect_controls.cpp +++ b/plugins/peak_controller_effect/peak_controller_effect_controls.cpp @@ -29,7 +29,7 @@ #include "PeakController.h" #include "peak_controller_effect_controls.h" #include "peak_controller_effect.h" -#include "preset_preview_play_handle.h" +#include "PresetPreviewPlayHandle.h" #include "song.h" @@ -77,7 +77,7 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this ) m_effect->m_effectId = rand(); } - if( m_effect->m_autoController && ( engine::getSong()->isLoadingProject() == true || presetPreviewPlayHandle::isPreviewing() == false ) ) + if( m_effect->m_autoController && ( engine::getSong()->isLoadingProject() == true || PresetPreviewPlayHandle::isPreviewing() == false ) ) { delete m_effect->m_autoController; m_effect->m_autoController = 0; diff --git a/plugins/sf2_player/sf2_player.cpp b/plugins/sf2_player/sf2_player.cpp index 368a9779b..fe690ab8a 100644 --- a/plugins/sf2_player/sf2_player.cpp +++ b/plugins/sf2_player/sf2_player.cpp @@ -34,7 +34,7 @@ #include "engine.h" #include "InstrumentTrack.h" #include "InstrumentPlayHandle.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "knob.h" #include "song.h" @@ -570,7 +570,7 @@ void sf2Instrument::updateSampleRate() -void sf2Instrument::playNote( notePlayHandle * _n, sampleFrame * ) +void sf2Instrument::playNote( NotePlayHandle * _n, sampleFrame * ) { const float LOG440 = 2.643452676f; @@ -743,7 +743,7 @@ void sf2Instrument::play( sampleFrame * _working_buffer ) -void sf2Instrument::deleteNotePluginData( notePlayHandle * _n ) +void sf2Instrument::deleteNotePluginData( NotePlayHandle * _n ) { SF2PluginData * pluginData = static_cast( _n->m_pluginData ); diff --git a/plugins/sf2_player/sf2_player.h b/plugins/sf2_player/sf2_player.h index 691a2be83..0287de16c 100644 --- a/plugins/sf2_player/sf2_player.h +++ b/plugins/sf2_player/sf2_player.h @@ -40,7 +40,7 @@ class sf2InstrumentView; class sf2Font; -class notePlayHandle; +class NotePlayHandle; class patchesDialog; class QLabel; @@ -58,9 +58,9 @@ public: virtual void play( sampleFrame * _working_buffer ); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/sfxr/sfxr.cpp b/plugins/sfxr/sfxr.cpp index ea8b0d235..8217fd4ed 100644 --- a/plugins/sfxr/sfxr.cpp +++ b/plugins/sfxr/sfxr.cpp @@ -42,7 +42,7 @@ float frnd(float range) #include "engine.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pixmap_button.h" #include "song_editor.h" #include "templates.h" @@ -448,7 +448,7 @@ QString sfxrInstrument::nodeName() const -void sfxrInstrument::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) +void sfxrInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { fpp_t frameNum = _n->framesLeftForCurrentPeriod(); if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) @@ -480,7 +480,7 @@ void sfxrInstrument::playNote( notePlayHandle * _n, sampleFrame * _working_buffe -void sfxrInstrument::deleteNotePluginData( notePlayHandle * _n ) +void sfxrInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/sfxr/sfxr.h b/plugins/sfxr/sfxr.h index 1f98b1b05..aae42c051 100644 --- a/plugins/sfxr/sfxr.h +++ b/plugins/sfxr/sfxr.h @@ -169,8 +169,8 @@ public: sfxrInstrument(InstrumentTrack * _instrument_track ); virtual ~sfxrInstrument(); - virtual void playNote( notePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/sid/sid_instrument.cpp b/plugins/sid/sid_instrument.cpp index 7e317a876..be1c8914c 100644 --- a/plugins/sid/sid_instrument.cpp +++ b/plugins/sid/sid_instrument.cpp @@ -35,7 +35,7 @@ #include "engine.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pixmap_button.h" #include "tooltip.h" @@ -299,7 +299,7 @@ static int sid_fillbuffer(unsigned char* sidreg, cSID *sid, int tdelta, short *p -void sidInstrument::playNote( notePlayHandle * _n, +void sidInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { const f_cnt_t tfp = _n->totalFramesPlayed(); @@ -361,7 +361,7 @@ void sidInstrument::playNote( notePlayHandle * _n, sidreg[base+2] = data16&0x00FF; sidreg[base+3] = (data16>>8)&0x000F; // control: wave form, (test), ringmod, sync, gate - data8 = _n->released()?0:1; + data8 = _n->isReleased()?0:1; data8 += m_voice[i]->m_syncModel.value()?2:0; data8 += m_voice[i]->m_ringModModel.value()?4:0; data8 += m_voice[i]->m_testModel.value()?8:0; @@ -440,7 +440,7 @@ void sidInstrument::playNote( notePlayHandle * _n, -void sidInstrument::deleteNotePluginData( notePlayHandle * _n ) +void sidInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/sid/sid_instrument.h b/plugins/sid/sid_instrument.h index 236b9c7e3..d7c6f7563 100644 --- a/plugins/sid/sid_instrument.h +++ b/plugins/sid/sid_instrument.h @@ -34,7 +34,7 @@ class sidInstrumentView; -class notePlayHandle; +class NotePlayHandle; class automatableButtonGroup; class pixmapButton; @@ -91,9 +91,9 @@ public: sidInstrument( InstrumentTrack * _instrument_track ); virtual ~sidInstrument(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/stk/mallets/mallets.cpp b/plugins/stk/mallets/mallets.cpp index 1b2513bfd..bfc6b4a45 100644 --- a/plugins/stk/mallets/mallets.cpp +++ b/plugins/stk/mallets/mallets.cpp @@ -204,7 +204,7 @@ QString malletsInstrument::nodeName() const -void malletsInstrument::playNote( notePlayHandle * _n, +void malletsInstrument::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if( m_filesMissing ) @@ -288,7 +288,7 @@ void malletsInstrument::playNote( notePlayHandle * _n, -void malletsInstrument::deleteNotePluginData( notePlayHandle * _n ) +void malletsInstrument::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/stk/mallets/mallets.h b/plugins/stk/mallets/mallets.h index 46388681f..6c21bd8ed 100644 --- a/plugins/stk/mallets/mallets.h +++ b/plugins/stk/mallets/mallets.h @@ -33,7 +33,7 @@ #include "Instrument.h" #include "InstrumentView.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "led_checkbox.h" // As of Stk 4.4 all classes and types have been moved to the namespace "stk". @@ -137,9 +137,9 @@ public: malletsInstrument( InstrumentTrack * _instrument_track ); virtual ~malletsInstrument(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/triple_oscillator/TripleOscillator.cpp b/plugins/triple_oscillator/TripleOscillator.cpp index 20a017989..d675b7b83 100644 --- a/plugins/triple_oscillator/TripleOscillator.cpp +++ b/plugins/triple_oscillator/TripleOscillator.cpp @@ -33,7 +33,7 @@ #include "engine.h" #include "InstrumentTrack.h" #include "knob.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pixmap_button.h" #include "SampleBuffer.h" #include "song_editor.h" @@ -295,7 +295,7 @@ QString TripleOscillator::nodeName() const -void TripleOscillator::playNote( notePlayHandle * _n, +void TripleOscillator::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) @@ -371,7 +371,7 @@ void TripleOscillator::playNote( notePlayHandle * _n, -void TripleOscillator::deleteNotePluginData( notePlayHandle * _n ) +void TripleOscillator::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( static_cast( _n->m_pluginData )->oscLeft ); diff --git a/plugins/triple_oscillator/TripleOscillator.h b/plugins/triple_oscillator/TripleOscillator.h index 3fa24c9d6..bcddcf9e2 100644 --- a/plugins/triple_oscillator/TripleOscillator.h +++ b/plugins/triple_oscillator/TripleOscillator.h @@ -34,7 +34,7 @@ class automatableButtonGroup; class knob; -class notePlayHandle; +class NotePlayHandle; class pixmapButton; class SampleBuffer; @@ -96,9 +96,9 @@ public: TripleOscillator( InstrumentTrack * _track ); virtual ~TripleOscillator(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/vibed/vibed.cpp b/plugins/vibed/vibed.cpp index 7872db7ca..a4d0b4d36 100644 --- a/plugins/vibed/vibed.cpp +++ b/plugins/vibed/vibed.cpp @@ -29,7 +29,7 @@ #include "vibed.h" #include "engine.h" #include "InstrumentTrack.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "tooltip.h" #include "base64.h" #include "caption_menu.h" @@ -272,7 +272,7 @@ QString vibed::nodeName() const -void vibed::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) +void vibed::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL ) { @@ -330,7 +330,7 @@ void vibed::playNote( notePlayHandle * _n, sampleFrame * _working_buffer ) -void vibed::deleteNotePluginData( notePlayHandle * _n ) +void vibed::deleteNotePluginData( NotePlayHandle * _n ) { delete static_cast( _n->m_pluginData ); } diff --git a/plugins/vibed/vibed.h b/plugins/vibed/vibed.h index 4846b4ae0..b8002ac9c 100644 --- a/plugins/vibed/vibed.h +++ b/plugins/vibed/vibed.h @@ -33,7 +33,7 @@ #include "nine_button_selector.h" class vibedView; -class notePlayHandle; +class NotePlayHandle; class vibed : public Instrument { @@ -42,9 +42,9 @@ public: vibed( InstrumentTrack * _instrument_track ); virtual ~vibed(); - virtual void playNote( notePlayHandle * _n, + virtual void playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ); - virtual void deleteNotePluginData( notePlayHandle * _n ); + virtual void deleteNotePluginData( NotePlayHandle * _n ); virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent ); diff --git a/plugins/zynaddsubfx/ZynAddSubFx.h b/plugins/zynaddsubfx/ZynAddSubFx.h index 8ea46a124..ed65d24f5 100644 --- a/plugins/zynaddsubfx/ZynAddSubFx.h +++ b/plugins/zynaddsubfx/ZynAddSubFx.h @@ -39,7 +39,7 @@ class QPushButton; class LocalZynAddSubFx; class ZynAddSubFxView; -class notePlayHandle; +class NotePlayHandle; class knob; class ledCheckBox; diff --git a/src/core/Instrument.cpp b/src/core/Instrument.cpp index 339043ef9..ef4a1a8a9 100644 --- a/src/core/Instrument.cpp +++ b/src/core/Instrument.cpp @@ -25,8 +25,9 @@ #include "Instrument.h" #include "InstrumentTrack.h" #include "DummyInstrument.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "embed.h" +#include "engine.h" Instrument::Instrument( InstrumentTrack * _instrument_track, @@ -53,14 +54,14 @@ void Instrument::play( sampleFrame * ) -void Instrument::deleteNotePluginData( notePlayHandle * ) +void Instrument::deleteNotePluginData( NotePlayHandle * ) { } -f_cnt_t Instrument::beatLen( notePlayHandle * ) const +f_cnt_t Instrument::beatLen( NotePlayHandle * ) const { return( 0 ); } @@ -96,7 +97,7 @@ bool Instrument::isFromTrack( const track * _track ) const -void Instrument::applyRelease( sampleFrame * buf, const notePlayHandle * _n ) +void Instrument::applyRelease( sampleFrame * buf, const NotePlayHandle * _n ) { const fpp_t frames = _n->framesLeftForCurrentPeriod(); const fpp_t fpp = engine::mixer()->framesPerPeriod(); diff --git a/src/core/InstrumentFunctions.cpp b/src/core/InstrumentFunctions.cpp index 985fd3152..9be1ba39a 100644 --- a/src/core/InstrumentFunctions.cpp +++ b/src/core/InstrumentFunctions.cpp @@ -28,8 +28,8 @@ #include "embed.h" #include "engine.h" #include "InstrumentTrack.h" -#include "note_play_handle.h" -#include "preset_preview_play_handle.h" +#include "NotePlayHandle.h" +#include "PresetPreviewPlayHandle.h" @@ -220,7 +220,7 @@ InstrumentFunctionNoteStacking::~InstrumentFunctionNoteStacking() -void InstrumentFunctionNoteStacking::processNote( notePlayHandle * _n ) +void InstrumentFunctionNoteStacking::processNote( NotePlayHandle * _n ) { const int base_note_key = _n->key(); const ChordTable & chord_table = ChordTable::getInstance(); @@ -266,7 +266,7 @@ void InstrumentFunctionNoteStacking::processNote( notePlayHandle * _n ) _n->detuning() ); // create sub-note-play-handle, only note is // different - new notePlayHandle( _n->instrumentTrack(), + new NotePlayHandle( _n->instrumentTrack(), _n->offset(), _n->frames(), note_copy, _n ); @@ -344,13 +344,12 @@ InstrumentFunctionArpeggio::~InstrumentFunctionArpeggio() -void InstrumentFunctionArpeggio::processNote( notePlayHandle * _n ) +void InstrumentFunctionArpeggio::processNote( NotePlayHandle * _n ) { const int base_note_key = _n->key(); if( _n->isTopNote() == false || !m_arpEnabledModel.value() || - ( _n->released() && _n->releaseFramesDone() >= - _n->actualReleaseFramesToDo() ) ) + ( _n->isReleased() && _n->releaseFramesDone() >= _n->actualReleaseFramesToDo() ) ) { return; } @@ -358,13 +357,12 @@ void InstrumentFunctionArpeggio::processNote( notePlayHandle * _n ) const int selected_arp = m_arpModel.value(); - ConstNotePlayHandleList cnphv = notePlayHandle::nphsOfInstrumentTrack( + ConstNotePlayHandleList cnphv = NotePlayHandle::nphsOfInstrumentTrack( _n->instrumentTrack() ); if( m_arpModeModel.value() != FreeMode && cnphv.size() == 0 ) { // maybe we're playing only a preset-preview-note? - cnphv = presetPreviewPlayHandle::nphsOfInstrumentTrack( - _n->instrumentTrack() ); + cnphv = PresetPreviewPlayHandle::nphsOfInstrumentTrack( _n->instrumentTrack() ); if( cnphv.size() == 0 ) { // still nothing found here, so lets return @@ -471,7 +469,7 @@ void InstrumentFunctionArpeggio::processNote( notePlayHandle * _n ) } float vol_level = 1.0f; - if( _n->released() ) + if( _n->isReleased() ) { vol_level = _n->volumeLevel( cur_frame + gated_frames ); } @@ -485,7 +483,7 @@ void InstrumentFunctionArpeggio::processNote( notePlayHandle * _n ) // create sub-note-play-handle, only ptr to note is different // and is_arp_note=true - new notePlayHandle( _n->instrumentTrack(), + new NotePlayHandle( _n->instrumentTrack(), ( ( m_arpModeModel.value() != FreeMode ) ? cnphv.first()->offset() : _n->offset() ) + diff --git a/src/core/InstrumentSoundShaping.cpp b/src/core/InstrumentSoundShaping.cpp index 16a6f5050..4f9579aa9 100644 --- a/src/core/InstrumentSoundShaping.cpp +++ b/src/core/InstrumentSoundShaping.cpp @@ -31,7 +31,7 @@ #include "EnvelopeAndLfoParameters.h" #include "Instrument.h" #include "InstrumentTrack.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" @@ -106,13 +106,13 @@ InstrumentSoundShaping::~InstrumentSoundShaping() -float InstrumentSoundShaping::volumeLevel( notePlayHandle * _n, +float InstrumentSoundShaping::volumeLevel( NotePlayHandle * _n, const f_cnt_t _frame ) { f_cnt_t release_begin = _frame - _n->releaseFramesDone() + _n->framesBeforeRelease(); - if( _n->released() == false ) + if( _n->isReleased() == false ) { release_begin += engine::mixer()->framesPerPeriod(); } @@ -129,13 +129,13 @@ float InstrumentSoundShaping::volumeLevel( notePlayHandle * _n, void InstrumentSoundShaping::processAudioBuffer( sampleFrame * _ab, const fpp_t _frames, - notePlayHandle * _n ) + NotePlayHandle * _n ) { const f_cnt_t total_frames = _n->totalFramesPlayed(); f_cnt_t release_begin = total_frames - _n->releaseFramesDone() + _n->framesBeforeRelease(); - if( _n->released() == false ) + if( _n->isReleased() == false ) { release_begin += engine::mixer()->framesPerPeriod(); } diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index bb2c80f9d..db6a4c686 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -27,11 +27,10 @@ #include "Mixer.h" #include "FxMixer.h" #include "MixHelpers.h" -#include "play_handle.h" #include "song.h" #include "templates.h" #include "EnvelopeAndLfoParameters.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "InstrumentTrack.h" #include "debug.h" #include "engine.h" @@ -214,8 +213,7 @@ void MixerWorkerThread::processJobQueue() switch( it->type ) { case PlayHandle: - ( (playHandle *) it->job )-> - play( m_workingBuf ); + ( (::PlayHandle *) it->job )->play( m_workingBuf ); break; case AudioPortEffects: { @@ -588,8 +586,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer() ConstPlayHandleList::Iterator it_rem = m_playHandlesToRemove.begin(); while( it_rem != m_playHandlesToRemove.end() ) { - PlayHandleList::Iterator it = qFind( m_playHandles.begin(), - m_playHandles.end(), *it_rem ); + PlayHandleList::Iterator it = qFind( m_playHandles.begin(), m_playHandles.end(), *it_rem ); if( it != m_playHandles.end() ) { @@ -618,9 +615,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer() // STAGE 1: run and render all play handles - FILL_JOB_QUEUE(PlayHandleList,m_playHandles, - MixerWorkerThread::PlayHandle, - !( *it )->done()); + FILL_JOB_QUEUE(PlayHandleList,m_playHandles,MixerWorkerThread::PlayHandle, !( *it )->isFinished()); START_JOBS(); WAIT_FOR_JOBS(); @@ -634,7 +629,7 @@ const surroundSampleFrame * Mixer::renderNextBuffer() ++it; continue; } - if( ( *it )->done() ) + if( ( *it )->isFinished() ) { delete *it; it = m_playHandles.erase( it ); @@ -689,12 +684,11 @@ void Mixer::clear() { // TODO: m_midiClient->noteOffAll(); lock(); - for( PlayHandleList::Iterator it = m_playHandles.begin(); - it != m_playHandles.end(); ++it ) + for( PlayHandleList::Iterator it = m_playHandles.begin(); it != m_playHandles.end(); ++it ) { // we must not delete instrument-play-handles as they exist // during the whole lifetime of an instrument - if( ( *it )->type() != playHandle::InstrumentPlayHandle ) + if( ( *it )->type() != PlayHandle::TypeInstrumentPlayHandle ) { m_playHandlesToRemove.push_back( *it ); } @@ -913,7 +907,7 @@ void Mixer::removeAudioPort( AudioPort * _port ) -void Mixer::removePlayHandle( playHandle * _ph ) +void Mixer::removePlayHandle( PlayHandle * _ph ) { lock(); // check thread affinity as we must not delete play-handles @@ -966,10 +960,9 @@ bool Mixer::hasNotePlayHandles() { lock(); - for( PlayHandleList::Iterator it = m_playHandles.begin(); - it != m_playHandles.end(); ++it ) + for( PlayHandleList::Iterator it = m_playHandles.begin(); it != m_playHandles.end(); ++it ) { - if( (*it)->type() == playHandle::NotePlayHandle ) + if( (*it)->type() == PlayHandle::TypeNotePlayHandle ) { unlock(); return true; diff --git a/src/core/note_play_handle.cpp b/src/core/NotePlayHandle.cpp similarity index 81% rename from src/core/note_play_handle.cpp rename to src/core/NotePlayHandle.cpp index 16ce402fe..78db9df90 100644 --- a/src/core/note_play_handle.cpp +++ b/src/core/NotePlayHandle.cpp @@ -1,6 +1,6 @@ /* - * note_play_handle.cpp - implementation of class notePlayHandle, part of - * rendering engine + * NotePlayHandle.cpp - implementation of class NotePlayHandle which manages + * playback of a single note by an instrument * * Copyright (c) 2004-2014 Tobias Doerffel * @@ -23,7 +23,7 @@ * */ -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "basic_filters.h" #include "config_mgr.h" #include "DetuningHelper.h" @@ -34,7 +34,7 @@ #include "song.h" -notePlayHandle::BaseDetuning::BaseDetuning( DetuningHelper *detuning ) : +NotePlayHandle::BaseDetuning::BaseDetuning( DetuningHelper *detuning ) : m_value( detuning ? detuning->automationPattern()->valueAt( 0 ) : 0 ) { } @@ -44,20 +44,19 @@ notePlayHandle::BaseDetuning::BaseDetuning( DetuningHelper *detuning ) : -notePlayHandle::notePlayHandle( InstrumentTrack * _it, - const f_cnt_t _offset, - const f_cnt_t _frames, - const note & _n, - notePlayHandle *parent, - const bool _part_of_arp, - int midiEventChannel, - Origin origin ) : - playHandle( NotePlayHandle, _offset ), - note( _n.length(), _n.pos(), _n.key(), - _n.getVolume(), _n.getPanning(), _n.detuning() ), +NotePlayHandle::NotePlayHandle( InstrumentTrack* instrumentTrack, + const f_cnt_t _offset, + const f_cnt_t _frames, + const note& n, + NotePlayHandle *parent, + const bool _part_of_arp, + int midiEventChannel, + Origin origin ) : + PlayHandle( TypeNotePlayHandle, _offset ), + note( n.length(), n.pos(), n.key(), n.getVolume(), n.getPanning(), n.detuning() ), m_pluginData( NULL ), m_filter( NULL ), - m_instrumentTrack( _it ), + m_instrumentTrack( instrumentTrack ), m_frames( 0 ), m_totalFramesPlayed( 0 ), m_framesBeforeRelease( 0 ), @@ -72,12 +71,12 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it, m_patternIndex( 0 ), #endif m_origTempo( engine::getSong()->getTempo() ), - m_origBaseNote( instrumentTrack()->baseNoteModel()->value() ), + m_origBaseNote( instrumentTrack->baseNoteModel()->value() ), m_frequency( 0 ), 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() ) @@ -111,7 +110,7 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it, m_instrumentTrack->midiNoteOn( *this ); } - if( !isTopNote() || !instrumentTrack()->isArpeggioEnabled() ) + if( !isTopNote() || !instrumentTrack->isArpeggioEnabled() ) { // send MidiNoteOn event m_instrumentTrack->processOutEvent( @@ -123,7 +122,7 @@ notePlayHandle::notePlayHandle( InstrumentTrack * _it, -notePlayHandle::~notePlayHandle() +NotePlayHandle::~NotePlayHandle() { noteOff( 0 ); @@ -163,7 +162,7 @@ notePlayHandle::~notePlayHandle() -void notePlayHandle::setVolume( const volume_t _volume ) +void NotePlayHandle::setVolume( const volume_t _volume ) { note::setVolume( _volume ); @@ -173,7 +172,7 @@ void notePlayHandle::setVolume( const volume_t _volume ) -void notePlayHandle::setPanning( const panning_t panning ) +void NotePlayHandle::setPanning( const panning_t panning ) { note::setPanning( panning ); @@ -186,7 +185,7 @@ void notePlayHandle::setPanning( const panning_t panning ) -int notePlayHandle::midiVelocity() const +int NotePlayHandle::midiVelocity() const { int vel = getVolume(); if( m_instrumentTrack->getVolume() < DefaultVolume ) @@ -199,7 +198,7 @@ int notePlayHandle::midiVelocity() const -int notePlayHandle::midiKey() const +int NotePlayHandle::midiKey() const { return key() - m_origBaseNote + instrumentTrack()->baseNoteModel()->value(); } @@ -207,7 +206,7 @@ int notePlayHandle::midiKey() const -void notePlayHandle::play( sampleFrame * _working_buffer ) +void NotePlayHandle::play( sampleFrame * _working_buffer ) { if( m_muted ) { @@ -236,7 +235,7 @@ void notePlayHandle::play( sampleFrame * _working_buffer ) f_cnt_t todo = engine::mixer()->framesPerPeriod(); // if this note is base-note for arpeggio, always set // m_releaseFramesToDo to bigger value than m_releaseFramesDone - // because we do not allow notePlayHandle::done() to be true + // because we do not allow NotePlayHandle::isFinished() to be true // until all sub-notes are completely played and no new ones // are inserted by arpAndChordsTabWidget::processNote() if( isArpeggioBaseNote() ) @@ -290,7 +289,7 @@ void notePlayHandle::play( sampleFrame * _working_buffer ) it != m_subNotes.end(); ) { ( *it )->play( _working_buffer ); - if( ( *it )->done() ) + if( ( *it )->isFinished() ) { delete *it; it = m_subNotes.erase( it ); @@ -303,7 +302,7 @@ void notePlayHandle::play( sampleFrame * _working_buffer ) // if this note is a base-note and there're no more sub-notes left we // can set m_releaseFramesDone to m_releaseFramesToDo so that - // notePlayHandle::done() returns true and also this base-note is + // NotePlayHandle::isFinished() returns true and also this base-note is // removed from mixer's active note vector if( m_released && isArpeggioBaseNote() && m_subNotes.size() == 0 ) { @@ -318,7 +317,7 @@ void notePlayHandle::play( sampleFrame * _working_buffer ) -f_cnt_t notePlayHandle::framesLeft() const +f_cnt_t NotePlayHandle::framesLeft() const { if( instrumentTrack()->isSustainPedalPressed() ) { @@ -339,7 +338,15 @@ f_cnt_t notePlayHandle::framesLeft() const -bool notePlayHandle::isFromTrack( const track * _track ) const +fpp_t NotePlayHandle::framesLeftForCurrentPeriod() const +{ + return (fpp_t) qMin( framesLeft(), engine::mixer()->framesPerPeriod() ); +} + + + + +bool NotePlayHandle::isFromTrack( const track * _track ) const { return m_instrumentTrack == _track || m_bbTrack == _track; } @@ -347,7 +354,7 @@ bool notePlayHandle::isFromTrack( const track * _track ) const -void notePlayHandle::noteOff( const f_cnt_t _s ) +void NotePlayHandle::noteOff( const f_cnt_t _s ) { if( m_released ) { @@ -380,7 +387,7 @@ void notePlayHandle::noteOff( const f_cnt_t _s ) -f_cnt_t notePlayHandle::actualReleaseFramesToDo() const +f_cnt_t NotePlayHandle::actualReleaseFramesToDo() const { return m_instrumentTrack->m_soundShaping.releaseFrames(/* isArpeggioBaseNote()*/ ); @@ -389,7 +396,7 @@ f_cnt_t notePlayHandle::actualReleaseFramesToDo() const -void notePlayHandle::setFrames( const f_cnt_t _frames ) +void NotePlayHandle::setFrames( const f_cnt_t _frames ) { m_frames = _frames; if( m_frames == 0 ) @@ -402,7 +409,7 @@ void notePlayHandle::setFrames( const f_cnt_t _frames ) -float notePlayHandle::volumeLevel( const f_cnt_t _frame ) +float NotePlayHandle::volumeLevel( const f_cnt_t _frame ) { return m_instrumentTrack->m_soundShaping.volumeLevel( this, _frame ); } @@ -410,7 +417,7 @@ float notePlayHandle::volumeLevel( const f_cnt_t _frame ) -bool notePlayHandle::isArpeggioBaseNote() const +bool NotePlayHandle::isArpeggioBaseNote() const { return isTopNote() && ( m_partOfArpeggio || m_instrumentTrack->isArpeggioEnabled() ); } @@ -418,7 +425,7 @@ bool notePlayHandle::isArpeggioBaseNote() const -void notePlayHandle::mute() +void NotePlayHandle::mute() { // mute all sub-notes for( NotePlayHandleList::Iterator it = m_subNotes.begin(); @@ -432,7 +439,7 @@ void notePlayHandle::mute() -int notePlayHandle::index() const +int NotePlayHandle::index() const { const PlayHandleList & playHandles = engine::mixer()->playHandles(); @@ -440,11 +447,9 @@ int notePlayHandle::index() const for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it ) { - const notePlayHandle * nph = - dynamic_cast( *it ); - if( nph == NULL || - nph->m_instrumentTrack != m_instrumentTrack || - nph->released() == true ) + const NotePlayHandle * nph = + dynamic_cast( *it ); + if( nph == NULL || nph->m_instrumentTrack != m_instrumentTrack || nph->isReleased() ) { continue; } @@ -460,7 +465,7 @@ int notePlayHandle::index() const -ConstNotePlayHandleList notePlayHandle::nphsOfInstrumentTrack( +ConstNotePlayHandleList NotePlayHandle::nphsOfInstrumentTrack( const InstrumentTrack * _it, bool _all_ph ) { const PlayHandleList & playHandles = engine::mixer()->playHandles(); @@ -469,10 +474,9 @@ ConstNotePlayHandleList notePlayHandle::nphsOfInstrumentTrack( for( PlayHandleList::ConstIterator it = playHandles.begin(); it != playHandles.end(); ++it ) { - const notePlayHandle * nph = - dynamic_cast( *it ); - if( nph != NULL && nph->m_instrumentTrack == _it && - ( nph->released() == false || _all_ph == true ) ) + const NotePlayHandle * nph = + dynamic_cast( *it ); + if( nph != NULL && nph->m_instrumentTrack == _it && ( nph->isReleased() == false || _all_ph == true ) ) { cnphv.push_back( nph ); } @@ -483,7 +487,7 @@ ConstNotePlayHandleList notePlayHandle::nphsOfInstrumentTrack( -bool notePlayHandle::operator==( const notePlayHandle & _nph ) const +bool NotePlayHandle::operator==( const NotePlayHandle & _nph ) const { return length() == _nph.length() && pos() == _nph.pos() && @@ -504,7 +508,7 @@ bool notePlayHandle::operator==( const notePlayHandle & _nph ) const -void notePlayHandle::updateFrequency() +void NotePlayHandle::updateFrequency() { const float pitch = ( key() - @@ -526,7 +530,7 @@ void notePlayHandle::updateFrequency() -void notePlayHandle::processMidiTime( const MidiTime& time ) +void NotePlayHandle::processMidiTime( const MidiTime& time ) { if( detuning() && time >= songGlobalParentOffset()+pos() ) { @@ -542,7 +546,7 @@ void notePlayHandle::processMidiTime( const MidiTime& time ) -void notePlayHandle::resize( const bpm_t _new_tempo ) +void NotePlayHandle::resize( const bpm_t _new_tempo ) { double completed = m_totalFramesPlayed / (double) m_frames; double new_frames = m_origFrames * m_origTempo / (double) _new_tempo; diff --git a/src/core/preset_preview_play_handle.cpp b/src/core/PresetPreviewPlayHandle.cpp similarity index 73% rename from src/core/preset_preview_play_handle.cpp rename to src/core/PresetPreviewPlayHandle.cpp index ca247c44a..bbeeceaef 100644 --- a/src/core/preset_preview_play_handle.cpp +++ b/src/core/PresetPreviewPlayHandle.cpp @@ -1,8 +1,7 @@ /* - * preset_preview_play_handle.cpp - implementation of class - * presetPreviewPlayHandle + * PresetPreviewPlayHandle.cpp - implementation of class PresetPreviewPlayHandle * - * Copyright (c) 2005-2009 Tobias Doerffel + * Copyright (c) 2005-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -26,55 +25,53 @@ #include #include -#include "preset_preview_play_handle.h" +#include "PresetPreviewPlayHandle.h" #include "debug.h" #include "engine.h" #include "Instrument.h" #include "InstrumentTrack.h" #include "MidiPort.h" #include "mmp.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "ProjectJournal.h" #include "TrackContainer.h" // invisible track-container which is needed as parent for preview-channels -class previewTrackContainer : public TrackContainer +class PreviewTrackContainer : public TrackContainer { public: - previewTrackContainer() : + PreviewTrackContainer() : m_previewInstrumentTrack( NULL ), m_previewNote( NULL ), m_dataMutex() { setJournalling( FALSE ); - m_previewInstrumentTrack = dynamic_cast( - track::create( track::InstrumentTrack, - this ) ); + m_previewInstrumentTrack = dynamic_cast( track::create( track::InstrumentTrack, this ) ); m_previewInstrumentTrack->setJournalling( FALSE ); } - virtual ~previewTrackContainer() + virtual ~PreviewTrackContainer() { } virtual QString nodeName() const { - return "bbtrackcontainer"; + return "previewtrackcontainer"; } - InstrumentTrack * previewInstrumentTrack() + InstrumentTrack* previewInstrumentTrack() { return m_previewInstrumentTrack; } - notePlayHandle * previewNote() + NotePlayHandle* previewNote() { return m_previewNote; } - void setPreviewNote( notePlayHandle * _note ) + void setPreviewNote( NotePlayHandle * _note ) { m_previewNote = _note; } @@ -101,22 +98,21 @@ public: private: - InstrumentTrack * m_previewInstrumentTrack; - notePlayHandle * m_previewNote; + InstrumentTrack* m_previewInstrumentTrack; + NotePlayHandle* m_previewNote; QMutex m_dataMutex; - friend class presetPreviewPlayHandle; + friend class PresetPreviewPlayHandle; } ; -previewTrackContainer * presetPreviewPlayHandle::s_previewTC; +PreviewTrackContainer * PresetPreviewPlayHandle::s_previewTC; -presetPreviewPlayHandle::presetPreviewPlayHandle( const QString & _preset_file, - bool _load_by_plugin ) : - playHandle( PresetPreviewHandle ), +PresetPreviewPlayHandle::PresetPreviewPlayHandle( const QString & _preset_file, bool _load_by_plugin ) : + PlayHandle( TypePresetPreviewHandle ), m_previewNote( NULL ) { s_previewTC->lockData(); @@ -164,7 +160,7 @@ presetPreviewPlayHandle::presetPreviewPlayHandle( const QString & _preset_file, midiPort()->setMode( MidiPort::Disabled ); // create note-play-handle for it - m_previewNote = new notePlayHandle( + m_previewNote = new NotePlayHandle( s_previewTC->previewInstrumentTrack(), 0, typeInfo::max() / 2, note( 0, 0, DefaultKey, 100 ) ); @@ -179,7 +175,7 @@ presetPreviewPlayHandle::presetPreviewPlayHandle( const QString & _preset_file, -presetPreviewPlayHandle::~presetPreviewPlayHandle() +PresetPreviewPlayHandle::~PresetPreviewPlayHandle() { s_previewTC->lockData(); // not muted by other preset-preview-handle? @@ -195,7 +191,7 @@ presetPreviewPlayHandle::~presetPreviewPlayHandle() -void presetPreviewPlayHandle::play( sampleFrame * _working_buffer ) +void PresetPreviewPlayHandle::play( sampleFrame * _working_buffer ) { m_previewNote->play( _working_buffer ); } @@ -203,7 +199,7 @@ void presetPreviewPlayHandle::play( sampleFrame * _working_buffer ) -bool presetPreviewPlayHandle::done() const +bool PresetPreviewPlayHandle::isFinished() const { return m_previewNote->isMuted(); } @@ -211,7 +207,7 @@ bool presetPreviewPlayHandle::done() const -bool presetPreviewPlayHandle::isFromTrack( const track * _track ) const +bool PresetPreviewPlayHandle::isFromTrack( const track * _track ) const { return s_previewTC->previewInstrumentTrack() == _track; } @@ -219,18 +215,18 @@ bool presetPreviewPlayHandle::isFromTrack( const track * _track ) const -void presetPreviewPlayHandle::init() +void PresetPreviewPlayHandle::init() { if( !s_previewTC ) { - s_previewTC = new previewTrackContainer; + s_previewTC = new PreviewTrackContainer; } } -void presetPreviewPlayHandle::cleanup() +void PresetPreviewPlayHandle::cleanup() { delete s_previewTC; s_previewTC = NULL; @@ -239,7 +235,7 @@ void presetPreviewPlayHandle::cleanup() -ConstNotePlayHandleList presetPreviewPlayHandle::nphsOfInstrumentTrack( +ConstNotePlayHandleList PresetPreviewPlayHandle::nphsOfInstrumentTrack( const InstrumentTrack * _it ) { ConstNotePlayHandleList cnphv; @@ -256,7 +252,7 @@ ConstNotePlayHandleList presetPreviewPlayHandle::nphsOfInstrumentTrack( -bool presetPreviewPlayHandle::isPreviewing() +bool PresetPreviewPlayHandle::isPreviewing() { return s_previewTC->isPreviewing(); } diff --git a/src/core/SamplePlayHandle.cpp b/src/core/SamplePlayHandle.cpp index 57f399818..d1b1a4adf 100644 --- a/src/core/SamplePlayHandle.cpp +++ b/src/core/SamplePlayHandle.cpp @@ -34,7 +34,7 @@ SamplePlayHandle::SamplePlayHandle( const QString& sampleFile ) : - playHandle( playHandle::SamplePlayHandle ), + PlayHandle( TypeSamplePlayHandle ), m_sampleBuffer( new SampleBuffer( sampleFile ) ), m_doneMayReturnTrue( true ), m_frame( 0 ), @@ -51,7 +51,7 @@ SamplePlayHandle::SamplePlayHandle( const QString& sampleFile ) : SamplePlayHandle::SamplePlayHandle( SampleBuffer* sampleBuffer ) : - playHandle( playHandle::SamplePlayHandle ), + PlayHandle( TypeSamplePlayHandle ), m_sampleBuffer( sharedObject::ref( sampleBuffer ) ), m_doneMayReturnTrue( true ), m_frame( 0 ), @@ -68,7 +68,7 @@ SamplePlayHandle::SamplePlayHandle( SampleBuffer* sampleBuffer ) : SamplePlayHandle::SamplePlayHandle( SampleTCO* tco ) : - playHandle( playHandle::SamplePlayHandle ), + PlayHandle( TypeSamplePlayHandle ), m_sampleBuffer( sharedObject::ref( tco->sampleBuffer() ) ), m_doneMayReturnTrue( true ), m_frame( 0 ), @@ -85,7 +85,7 @@ SamplePlayHandle::SamplePlayHandle( SampleTCO* tco ) : SamplePlayHandle::SamplePlayHandle( pattern * _pattern ) : - playHandle( playHandle::SamplePlayHandle ), + PlayHandle( TypeSamplePlayHandle ), m_sampleBuffer( sharedObject::ref( _pattern->frozenPattern() ) ), m_doneMayReturnTrue( true ), m_frame( 0 ), @@ -140,9 +140,9 @@ void SamplePlayHandle::play( sampleFrame * _working_buffer ) -bool SamplePlayHandle::done() const +bool SamplePlayHandle::isFinished() const { - return( framesDone() >= totalFrames() && m_doneMayReturnTrue == true ); + return framesDone() >= totalFrames() && m_doneMayReturnTrue == true; } @@ -150,7 +150,7 @@ bool SamplePlayHandle::done() const bool SamplePlayHandle::isFromTrack( const track * _track ) const { - return( m_track == _track || m_bbTrack == _track ); + return m_track == _track || m_bbTrack == _track; } @@ -158,9 +158,7 @@ bool SamplePlayHandle::isFromTrack( const track * _track ) const f_cnt_t SamplePlayHandle::totalFrames() const { - return( ( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ) * - ( engine::mixer()->processingSampleRate() / - engine::mixer()->baseSampleRate() ) ); + return ( m_sampleBuffer->endFrame() - m_sampleBuffer->startFrame() ) * ( engine::mixer()->processingSampleRate() / engine::mixer()->baseSampleRate() ); } diff --git a/src/core/SampleRecordHandle.cpp b/src/core/SampleRecordHandle.cpp index 674af8d93..edae63072 100644 --- a/src/core/SampleRecordHandle.cpp +++ b/src/core/SampleRecordHandle.cpp @@ -34,7 +34,7 @@ SampleRecordHandle::SampleRecordHandle( SampleTCO* tco ) : - playHandle( SamplePlayHandle ), + PlayHandle( TypeSamplePlayHandle ), m_framesRecorded( 0 ), m_minLength( tco->length() ), m_track( tco->getTrack() ), @@ -84,7 +84,7 @@ void SampleRecordHandle::play( sampleFrame * /*_working_buffer*/ ) -bool SampleRecordHandle::done() const +bool SampleRecordHandle::isFinished() const { return false; } diff --git a/src/core/engine.cpp b/src/core/engine.cpp index a62781a98..575f0b474 100644 --- a/src/core/engine.cpp +++ b/src/core/engine.cpp @@ -3,7 +3,7 @@ /* * engine.cpp - implementation of LMMS' engine-system * - * Copyright (c) 2006-2010 Tobias Doerffel + * Copyright (c) 2006-2014 Tobias Doerffel * * This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net * @@ -39,7 +39,7 @@ #include "Mixer.h" #include "pattern.h" #include "piano_roll.h" -#include "preset_preview_play_handle.h" +#include "PresetPreviewPlayHandle.h" #include "ProjectJournal.h" #include "project_notes.h" #include "Plugin.h" @@ -102,7 +102,7 @@ void engine::init( const bool _has_gui ) s_mainWindow->finalize(); } - presetPreviewPlayHandle::init(); + PresetPreviewPlayHandle::init(); s_dummyTC = new DummyTrackContainer; s_mixer->startProcessing(); @@ -122,7 +122,7 @@ void engine::destroy() deleteHelper( &s_automationEditor ); deleteHelper( &s_fxMixerView ); - presetPreviewPlayHandle::cleanup(); + PresetPreviewPlayHandle::cleanup(); InstrumentTrackView::cleanupWindowCache(); s_song->clearProject(); diff --git a/src/core/song.cpp b/src/core/song.cpp index 93444337a..3ac88a411 100644 --- a/src/core/song.cpp +++ b/src/core/song.cpp @@ -50,7 +50,7 @@ #include "FileDialog.h" #include "MidiClient.h" #include "mmp.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pattern.h" #include "piano_roll.h" #include "ProjectJournal.h" @@ -232,8 +232,8 @@ void song::setTempo() for( PlayHandleList::Iterator it = playHandles.begin(); it != playHandles.end(); ++it ) { - notePlayHandle * nph = dynamic_cast( *it ); - if( nph && !nph->released() ) + NotePlayHandle * nph = dynamic_cast( *it ); + if( nph && !nph->isReleased() ) { nph->resize( tempo ); } diff --git a/src/gui/file_browser.cpp b/src/gui/file_browser.cpp index 2900f9332..dd80392e4 100644 --- a/src/gui/file_browser.cpp +++ b/src/gui/file_browser.cpp @@ -44,7 +44,7 @@ #include "InstrumentTrack.h" #include "MainWindow.h" #include "mmp.h" -#include "preset_preview_play_handle.h" +#include "PresetPreviewPlayHandle.h" #include "SamplePlayHandle.h" #include "song.h" #include "string_pair_drag.h" @@ -439,10 +439,7 @@ void fileBrowserTreeWidget::mousePressEvent( QMouseEvent * _me ) ( f->handling() == fileItem::LoadAsPreset || f->handling() == fileItem::LoadByPlugin ) ) { - m_previewPlayHandle = - new presetPreviewPlayHandle( f->fullName(), - f->handling() == - fileItem::LoadByPlugin ); + m_previewPlayHandle = new PresetPreviewPlayHandle( f->fullName(), f->handling() == fileItem::LoadByPlugin ); } if( m_previewPlayHandle != NULL ) { @@ -517,8 +514,7 @@ void fileBrowserTreeWidget::mouseReleaseEvent( QMouseEvent * _me ) { // if there're samples shorter than 3 seconds, we don't // stop them if the user releases mouse-button... - if( m_previewPlayHandle->type() == - playHandle::SamplePlayHandle ) + if( m_previewPlayHandle->type() == PlayHandle::TypeSamplePlayHandle ) { SamplePlayHandle * s = dynamic_cast( m_previewPlayHandle ); diff --git a/src/tracks/InstrumentTrack.cpp b/src/tracks/InstrumentTrack.cpp index b7412f19f..aeaa49dc9 100644 --- a/src/tracks/InstrumentTrack.cpp +++ b/src/tracks/InstrumentTrack.cpp @@ -66,7 +66,7 @@ #include "MidiClient.h" #include "MidiPortMenu.h" #include "mmp.h" -#include "note_play_handle.h" +#include "NotePlayHandle.h" #include "pattern.h" #include "PluginView.h" #include "SamplePlayHandle.h" @@ -152,10 +152,10 @@ InstrumentTrack::~InstrumentTrack() void InstrumentTrack::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames, - notePlayHandle * _n ) + NotePlayHandle * _n ) { // we must not play the sound if this InstrumentTrack is muted... - if( isMuted() || ( _n && _n->bbTrackMuted() ) ) + if( isMuted() || ( _n && _n->isBbTrackMuted() ) ) { return; } @@ -230,7 +230,7 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& ti switch( event.type() ) { // we don't send MidiNoteOn, MidiNoteOff and MidiKeyPressure - // events to instrument as notePlayHandle will send them on its + // events to instrument as NotePlayHandle will send them on its // own case MidiNoteOn: if( event.velocity() > 0 ) @@ -238,11 +238,11 @@ void InstrumentTrack::processInEvent( const MidiEvent& event, const MidiTime& ti if( m_notes[event.key()] == NULL ) { // create (timed) note-play-handle - notePlayHandle* nph = new notePlayHandle( this, time.frames( engine::framesPerTick() ), + NotePlayHandle* nph = new NotePlayHandle( this, time.frames( engine::framesPerTick() ), typeInfo::max() / 2, note( MidiTime(), MidiTime(), event.key(), event.volume() ), NULL, false, event.channel(), - notePlayHandle::OriginMidiInput ); + NotePlayHandle::OriginMidiInput ); if( engine::mixer()->addPlayHandle( nph ) ) { m_notes[event.key()] = nph; @@ -404,7 +404,7 @@ void InstrumentTrack::silenceAllNotes() -f_cnt_t InstrumentTrack::beatLen( notePlayHandle * _n ) const +f_cnt_t InstrumentTrack::beatLen( NotePlayHandle * _n ) const { if( m_instrument != NULL ) { @@ -420,7 +420,7 @@ f_cnt_t InstrumentTrack::beatLen( notePlayHandle * _n ) const -void InstrumentTrack::playNote( notePlayHandle * _n, +void InstrumentTrack::playNote( NotePlayHandle * _n, sampleFrame * _working_buffer ) { // arpeggio- and chord-widget has to do its work -> adding sub-notes @@ -450,7 +450,7 @@ QString InstrumentTrack::instrumentName() const -void InstrumentTrack::deleteNotePluginData( notePlayHandle* n ) +void InstrumentTrack::deleteNotePluginData( NotePlayHandle* n ) { if( m_instrument != NULL ) { @@ -642,24 +642,20 @@ bool InstrumentTrack::play( const MidiTime & _start, const fpp_t _frames, cur_note->length().frames( frames_per_tick ); - notePlayHandle * note_play_handle = - new notePlayHandle( this, _offset, - note_frames, - *cur_note ); - note_play_handle->setBBTrack( bb_track ); + NotePlayHandle* notePlayHandle = new NotePlayHandle( this, _offset, note_frames, *cur_note ); + notePlayHandle->setBBTrack( bb_track ); // are we playing global song? if( _tco_num < 0 ) { // then set song-global offset of pattern in order to // properly perform the note detuning - note_play_handle->setSongGlobalParentOffset( p->startPosition() ); + notePlayHandle->setSongGlobalParentOffset( p->startPosition() ); } #if LMMS_SINGERBOT_SUPPORT - note_play_handle->setPatternIndex( note_idx ); + notePlayHandle->setPatternIndex( note_idx ); #endif - engine::mixer()->addPlayHandle( - note_play_handle ); + engine::mixer()->addPlayHandle( notePlayHandle ); played_a_note = true; #if LMMS_SINGERBOT_SUPPORT ++note_idx; diff --git a/src/tracks/SampleTrack.cpp b/src/tracks/SampleTrack.cpp index 25f6eee3b..4326ed855 100644 --- a/src/tracks/SampleTrack.cpp +++ b/src/tracks/SampleTrack.cpp @@ -422,7 +422,7 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames, SampleTCO * st = dynamic_cast( tco ); if( !st->isMuted() ) { - playHandle * handle; + PlayHandle* handle; if( st->isRecord() ) { if( !engine::getSong()->isRecording() )