Skip to content

Commit 4cb01e3

Browse files
AndersGoranpljones
authored andcommitted
Add ctrlmidich option for "own channel" regardless of number
1 parent 08b404c commit 4cb01e3

File tree

3 files changed

+19
-0
lines changed

3 files changed

+19
-0
lines changed

src/audiomixerboard.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1343,6 +1343,16 @@ void CAudioMixerBoard::SetFaderLevel ( const int iChannelIdx, const int iValue )
13431343
vecpChanFader[static_cast<size_t> ( iChannelIdx )]->SetFaderLevel ( iValue );
13441344
}
13451345
}
1346+
// Proposed change: if iChannelIdx is -1 and our own channel ID is a valid index
1347+
// then we adjust our own fader level:
1348+
if((iChannelIdx == -1) && iMyChannelID != INVALID_INDEX)
1349+
{
1350+
if ( vecpChanFader[static_cast<size_t> ( iMyChannelID )]->IsVisible() )
1351+
{
1352+
//printf("debug: set our own fader(%d) level to %d\n", iMyChannelID, iValue);
1353+
vecpChanFader[static_cast<size_t> ( iMyChannelID )]->SetFaderLevel ( iValue );
1354+
}
1355+
}
13461356
}
13471357

13481358
void CAudioMixerBoard::SetPanValue ( const int iChannelIdx, const int iValue )

src/sound/soundbase.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ char const sMidiCtlChar[] = {
3333
/* [EMidiCtlType::Solo] = */ 's',
3434
/* [EMidiCtlType::Mute] = */ 'm',
3535
/* [EMidiCtlType::MuteMyself] = */ 'o',
36+
/* [EMidiCtlType::OurFader] = */ 'z', // Proposed addition: a new enum value for "our fader"
3637
/* [EMidiCtlType::None] = */ '\0' };
3738

3839
/* Implementation *************************************************************/
@@ -372,6 +373,13 @@ void CSoundBase::ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes )
372373
emit ControllerInFaderLevel ( cCtrl.iChannel, iFaderLevel );
373374
}
374375
break;
376+
case OurFader:
377+
{
378+
// special message about our own fader - emit a fader level whatever-it-is-called with channel id -1
379+
const int iFaderLevel = static_cast<int> ( static_cast<double> ( iValue ) / 127*AUD_MIX_FADER_MAX );
380+
emit ControllerInFaderLevel ( -1, iFaderLevel);
381+
}
382+
break;
375383
case Pan:
376384
{
377385
// Pan levels need to be symmetric between 1 and 127

src/sound/soundbase.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ enum EMidiCtlType
4949
Solo,
5050
Mute,
5151
MuteMyself,
52+
OurFader, // Proposed addition: a MidiCtrlType for our own fader level
5253
None
5354
};
5455

0 commit comments

Comments
 (0)