Skip to content

Commit

Permalink
Use I_MY_CHANNEL for "my channel" special value
Browse files Browse the repository at this point in the history
  • Loading branch information
pljones committed Nov 2, 2024
1 parent 5f8d868 commit f4b7dd5
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 14 deletions.
20 changes: 7 additions & 13 deletions src/audiomixerboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1343,22 +1343,16 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf

void CAudioMixerBoard::SetFaderLevel ( const int iChannelIdx, const int iValue )
{
// If iChannelIdx is I_MY_CHANNEL and our own channel ID is a valid index
// then we adjust our own fader level
const int iTheChannelIdx = ( iChannelIdx == I_MY_CHANNEL ) ? iMyChannelID : iChannelIdx;

// 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<size_t> ( iChannelIdx )]->IsVisible() )
{
vecpChanFader[static_cast<size_t> ( 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)
if ( ( iTheChannelIdx >= 0 ) && ( iTheChannelIdx < MAX_NUM_CHANNELS ) )
{
if ( vecpChanFader[static_cast<size_t> ( iMyChannelID )]->IsVisible() )
if ( vecpChanFader[static_cast<size_t> ( iTheChannelIdx )]->IsVisible() )
{
//printf("debug: set our own fader(%d) level to %d\n", iMyChannelID, iValue);
vecpChanFader[static_cast<size_t> ( iMyChannelID )]->SetFaderLevel ( iValue );
vecpChanFader[static_cast<size_t> ( iTheChannelIdx )]->SetFaderLevel ( iValue );
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/sound/soundbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,7 @@ void CSoundBase::ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes )
{
// special message about our own fader - emit a fader level whatever-it-is-called with channel id -1
const int iFaderLevel = static_cast<int> ( static_cast<double> ( iValue ) / 127*AUD_MIX_FADER_MAX );
emit ControllerInFaderLevel ( -1, iFaderLevel);
emit ControllerInFaderLevel ( I_MY_CHANNEL, iFaderLevel);
}
break;
case Pan:
Expand Down
1 change: 1 addition & 0 deletions src/sound/soundbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#endif
#include "../global.h"
#include "../util.h"
#define I_MY_CHANNEL -1

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

0 comments on commit f4b7dd5

Please sign in to comment.