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().
This commit is contained in:
Tobias Doerffel
2014-01-29 23:52:57 +01:00
parent b4c4b293a0
commit ca0e413fd3
59 changed files with 413 additions and 419 deletions

View File

@@ -41,7 +41,7 @@ class QPixmap;
class QScrollBar;
class comboBox;
class notePlayHandle;
class NotePlayHandle;
class timeLine;
class toolButton;

View File

@@ -42,7 +42,7 @@ public:
{
}
virtual void playNote( notePlayHandle *, bool, sampleFrame * )
virtual void playNote( NotePlayHandle *, bool, sampleFrame * )
{
}

View File

@@ -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:

View File

@@ -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 );

View File

@@ -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

View File

@@ -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 );

View File

@@ -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;
} ;

View File

@@ -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;
}

View File

@@ -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 <tobydox/at/users.sourceforge.net>
*
*
* 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<ch_cnt_t=DEFAULT_CHANNELS> class basicFilters;
typedef QList<notePlayHandle *> NotePlayHandleList;
typedef QList<const notePlayHandle *> ConstNotePlayHandleList;
typedef QList<NotePlayHandle *> NotePlayHandleList;
typedef QList<const NotePlayHandle *> 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<f_cnt_t>( 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;

View File

@@ -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 <tobydox/at/users.sourceforge.net>
* Copyright (c) 2004-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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 <QtCore/QThread>
#include <QtCore/QVector>
@@ -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<playHandle *> PlayHandleList;
typedef QList<const playHandle *> ConstPlayHandleList;
typedef QList<PlayHandle *> PlayHandleList;
typedef QList<const PlayHandle *> ConstPlayHandleList;
#endif

View File

@@ -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 <tobydox/at/users.sourceforge.net>
*
*
* 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;
} ;

View File

@@ -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;

View File

@@ -28,7 +28,6 @@
#include <QtCore/QList>
#include <QtCore/QPair>
#include <qobject.h>
#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;

View File

@@ -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;

View File

@@ -45,7 +45,7 @@ class QMenu;
class QSignalMapper;
class comboBox;
class notePlayHandle;
class NotePlayHandle;
class pattern;
class timeLine;
class toolButton;

View File

@@ -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();

View File

@@ -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
{

View File

@@ -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<bSynth *>( _n->m_pluginData );
}

View File

@@ -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,

View File

@@ -29,7 +29,7 @@
#include <QtCore/QBuffer>
#include "FlpImport.h"
#include "note_play_handle.h"
#include "NotePlayHandle.h"
#include "AutomationPattern.h"
#include "basic_filters.h"
#include "bb_track.h"

View File

@@ -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<effectLib::monoToStereoAdaptor<DistFX> > 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<f_cnt_t>( 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<SweepOsc *>( _n->m_pluginData );
}

View File

@@ -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 );

View File

@@ -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 )

View File

@@ -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 );

View File

@@ -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 )

View File

@@ -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 );

View File

@@ -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<Oscillator *>( static_cast<oscPtr *>(
_n->m_pluginData )->oscLeft );

View File

@@ -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 );

View File

@@ -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<Basic_Gb_Apu *>( _n->m_pluginData );
}

View File

@@ -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 );

View File

@@ -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();

View File

@@ -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;

View File

@@ -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;

View File

@@ -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<SF2PluginData *>(
_n->m_pluginData );

View File

@@ -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 );

View File

@@ -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<SfxrSynth *>( _n->m_pluginData );
}

View File

@@ -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 );

View File

@@ -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<cSID *>( _n->m_pluginData );
}

View File

@@ -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 );

View File

@@ -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<malletsSynth *>( _n->m_pluginData );
}

View File

@@ -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 );

View File

@@ -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<Oscillator *>( static_cast<oscPtr *>(
_n->m_pluginData )->oscLeft );

View File

@@ -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 );

View File

@@ -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<stringContainer *>( _n->m_pluginData );
}

View File

@@ -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 );

View File

@@ -39,7 +39,7 @@ class QPushButton;
class LocalZynAddSubFx;
class ZynAddSubFxView;
class notePlayHandle;
class NotePlayHandle;
class knob;
class ledCheckBox;

View File

@@ -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();

View File

@@ -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() ) +

View File

@@ -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();
}

View File

@@ -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;

View File

@@ -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 <tobydox/at/users.sourceforge.net>
*
@@ -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<f_cnt_t>( 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<const notePlayHandle *>( *it );
if( nph == NULL ||
nph->m_instrumentTrack != m_instrumentTrack ||
nph->released() == true )
const NotePlayHandle * nph =
dynamic_cast<const NotePlayHandle *>( *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<const notePlayHandle *>( *it );
if( nph != NULL && nph->m_instrumentTrack == _it &&
( nph->released() == false || _all_ph == true ) )
const NotePlayHandle * nph =
dynamic_cast<const NotePlayHandle *>( *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;

View File

@@ -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 <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -26,55 +25,53 @@
#include <QtCore/QFileInfo>
#include <QtCore/QMutexLocker>
#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<InstrumentTrack *>(
track::create( track::InstrumentTrack,
this ) );
m_previewInstrumentTrack = dynamic_cast<InstrumentTrack *>( 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<f_cnt_t>::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();
}

View File

@@ -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() );
}

View File

@@ -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;
}

View File

@@ -3,7 +3,7 @@
/*
* engine.cpp - implementation of LMMS' engine-system
*
* Copyright (c) 2006-2010 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2006-2014 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* 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();

View File

@@ -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<notePlayHandle *>( *it );
if( nph && !nph->released() )
NotePlayHandle * nph = dynamic_cast<NotePlayHandle *>( *it );
if( nph && !nph->isReleased() )
{
nph->resize( tempo );
}

View File

@@ -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<SamplePlayHandle *>(
m_previewPlayHandle );

View File

@@ -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<f_cnt_t>::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;

View File

@@ -422,7 +422,7 @@ bool SampleTrack::play( const MidiTime & _start, const fpp_t _frames,
SampleTCO * st = dynamic_cast<SampleTCO *>( tco );
if( !st->isMuted() )
{
playHandle * handle;
PlayHandle* handle;
if( st->isRecord() )
{
if( !engine::getSong()->isRecording() )