diff --git a/src/audiomixerboard.cpp b/src/audiomixerboard.cpp index 0d940e16de..e72f06dab5 100644 --- a/src/audiomixerboard.cpp +++ b/src/audiomixerboard.cpp @@ -1335,22 +1335,16 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector& vecChanInf void CAudioMixerBoard::SetFaderLevel ( const int iChannelIdx, const int iValue ) { - // only apply new fader level if channel index is valid and the fader is visible - if ( ( iChannelIdx >= 0 ) && ( iChannelIdx < MAX_NUM_CHANNELS ) ) - { - if ( vecpChanFader[static_cast ( iChannelIdx )]->IsVisible() ) - { - vecpChanFader[static_cast ( iChannelIdx )]->SetFaderLevel ( iValue ); - } - } // Proposed change: if iChannelIdx is -1 and our own channel ID is a valid index // then we adjust our own fader level: - if((iChannelIdx == -1) && iMyChannelID != INVALID_INDEX) + const int iTheChannelIdx = ( iChannelIdx == INVALID_INDEX ) ? iMyChannelID : iChannelIdx; + + // only apply new fader level if channel index is valid and the fader is visible + if ( ( iTheChannelIdx >= 0 ) && ( iTheChannelIdx < MAX_NUM_CHANNELS ) ) { - if ( vecpChanFader[static_cast ( iMyChannelID )]->IsVisible() ) + if ( vecpChanFader[static_cast ( iTheChannelIdx )]->IsVisible() ) { - //printf("debug: set our own fader(%d) level to %d\n", iMyChannelID, iValue); - vecpChanFader[static_cast ( iMyChannelID )]->SetFaderLevel ( iValue ); + vecpChanFader[static_cast ( iTheChannelIdx )]->SetFaderLevel ( iValue ); } } }