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

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