set m_effectId to random value when it is not loaded from project.

This commit is contained in:
Wong Cho Ching
2014-01-29 19:57:13 +08:00
parent 6cf825ca99
commit 39a3b4c6cb
2 changed files with 16 additions and 3 deletions

View File

@@ -61,8 +61,21 @@ void PeakControllerEffectControls::loadSettings( const QDomElement & _this )
m_absModel.loadSettings( _this, "abs" );
m_amountMultModel.loadSettings( _this, "amountmult" );
int effectId = _this.attribute( "effectId" ).toInt();
m_effect->m_effectId = effectId;
/*If the peak controller effect is NOT loaded from project,
* m_effectId stored is useless.
* Reason to assign a random number to it:
* If the user clone the instrument, and m_effectId is cloned, and
* m_effectId is copied, then there would be two instruments
* having the same id.
*/
if( engine::getSong()->isLoadingProject() == true )
{
m_effect->m_effectId = _this.attribute( "effectId" ).toInt();
}
else
{
m_effect->m_effectId = rand();
}
if( m_effect->m_autoController && ( engine::getSong()->isLoadingProject() == true || presetPreviewPlayHandle::isPreviewing() == false ) )
{

View File

@@ -46,7 +46,7 @@ libdir=/usr/local/lib
srcdir=.
# compiler names
CC="gcc"
CC="cc"
CXX="c++"
# flags for C++ compiler: