Skip to content

Commit ee960df

Browse files
committed
Factor out common code
1 parent dcceb49 commit ee960df

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

src/sound/soundbase.cpp

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -363,21 +363,16 @@ void CSoundBase::ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes )
363363
switch ( cCtrl.eType )
364364
{
365365
case Fader:
366+
case OurFader:
366367
{
367368
// we are assuming that the controller number is the same
368369
// as the audio fader index and the range is 0-127
369370
const int iFaderLevel = static_cast<int> ( static_cast<double> ( iValue ) / 127 * AUD_MIX_FADER_MAX );
371+
const int iTheChannel = cCtrl.eType == OurFader ? I_MY_CHANNEL : cCtrl.iChannel;
370372

371373
// consider offset for the faders
372374

373-
emit ControllerInFaderLevel ( cCtrl.iChannel, iFaderLevel );
374-
}
375-
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 ( I_MY_CHANNEL, iFaderLevel);
375+
emit ControllerInFaderLevel ( iTheChannel, iFaderLevel );
381376
}
382377
break;
383378
case Pan:

0 commit comments

Comments
 (0)