Skip to content

Commit 2ade0ca

Browse files
committed
Factor out common code
1 parent 4cb01e3 commit 2ade0ca

File tree

1 file changed

+6
-12
lines changed

1 file changed

+6
-12
lines changed

src/audiomixerboard.cpp

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1335,22 +1335,16 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
13351335

13361336
void CAudioMixerBoard::SetFaderLevel ( const int iChannelIdx, const int iValue )
13371337
{
1338-
// only apply new fader level if channel index is valid and the fader is visible
1339-
if ( ( iChannelIdx >= 0 ) && ( iChannelIdx < MAX_NUM_CHANNELS ) )
1340-
{
1341-
if ( vecpChanFader[static_cast<size_t> ( iChannelIdx )]->IsVisible() )
1342-
{
1343-
vecpChanFader[static_cast<size_t> ( iChannelIdx )]->SetFaderLevel ( iValue );
1344-
}
1345-
}
13461338
// Proposed change: if iChannelIdx is -1 and our own channel ID is a valid index
13471339
// then we adjust our own fader level:
1348-
if((iChannelIdx == -1) && iMyChannelID != INVALID_INDEX)
1340+
const int iTheChannelIdx = ( iChannelIdx == INVALID_INDEX ) ? iMyChannelID : iChannelIdx;
1341+
1342+
// only apply new fader level if channel index is valid and the fader is visible
1343+
if ( ( iTheChannelIdx >= 0 ) && ( iTheChannelIdx < MAX_NUM_CHANNELS ) )
13491344
{
1350-
if ( vecpChanFader[static_cast<size_t> ( iMyChannelID )]->IsVisible() )
1345+
if ( vecpChanFader[static_cast<size_t> ( iTheChannelIdx )]->IsVisible() )
13511346
{
1352-
//printf("debug: set our own fader(%d) level to %d\n", iMyChannelID, iValue);
1353-
vecpChanFader[static_cast<size_t> ( iMyChannelID )]->SetFaderLevel ( iValue );
1347+
vecpChanFader[static_cast<size_t> ( iTheChannelIdx )]->SetFaderLevel ( iValue );
13541348
}
13551349
}
13561350
}

0 commit comments

Comments
 (0)