Skip to content

Commit dcceb49

Browse files
committed
Use I_MY_CHANNEL for "my channel" special value
1 parent 20828cb commit dcceb49

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

src/audiomixerboard.cpp

Lines changed: 7 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,22 +1343,16 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
13431343

13441344
void CAudioMixerBoard::SetFaderLevel ( const int iChannelIdx, const int iValue )
13451345
{
1346+
// If iChannelIdx is I_MY_CHANNEL and our own channel ID is a valid index
1347+
// then we adjust our own fader level
1348+
const int iTheChannelIdx = ( iChannelIdx == I_MY_CHANNEL ) ? iMyChannelID : iChannelIdx;
1349+
13461350
// only apply new fader level if channel index is valid and the fader is visible
1347-
if ( ( iChannelIdx >= 0 ) && ( iChannelIdx < MAX_NUM_CHANNELS ) )
1348-
{
1349-
if ( vecpChanFader[static_cast<size_t> ( iChannelIdx )]->IsVisible() )
1350-
{
1351-
vecpChanFader[static_cast<size_t> ( iChannelIdx )]->SetFaderLevel ( iValue );
1352-
}
1353-
}
1354-
// Proposed change: if iChannelIdx is -1 and our own channel ID is a valid index
1355-
// then we adjust our own fader level:
1356-
if((iChannelIdx == -1) && iMyChannelID != INVALID_INDEX)
1351+
if ( ( iTheChannelIdx >= 0 ) && ( iTheChannelIdx < MAX_NUM_CHANNELS ) )
13571352
{
1358-
if ( vecpChanFader[static_cast<size_t> ( iMyChannelID )]->IsVisible() )
1353+
if ( vecpChanFader[static_cast<size_t> ( iTheChannelIdx )]->IsVisible() )
13591354
{
1360-
//printf("debug: set our own fader(%d) level to %d\n", iMyChannelID, iValue);
1361-
vecpChanFader[static_cast<size_t> ( iMyChannelID )]->SetFaderLevel ( iValue );
1355+
vecpChanFader[static_cast<size_t> ( iTheChannelIdx )]->SetFaderLevel ( iValue );
13621356
}
13631357
}
13641358
}

src/sound/soundbase.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ void CSoundBase::ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes )
377377
{
378378
// special message about our own fader - emit a fader level whatever-it-is-called with channel id -1
379379
const int iFaderLevel = static_cast<int> ( static_cast<double> ( iValue ) / 127*AUD_MIX_FADER_MAX );
380-
emit ControllerInFaderLevel ( -1, iFaderLevel);
380+
emit ControllerInFaderLevel ( I_MY_CHANNEL, iFaderLevel);
381381
}
382382
break;
383383
case Pan:

src/sound/soundbase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
#endif
3333
#include "../global.h"
3434
#include "../util.h"
35+
#define I_MY_CHANNEL -1
3536

3637
// TODO better solution with enum definition
3738
// problem: in signals it seems not to work to use CSoundBase::ESndCrdResetType

0 commit comments

Comments
 (0)