removed obsolete instrument-parallelization support as this is handled much better by worker threads and adds unneccessary complexity

git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@1718 0778d3d1-df1d-0410-868b-ea421aaaa00d
This commit is contained in:
Tobias Doerffel
2008-09-30 11:14:32 +00:00
parent 396dbbc1b3
commit adf8aed93c
51 changed files with 219 additions and 277 deletions

View File

@@ -1,3 +1,64 @@
2008-09-30 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sid/sid_instrument.h:
* plugins/sid/sid_instrument.cpp:
* plugins/ladspa_effect/tap/CMakeLists.txt:
* plugins/ladspa_effect/caps/CMakeLists.txt:
* plugins/patman/patman.cpp:
* plugins/patman/patman.h:
* plugins/lb302/lb302.cpp:
* plugins/lb302/lb302.h:
* plugins/organic/organic.cpp:
* plugins/organic/organic.h:
* plugins/lb303/lb303.cpp:
* plugins/lb303/lb303.h:
* plugins/bit_invader/bit_invader.cpp:
* plugins/bit_invader/bit_invader.h:
* plugins/vst_effect/vst_effect.cpp:
* plugins/vibed/vibed.h:
* plugins/vibed/vibed.cpp:
* plugins/triple_oscillator/triple_oscillator.h:
* plugins/triple_oscillator/triple_oscillator.cpp:
* plugins/audio_file_processor/audio_file_processor.cpp:
* plugins/audio_file_processor/audio_file_processor.h:
* plugins/stk/mallets/mallets.cpp:
* plugins/stk/mallets/mallets.h:
* plugins/papu/papu_instrument.h:
* plugins/papu/papu_instrument.cpp:
* plugins/sf2_player/sf2_player.cpp:
* plugins/sf2_player/sf2_player.h:
* plugins/vestige/vestige.cpp:
* plugins/vestige/vestige.h:
* plugins/kicker/kicker.cpp:
* plugins/kicker/kicker.h:
* include/instrument_play_handle.h:
* include/instrument_track.h:
* include/instrument.h:
* include/sample_record_handle.h:
* include/plugin.h:
* include/note_play_handle.h:
* include/sample_play_handle.h:
* include/remote_plugin.h:
* include/preset_preview_play_handle.h:
* include/play_handle.h:
* src/core/plugin.cpp:
* src/core/preset_preview_play_handle.cpp:
* src/core/note_play_handle.cpp:
* src/core/remote_plugin.cpp:
* src/core/sample_play_handle.cpp:
* src/core/mixer.cpp:
* src/core/instrument.cpp:
* src/core/sample_record_handle.cpp:
* src/tracks/instrument_track.cpp:
removed obsolete instrument-parallelization support as this is handled
much better by worker threads and adds unneccessary complexity
* cmake/modules/FindPCHSupport.cmake:
* INSTALL:
* CMakeLists.txt:
- removed (buggy) PCH support
- added support for CFLAGS and CXXFLAGS environment variables
2008-09-29 Tobias Doerffel <tobydox/at/users/dot/sourceforge/dot/net>
* plugins/sf2_player/sf2_player.cpp:

View File

@@ -56,12 +56,10 @@ public:
// if the plugin doesn't play each note, it can create an instrument-
// play-handle and re-implement this method, so that it mixes its
// output buffer only once per mixer-period
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
// to be implemented by actual plugin
virtual void playNote( notePlayHandle * _note_to_play,
bool _try_parallelizing,
sampleFrame * _working_buf )
{
}

View File

@@ -1,7 +1,7 @@
/*
* instrument_play_handle.h - play-handle for playing an instrument
*
* Copyright (c) 2005-2007 Tobias Doerffel <tobydox/at/users.sourceforge.net>
* Copyright (c) 2005-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
* This file is part of Linux MultiMedia Studio - http://lmms.sourceforge.net
*
@@ -33,41 +33,30 @@
class instrumentPlayHandle : public playHandle
{
public:
inline instrumentPlayHandle( instrument * _instrument ) :
instrumentPlayHandle( instrument * _instrument ) :
playHandle( InstrumentPlayHandle ),
m_instrument( _instrument )
{
}
inline virtual ~instrumentPlayHandle()
virtual ~instrumentPlayHandle()
{
}
inline virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer )
virtual void play( sampleFrame * _working_buffer )
{
m_instrument->play( _try_parallelizing, _working_buffer );
m_instrument->play( _working_buffer );
}
inline virtual bool done( void ) const
virtual bool done( void ) const
{
return( FALSE );
return false;
}
virtual bool isFromTrack( const track * _track ) const
{
return( m_instrument->isFromTrack( _track ) );
}
inline virtual bool supportsParallelizing( void ) const
{
return( m_instrument->supportsParallelizing() );
}
inline virtual void waitForWorkerThread( void )
{
m_instrument->waitForWorkerThread();
return m_instrument->isFromTrack( _track );
}

View File

@@ -83,8 +83,7 @@ public:
// for capturing note-play-events -> need that for arpeggio,
// filter and so on
void playNote( notePlayHandle * _n, bool _try_parallelizing,
sampleFrame * _working_buffer );
void playNote( notePlayHandle * _n, sampleFrame * _working_buffer );
QString instrumentName( void ) const;
inline const instrument * getInstrument( void ) const

View File

@@ -72,8 +72,7 @@ public:
return( m_unpitchedFrequency );
}
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
virtual inline bool done( void ) const
{
@@ -237,27 +236,6 @@ public:
m_bbTrack = _bb_track;
}
virtual bool supportsParallelizing( void ) const
{
return( m_instrumentTrack->getInstrument()->
supportsParallelizing()
&&
// we must not parallelize note-play-handles, which
// belong to instruments that are instrument-play-
// handle-driven (i.e. react to MIDI events),
// because then waitForWorkerThread()
// would be additionally called for each
// note-play-handle which results in hangups
m_instrumentTrack->getInstrument()->
isMidiBased() );
}
virtual void waitForWorkerThread( void )
{
m_instrumentTrack->m_instrument->waitForWorkerThread();
}
void processMidiTime( const midiTime & _time );
void resize( const bpm_t _new_tempo );

View File

@@ -1,6 +1,5 @@
/*
* play_handle.h - base-class playHandle which is needed by
* LMMS-Player-Engine
* play_handle.h - base-class playHandle - core of rendering engine
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -64,23 +63,22 @@ public:
const QThread * affinity( void ) const
{
return( m_affinity );
return m_affinity;
}
inline types type( void ) const
{
return( m_type );
return m_type;
}
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer ) = 0;
virtual void play( sampleFrame * _working_buffer ) = 0;
virtual bool done( 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
{
return ( m_offset );
return m_offset;
}
inline void setOffset( f_cnt_t _offset )
@@ -91,15 +89,6 @@ public:
virtual bool isFromTrack( const track * _track ) const = 0;
virtual bool supportsParallelizing( void ) const
{
return( FALSE );
}
virtual void waitForWorkerThread( void )
{
}
private:
types m_type;

View File

@@ -182,19 +182,6 @@ public:
model * _parent,
void * _data );
// some plugins run external programs for doing their actual work
// (e.g. LVSL-server) or can run in separate worker-threads, so the
// mixer can schedule processing for parallelizing work which is very
// important for at least trying to use the full power of SMP-systems,
// otherwise the mixer will create according threads on it's own which
// of course isn't that efficient
virtual bool supportsParallelizing( void ) const;
// plugins supporting parallelization, should re-implement that as the
// mixer will call this at the end of processing according chain
// of plugins
virtual void waitForWorkerThread( void );
// fills given vector with descriptors of all available plugins
static void getDescriptorsOfAvailPlugins(
QVector<descriptor> & _plugin_descs );

View File

@@ -41,8 +41,7 @@ public:
bool _load_by_plugin = false );
virtual ~presetPreviewPlayHandle();
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
virtual bool done( void ) const;
virtual bool isFromTrack( const track * _track ) const;

View File

@@ -610,9 +610,7 @@ public:
virtual bool processMessage( const message & _m );
bool process( const sampleFrame * _in_buf,
sampleFrame * _out_buf, bool _wait );
bool waitForProcessingFinished( sampleFrame * _out_buf );
bool process( const sampleFrame * _in_buf, sampleFrame * _out_buf );
void processMidiEvent( const midiEvent &, const f_cnt_t _offset );

View File

@@ -52,8 +52,7 @@ public:
}
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
virtual bool done( void ) const;
virtual bool isFromTrack( const track * _track ) const;

View File

@@ -45,8 +45,7 @@ public:
sampleRecordHandle( sampleTCO * _tco );
virtual ~sampleRecordHandle();
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
virtual bool done( void ) const;
virtual bool isFromTrack( const track * _track ) const;

View File

@@ -99,7 +99,7 @@ audioFileProcessor::~audioFileProcessor()
void audioFileProcessor::playNote( notePlayHandle * _n, bool,
void audioFileProcessor::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
const fpp_t frames = _n->framesLeftForCurrentPeriod();

View File

@@ -44,7 +44,7 @@ public:
audioFileProcessor( instrumentTrack * _instrument_track );
virtual ~audioFileProcessor();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -23,15 +23,9 @@
*/
#include "bit_invader.h"
#include <QtXml/QDomElement>
using namespace std;
#include "bit_invader.h"
#include "engine.h"
#include "graph.h"
#include "instrument_track.h"
@@ -56,7 +50,7 @@ plugin::descriptor PLUGIN_EXPORT bitinvader_plugin_descriptor =
STRINGIFY_PLUGIN_NAME( PLUGIN_NAME ),
"BitInvader",
QT_TRANSLATE_NOOP( "pluginBrowser",
"Rough & Dirty Wavetable Synthesizer." ),
"Customizable wavetable synthesizer" ),
"Andreas Brandmaier <andreas/at/brandmaier/dot/de>",
0x0100,
plugin::Instrument,
@@ -90,6 +84,7 @@ bSynth::~bSynth()
delete[] sample_shape;
}
sample_t bSynth::nextStringSample( void )
{
float sample_step =
@@ -145,14 +140,13 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) :
m_sampleLength( 128, 8, 128, 1, this, tr( "Samplelength" ) ),
m_graph( -1.0f, 1.0f, 128, this ),
m_interpolation( FALSE, this ),
m_normalize( FALSE, this)
m_normalize( FALSE, this )
{
m_graph.setWaveToSine();
connect( &m_sampleLength, SIGNAL( dataChanged( ) ),
this, SLOT( lengthChanged( ) )
);
this, SLOT( lengthChanged( ) ) );
connect( &m_graph, SIGNAL( samplesChanged( int, int ) ),
this, SLOT( samplesChanged( int, int ) ) );
@@ -160,6 +154,8 @@ bitInvader::bitInvader( instrumentTrack * _channel_track ) :
}
bitInvader::~bitInvader()
{
}
@@ -214,11 +210,11 @@ void bitInvader::loadSettings( const QDomElement & _this )
// Load LED
m_normalize.loadSettings( _this, "normalize" );
// songEditor::inst()->setModified();
}
void bitInvader::lengthChanged( void )
{
m_graph.setLength( (int) m_sampleLength.value() );
@@ -227,6 +223,8 @@ void bitInvader::lengthChanged( void )
}
void bitInvader::samplesChanged( int _begin, int _end )
{
normalize();
@@ -234,6 +232,8 @@ void bitInvader::samplesChanged( int _begin, int _end )
}
void bitInvader::normalize( void )
{
// analyze
@@ -248,13 +248,16 @@ void bitInvader::normalize( void )
QString bitInvader::nodeName( void ) const
{
return( bitinvader_plugin_descriptor.name );
}
void bitInvader::playNote( notePlayHandle * _n, bool,
void bitInvader::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
@@ -296,18 +299,27 @@ void bitInvader::playNote( notePlayHandle * _n, bool,
}
void bitInvader::deleteNotePluginData( notePlayHandle * _n )
{
delete static_cast<bSynth *>( _n->m_pluginData );
}
pluginView * bitInvader::instantiateView( QWidget * _parent )
{
return( new bitInvaderView( this, _parent ) );
}
bitInvaderView::bitInvaderView( instrument * _instrument,
QWidget * _parent ) :
instrumentView( _instrument, _parent )
@@ -438,6 +450,9 @@ bitInvaderView::bitInvaderView( instrument * _instrument,
}
void bitInvaderView::modelChanged( void )
{
bitInvader * b = castModel<bitInvader>();
@@ -450,12 +465,17 @@ void bitInvaderView::modelChanged( void )
}
void bitInvaderView::sinWaveClicked( void )
{
m_graph->model()->setWaveToSine();
engine::getSong()->setModified();
}
void bitInvaderView::triangleWaveClicked( void )
{
m_graph->model()->setWaveToTriangle();
@@ -463,24 +483,35 @@ void bitInvaderView::triangleWaveClicked( void )
}
void bitInvaderView::sawWaveClicked( void )
{
m_graph->model()->setWaveToSaw();
engine::getSong()->setModified();
}
void bitInvaderView::sqrWaveClicked( void )
{
m_graph->model()->setWaveToSquare();
engine::getSong()->setModified();
}
void bitInvaderView::noiseWaveClicked( void )
{
m_graph->model()->setWaveToNoise();
engine::getSong()->setModified();
}
void bitInvaderView::usrWaveClicked( void )
{
/*
@@ -513,6 +544,8 @@ void bitInvaderView::usrWaveClicked( void )
}
void bitInvaderView::smoothClicked( void )
{
m_graph->model()->smooth();
@@ -520,6 +553,8 @@ void bitInvaderView::smoothClicked( void )
}
void bitInvaderView::interpolationToggled( bool value )
{
m_graph->setGraphStyle( value ? graph::LinearStyle : graph::NearestStyle);
@@ -527,12 +562,16 @@ void bitInvaderView::interpolationToggled( bool value )
}
void bitInvaderView::normalizeToggled( bool value )
{
engine::getSong()->setModified();
}
extern "C"
{

View File

@@ -69,7 +69,7 @@ public:
bitInvader(instrumentTrack * _channel_track );
virtual ~bitInvader();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -114,7 +114,7 @@ typedef effectLib::distortion<> distFX;
typedef sweepOscillator<effectLib::monoToStereoAdaptor<distFX> > sweepOsc;
void kickerInstrument::playNote( notePlayHandle * _n, bool,
void kickerInstrument::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
const float decfr = m_decayModel.value() *

View File

@@ -42,7 +42,7 @@ public:
kickerInstrument( instrumentTrack * _instrument_track );
virtual ~kickerInstrument();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -11,7 +11,7 @@ IF(NO_O3)
MESSAGE("Found GCC 4.1.x - compiling CAPS-plugins with -O2 instead of -O3")
SET_TARGET_PROPERTIES(caps PROPERTIES COMPILE_FLAGS "-Wno-write-strings")
ELSE(NO_O3)
SET_TARGET_PROPERTIES(caps PROPERTIES COMPILE_FLAGS "-O3 -Wno-write-strings")
SET_TARGET_PROPERTIES(caps PROPERTIES COMPILE_FLAGS "-O3 -Wno-write-strings -msse -msse2 -msse3")
ENDIF(NO_O3)
IF(LMMS_BUILD_WIN32)

View File

@@ -1,15 +1,13 @@
INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/include")
FILE(GLOB PLUGIN_SOURCES *.c)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3 -Wno-write-strings -Wall -fomit-frame-pointer -fno-strict-aliasing -fstrength-reduce -funroll-loops -ffast-math")
FOREACH(_item ${PLUGIN_SOURCES})
GET_FILENAME_COMPONENT(_plugin "${_item}" NAME_WE)
ADD_LIBRARY(${_plugin} MODULE ${_item})
INSTALL(TARGETS ${_plugin} LIBRARY DESTINATION ${PLUGIN_DIR}/ladspa)
SET_TARGET_PROPERTIES(${_plugin} PROPERTIES PREFIX "")
SET_TARGET_PROPERTIES(${_plugin} PROPERTIES COMPILE_FLAGS "-O3 -Wno-write-strings -Wall -fomit-frame-pointer -fno-strict-aliasing -fstrength-reduce -funroll-loops -ffast-math -c")
IF(LMMS_BUILD_WIN32)
ADD_CUSTOM_COMMAND(TARGET ${_plugin} POST_BUILD COMMAND /opt/mingw/bin/i586-mingw32-strip ${CMAKE_CURRENT_BINARY_DIR}/${_plugin}.dll)
ELSE(LMMS_BUILD_WIN32)
SET_TARGET_PROPERTIES(${_plugin} PROPERTIES COMPILE_FLAGS "${COMPILE_FLAGS} -fPIC -DPIC")
ENDIF(LMMS_BUILD_WIN32)
IF(LMMS_BUILD_APPLE)
SET_TARGET_PROPERTIES(${_plugin} PROPERTIES LINK_FLAGS "${LINK_FLAGS} -shared -no-undefined -Bsymbolic -lm")

View File

@@ -715,8 +715,7 @@ void lb302Synth::initNote( lb302Note *n)
}
void lb302Synth::playNote( notePlayHandle * _n, bool,
sampleFrame * _working_buffer )
void lb302Synth::playNote( notePlayHandle * _n, sampleFrame * _working_buffer )
{
//fpp_t framesPerPeriod = engine::getMixer()->framesPerPeriod();
@@ -775,8 +774,7 @@ void lb302Synth::playNote( notePlayHandle * _n, bool,
void lb302Synth::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void lb302Synth::play( sampleFrame * _working_buffer )
{
//printf(".");
const fpp_t frames = engine::getMixer()->framesPerPeriod();

View File

@@ -139,9 +139,8 @@ public:
lb302Synth( instrumentTrack * _channel_track );
virtual ~lb302Synth();
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void play( sampleFrame * _working_buffer );
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -666,7 +666,7 @@ void lb303Synth::initNote( lb303Note *n)
}
void lb303Synth::playNote( notePlayHandle * _n, bool,
void lb303Synth::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
if( _n->arpBaseNote() )
@@ -708,8 +708,7 @@ void lb303Synth::playNote( notePlayHandle * _n, bool,
void lb303Synth::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void lb303Synth::play( sampleFrame * _working_buffer )
{
//printf(".");
const fpp_t frames = engine::getMixer()->framesPerPeriod();

View File

@@ -139,9 +139,8 @@ public:
lb303Synth( instrumentTrack * _channel_track );
virtual ~lb303Synth();
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void play( sampleFrame * _working_buffer );
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -183,7 +183,7 @@ QString organicInstrument::nodeName( void ) const
void organicInstrument::playNote( notePlayHandle * _n, bool,
void organicInstrument::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )

View File

@@ -82,7 +82,7 @@ public:
organicInstrument( instrumentTrack * _instrument_track );
virtual ~organicInstrument();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -230,7 +230,9 @@ f_cnt_t papuInstrument::desiredReleaseFrames( void ) const
return f_cnt_t( 1000 );
}
void papuInstrument::playNote( notePlayHandle * _n, bool,
void papuInstrument::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
const f_cnt_t tfp = _n->totalFramesPlayed();

View File

@@ -44,7 +44,7 @@ public:
papuInstrument( instrumentTrack * _instrument_track );
virtual ~papuInstrument();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );
@@ -160,4 +160,4 @@ private:
} ;
#endif
#endif

View File

@@ -129,7 +129,7 @@ QString patmanInstrument::nodeName( void ) const
void patmanInstrument::playNote( notePlayHandle * _n, bool,
void patmanInstrument::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
if( m_patchFile == "" )

View File

@@ -53,7 +53,7 @@ public:
patmanInstrument( instrumentTrack * _track );
virtual ~patmanInstrument();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -554,7 +554,7 @@ void sf2Instrument::updateSampleRate( void )
void sf2Instrument::playNote( notePlayHandle * _n, bool, sampleFrame * )
void sf2Instrument::playNote( notePlayHandle * _n, sampleFrame * )
{
const double LOG440 = 2.643452676486187424842455584439449012279510498046875f;
@@ -587,8 +587,7 @@ void sf2Instrument::playNote( notePlayHandle * _n, bool, sampleFrame * )
// Could we get iph-based instruments support sample-exact models by using a
// frame-length of 1 while rendering?
void sf2Instrument::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void sf2Instrument::play( sampleFrame * _working_buffer )
{
const fpp_t frames = engine::getMixer()->framesPerPeriod();

View File

@@ -54,10 +54,9 @@ public:
sf2Instrument( instrumentTrack * _instrument_track );
virtual ~sf2Instrument();
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );
@@ -88,6 +87,7 @@ public:
void setParameter( const QString & _param, const QString & _value );
public slots:
void openFile( const QString & _sf2File );
void updatePatch( void );

View File

@@ -295,7 +295,7 @@ static int sid_fillbuffer(unsigned char* sidreg, cSID *sid, int tdelta, short *p
void sidInstrument::playNote( notePlayHandle * _n, bool,
void sidInstrument::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
const f_cnt_t tfp = _n->totalFramesPlayed();

View File

@@ -91,7 +91,7 @@ public:
sidInstrument( instrumentTrack * _instrument_track );
virtual ~sidInstrument();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -204,7 +204,7 @@ QString malletsInstrument::nodeName( void ) const
void malletsInstrument::playNote( notePlayHandle * _n, bool,
void malletsInstrument::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
if( m_filesMissing )

View File

@@ -131,7 +131,7 @@ public:
malletsInstrument( instrumentTrack * _channel_track );
virtual ~malletsInstrument( void );
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -297,7 +297,7 @@ QString tripleOscillator::nodeName( void ) const
void tripleOscillator::playNote( notePlayHandle * _n, bool,
void tripleOscillator::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
if( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )

View File

@@ -97,7 +97,7 @@ public:
tripleOscillator( instrumentTrack * _track );
virtual ~tripleOscillator();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -183,7 +183,7 @@ void vestigeInstrument::loadFile( const QString & _file )
void vestigeInstrument::waitForWorkerThread( void )
void vestigeInstrument::play( sampleFrame * _buf )
{
m_pluginMutex.lock();
if( m_plugin == NULL )
@@ -192,38 +192,13 @@ void vestigeInstrument::waitForWorkerThread( void )
return;
}
m_plugin->process( NULL, _buf );
const fpp_t frames = engine::getMixer()->framesPerPeriod();
sampleFrame * buf = new sampleFrame[frames];
if( m_plugin->waitForProcessingFinished( buf ) )
{
getInstrumentTrack()->processAudioBuffer( buf, frames, NULL );
}
getInstrumentTrack()->processAudioBuffer( _buf, frames, NULL );
m_pluginMutex.unlock();
delete[] buf;
}
void vestigeInstrument::play( bool _try_parallelizing, sampleFrame * )
{
m_pluginMutex.lock();
if( m_plugin == NULL )
{
m_pluginMutex.unlock();
return;
}
m_plugin->process( NULL, NULL, FALSE );
m_pluginMutex.unlock();
if( !_try_parallelizing )
{
waitForWorkerThread();
}
}
@@ -238,7 +213,7 @@ bool vestigeInstrument::handleMidiEvent( const midiEvent & _me,
m_plugin->processMidiEvent( _me, _time );
}
m_pluginMutex.unlock();
return( TRUE );
return true;
}

View File

@@ -50,8 +50,7 @@ public:
vestigeInstrument( instrumentTrack * _channel_track );
virtual ~vestigeInstrument();
virtual void play( bool _try_parallelizing,
sampleFrame * _working_buffer );
virtual void play( sampleFrame * _working_buffer );
virtual void saveSettings( QDomDocument & _doc, QDomElement & _parent );
virtual void loadSettings( const QDomElement & _this );
@@ -60,16 +59,9 @@ public:
virtual void loadFile( const QString & _file );
virtual bool supportsParallelizing( void ) const
{
return( TRUE );
}
virtual void waitForWorkerThread( void );
virtual bool isMidiBased( void ) const
{
return( true );
return true;
}
virtual bool handleMidiEvent( const midiEvent & _me,

View File

@@ -274,7 +274,7 @@ QString vibed::nodeName( void ) const
void vibed::playNote( notePlayHandle * _n, bool, sampleFrame * _working_buffer )
void vibed::playNote( notePlayHandle * _n, sampleFrame * _working_buffer )
{
if ( _n->totalFramesPlayed() == 0 || _n->m_pluginData == NULL )
{

View File

@@ -43,7 +43,7 @@ public:
vibed( instrumentTrack * _instrument_track );
virtual ~vibed();
virtual void playNote( notePlayHandle * _n, bool _try_parallelizing,
virtual void playNote( notePlayHandle * _n,
sampleFrame * _working_buffer );
virtual void deleteNotePluginData( notePlayHandle * _n );

View File

@@ -100,7 +100,7 @@ bool vstEffect::processAudioBuffer( sampleFrame * _buf, const fpp_t _frames )
}
}
m_pluginMutex.lock();
m_plugin->process( buf, buf, TRUE );
m_plugin->process( buf, buf );
m_pluginMutex.unlock();
double out_sum = 0.0;

View File

@@ -50,7 +50,7 @@ instrument::~instrument()
void instrument::play( bool, sampleFrame * )
void instrument::play( sampleFrame * )
{
}

View File

@@ -118,13 +118,13 @@ public:
jobQueueItem() :
type( InvalidJob ),
job( NULL ),
done( FALSE )
done( false )
{
}
jobQueueItem( JobTypes _type, void * _job ) :
type( _type ),
job( _job ),
done( FALSE )
done( false )
{
}
@@ -156,7 +156,7 @@ public:
mixerWorkerThread( mixer * _mixer ) :
QThread( _mixer ),
m_quit( FALSE ),
m_quit( false ),
m_mixer( _mixer ),
m_queueReadySem( &m_mixer->m_queueReadySem ),
m_workersDoneSem( &m_mixer->m_workersDoneSem ),
@@ -176,7 +176,7 @@ public:
virtual void quit( void )
{
m_quit = TRUE;
m_quit = true;
}
private:
@@ -185,7 +185,7 @@ private:
sampleFrame * working_buf = (sampleFrame *) aligned_malloc(
m_mixer->framesPerPeriod() *
sizeof( sampleFrame ) );
while( m_quit == FALSE )
while( m_quit == false )
{
m_queueReadySem->acquire();
for( jobQueueItems::iterator it =
@@ -199,13 +199,13 @@ private:
m_jobQueue->lock.lock();
if( !it->done )
{
it->done = TRUE;
it->done = true;
m_jobQueue->lock.unlock();
#endif
switch( it->type )
{
case PlayHandle:
it->playHandleJob->play( FALSE, working_buf );
it->playHandleJob->play( working_buf );
break;
case AudioPortEffects:
{
@@ -490,7 +490,7 @@ sample_rate_t mixer::processingSampleRate( void ) const
bool mixer::criticalXRuns( void ) const
{
return( ( m_cpuLoad >= 99 &&
engine::getSong()->realTimeTask() == TRUE ) );
engine::getSong()->realTimeTask() == true ) );
}
@@ -534,7 +534,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
song::playPos p = engine::getSong()->getPlayPos(
song::Mode_PlayPattern );
if( engine::getSong()->playMode() == song::Mode_PlayPattern &&
engine::getPianoRoll()->isRecording() == TRUE &&
engine::getPianoRoll()->isRecording() == true &&
p != last_metro_pos && p.getTicks() %
(DefaultTicksPerTact / 4 ) == 0 )
{
@@ -596,37 +596,19 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
// clear last audio-buffer
clearAudioBuffer( m_writeBuf, m_framesPerPeriod );
//printf("---------------------------next period\n");
// if( criticalXRuns() == FALSE )
// if( criticalXRuns() == false )
{
engine::getFxMixer()->prepareMasterMix();
engine::getSong()->processNextBuffer();
lockPlayHandles();
int idx = 0;
if( m_multiThreaded )
{
playHandleVector par_hndls;
while( idx < m_playHandles.size() )
{
playHandle * n = m_playHandles[idx];
if( !n->done() && n->supportsParallelizing() )
{
n->play( TRUE, m_workingBuf );
par_hndls.push_back( n );
}
++idx;
}
mixerWorkerThread::jobQueue jq;
FILL_JOB_QUEUE(jq,playHandleVector,m_playHandles,
mixerWorkerThread::PlayHandle,
!( *it )->done() &&
!( *it )->supportsParallelizing() );
!( *it )->done());
DISTRIBUTE_JOB_QUEUE(jq);
for( playHandleVector::iterator it = par_hndls.begin();
it != par_hndls.end(); ++it )
{
( *it )->waitForWorkerThread();
}
WAIT_FOR_JOBS();
}
else
@@ -637,8 +619,10 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
{
if( !( *it )->done() )
{
( *it )->play( FALSE, m_workingBuf );
// play now and don't try to
// parallelize as we're on single-core
// system
( *it )->play( m_workingBuf );
}
}
}
@@ -684,7 +668,7 @@ const surroundSampleFrame * mixer::renderNextBuffer( void )
}
else
{
bool more_effects = FALSE;
bool more_effects = false;
for( QVector<audioPort *>::iterator it =
m_audioPorts.begin();
it != m_audioPorts.end(); ++it )
@@ -1007,7 +991,7 @@ void mixer::removePlayHandles( track * _track )
audioDevice * mixer::tryAudioDevices( void )
{
bool success_ful = FALSE;
bool success_ful = false;
audioDevice * dev = NULL;
QString dev_name = configManager::inst()->value( "mixer", "audiodev" );
@@ -1193,7 +1177,7 @@ midiClient * mixer::tryMidiClients( void )
mixer::fifoWriter::fifoWriter( mixer * _mixer, fifo * _fifo ) :
m_mixer( _mixer ),
m_fifo( _fifo ),
m_writing( TRUE )
m_writing( true )
{
}
@@ -1202,7 +1186,7 @@ mixer::fifoWriter::fifoWriter( mixer * _mixer, fifo * _fifo ) :
void mixer::fifoWriter::finish( void )
{
m_writing = FALSE;
m_writing = false;
}

View File

@@ -2,7 +2,7 @@
/*
* note_play_handle.cpp - implementation of class notePlayHandle, part of
* play-engine
* rendering engine
*
* Copyright (c) 2004-2008 Tobias Doerffel <tobydox/at/users.sourceforge.net>
*
@@ -174,10 +174,9 @@ int notePlayHandle::getMidiVelocity( void ) const
void notePlayHandle::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void notePlayHandle::play( sampleFrame * _working_buffer )
{
if( m_muted == TRUE )
if( m_muted )
{
return;
}
@@ -195,11 +194,10 @@ void notePlayHandle::play( bool _try_parallelizing,
if( framesLeft() > 0 )
{
// play note!
m_instrumentTrack->playNote( this, _try_parallelizing,
_working_buffer );
m_instrumentTrack->playNote( this, _working_buffer );
}
if( m_released == TRUE )
if( m_released )
{
f_cnt_t todo = engine::getMixer()->framesPerPeriod();
// if this note is base-note for arpeggio, always set
@@ -257,7 +255,7 @@ void notePlayHandle::play( bool _try_parallelizing,
for( notePlayHandleVector::iterator it = m_subNotes.begin();
it != m_subNotes.end(); )
{
( *it )->play( _try_parallelizing, _working_buffer );
( *it )->play( _working_buffer );
if( ( *it )->done() )
{
delete *it;

View File

@@ -129,22 +129,7 @@ plugin * plugin::instantiate( const QString & _plugin_name, model * _parent,
return( new dummyPlugin() );
}
plugin * inst = inst_hook( _parent, _data );
return( inst );
}
bool plugin::supportsParallelizing( void ) const
{
return( FALSE );
}
void plugin::waitForWorkerThread( void )
{
return inst;
}
@@ -202,7 +187,7 @@ pluginView * plugin::createView( QWidget * _parent )
{
pv->setModel( this );
}
return( pv );
return pv;
}
@@ -237,7 +222,7 @@ QDomElement plugin::descriptor::subPluginFeatures::key::saveXML(
a.setAttribute( "value", it.value() );
e.appendChild( a );
}
return( e );
return e;
}

View File

@@ -186,10 +186,9 @@ presetPreviewPlayHandle::~presetPreviewPlayHandle()
void presetPreviewPlayHandle::play( bool _try_parallelizing,
sampleFrame * _working_buffer )
void presetPreviewPlayHandle::play( sampleFrame * _working_buffer )
{
m_previewNote->play( _try_parallelizing, _working_buffer );
m_previewNote->play( _working_buffer );
}

View File

@@ -42,7 +42,6 @@
remotePlugin::remotePlugin( const QString & _plugin_executable,
bool _wait_for_init_done ) :
remotePluginBase( new shmFifo(), new shmFifo() ),
m_initialized( false ),
m_failed( true ),
m_commMutex( QMutex::Recursive ),
m_splitChannels( false ),
@@ -108,7 +107,7 @@ remotePlugin::~remotePlugin()
bool remotePlugin::process( const sampleFrame * _in_buf,
sampleFrame * _out_buf, bool _wait )
sampleFrame * _out_buf )
{
if( m_failed )
{
@@ -133,7 +132,7 @@ bool remotePlugin::process( const sampleFrame * _in_buf,
engine::getMixer()->clearAudioBuffer( _out_buf,
frames );
}
return( false );
return false;
}
memset( m_shm, 0, m_shmSize );
@@ -174,31 +173,15 @@ bool remotePlugin::process( const sampleFrame * _in_buf,
sendMessage( IdStartProcessing );
unlock();
m_initialized = TRUE;
if( _wait )
if( m_failed || _out_buf == NULL || m_outputCount == 0 )
{
waitForProcessingFinished( _out_buf );
}
return( TRUE );
}
bool remotePlugin::waitForProcessingFinished( sampleFrame * _out_buf )
{
if( m_failed || !m_initialized || _out_buf == NULL ||
m_outputCount == 0 )
{
return( false );
return false;
}
lock();
waitForMessage( IdProcessingDone );
unlock();
const fpp_t frames = engine::getMixer()->framesPerPeriod();
const ch_cnt_t outputs = tMin<ch_cnt_t>( m_outputCount,
DEFAULT_CHANNELS );
if( m_splitChannels )
@@ -234,7 +217,7 @@ bool remotePlugin::waitForProcessingFinished( sampleFrame * _out_buf )
}
}
return( TRUE );
return true;
}

View File

@@ -116,8 +116,7 @@ samplePlayHandle::~samplePlayHandle()
void samplePlayHandle::play( bool /* _try_parallelizing */,
sampleFrame * _working_buffer )
void samplePlayHandle::play( sampleFrame * _working_buffer )
{
//play( 0, _try_parallelizing );
if( framesDone() >= totalFrames() )

View File

@@ -68,8 +68,7 @@ sampleRecordHandle::~sampleRecordHandle()
void sampleRecordHandle::play( bool /* _try_parallelizing */,
sampleFrame * _working_buffer )
void sampleRecordHandle::play( sampleFrame * _working_buffer )
{
const sampleFrame * recbuf = engine::getMixer()->inputBuffer();
const fpp_t frames = engine::getMixer()->inputBufferFrames();

View File

@@ -394,7 +394,7 @@ f_cnt_t instrumentTrack::beatLen( notePlayHandle * _n ) const
void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing,
void instrumentTrack::playNote( notePlayHandle * _n,
sampleFrame * _working_buffer )
{
// arpeggio- and chord-widget has to do its work -> adding sub-notes
@@ -405,8 +405,7 @@ void instrumentTrack::playNote( notePlayHandle * _n, bool _try_parallelizing,
if( !_n->isArpeggioBaseNote() && m_instrument != NULL )
{
// all is done, so now lets play the note!
m_instrument->playNote( _n, _try_parallelizing,
_working_buffer );
m_instrument->playNote( _n, _working_buffer );
}
}