On 11/16/2014 01:28 PM, musikbear wrote: > great info! > Could you point to a 'model-example' in the code, where this is 'Signal & > slots' is used in the correct way -like > xxx.h > line : xyz
I can point to a correct and incorrect usage in the same file. BassBoosterControls.cpp lines 40-42: bad usage. connect( &m_freqModel, SIGNAL( dataChanged() ), this, SLOT( changeFrequency() ) ); connect( &m_gainModel, SIGNAL( dataChanged() ), this, SLOT( changeGain() ) ); connect( &m_ratioModel, SIGNAL( dataChanged() ), this, SLOT( changeRatio() ) ); Here, the signals generated by AutomatableModel are connected to slots in the effect. This is bad, because it causes a costly operation each time a value of a knob is changed. Instead, the effect should track the changes in some other way, eg. manually checking if the values are changed and acting accordingly. This kind of incorrect usage is very common in our codebase. Perhaps AutomatableModel needs a method to check for changed values, eg. AutomatableModel::valueChanged(), which would return true if the value has changed since last period. This could then be used by all DSP that needs to react to value changes in some way. line 43: good usage. connect( engine::mixer(), SIGNAL( sampleRateChanged() ), this, SLOT( changeFrequency() ) ); Here, we're connecting samplerate change to a slot in the effect. This is fine, because sample rate changes happen so infrequently and never at a speed-critical time, so they don't cause any performance loss. ------------------------------------------------------------------------------ Comprehensive Server Monitoring with Site24x7. Monitor 10 servers for $9/Month. Get alerted through email, SMS, voice calls or mobile push notifications. Take corrective actions from your mobile device. http://pubads.g.doubleclick.net/gampad/clk?id=154624111&iu=/4140/ostg.clktrk _______________________________________________ LMMS-devel mailing list LMMS-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/lmms-devel