SF2 Player, OpulenZ: addPlayHandle moved to end of constructor.

Should mean smaller risk of race conditions and less need for mutexes.
This commit is contained in:
Raine M. Ekman
2015-03-25 21:16:55 +02:00
parent de9f879dde
commit 4136dbb744
2 changed files with 6 additions and 6 deletions

View File

@@ -141,9 +141,6 @@ opl2instrument::opl2instrument( InstrumentTrack * _instrument_track ) :
vib_depth_mdl(false, this, tr( "Vibrato Depth" ) ),
trem_depth_mdl(false, this, tr( "Tremolo Depth" ) )
{
// Connect the plugin to the mixer...
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
// Create an emulator - samplerate, 16 bit, mono
emulatorMutex.lock();
@@ -220,6 +217,10 @@ opl2instrument::opl2instrument( InstrumentTrack * _instrument_track ) :
MOD_CON( fm_mdl );
MOD_CON( vib_depth_mdl );
MOD_CON( trem_depth_mdl );
// Connect the plugin to the mixer...
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
}
opl2instrument::~opl2instrument() {

View File

@@ -118,9 +118,6 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
// everytime we load a new soundfont.
m_synth = new_fluid_synth( m_settings );
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
loadFile( ConfigManager::inst()->defaultSoundfont() );
updateSampleRate();
@@ -152,6 +149,8 @@ sf2Instrument::sf2Instrument( InstrumentTrack * _instrument_track ) :
connect( &m_chorusSpeed, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) );
connect( &m_chorusDepth, SIGNAL( dataChanged() ), this, SLOT( updateChorus() ) );
InstrumentPlayHandle * iph = new InstrumentPlayHandle( this, _instrument_track );
Engine::mixer()->addPlayHandle( iph );
}