Skip to content

Commit 6a6e8f2

Browse files
committed
Add MIDI control for inputfader using i
1 parent 8630648 commit 6a6e8f2

File tree

6 files changed

+31
-0
lines changed

6 files changed

+31
-0
lines changed

src/client.cpp

+14
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,8 @@ CClient::CClient ( const quint16 iPortNumber,
166166

167167
QObject::connect ( &Sound, &CSound::ControllerInMuteMyself, this, &CClient::OnControllerInMuteMyself );
168168

169+
QObject::connect ( &Sound, &CSound::ControllerInInputPanValue, this, &CClient::OnControllerInInputPanValue );
170+
169171
QObject::connect ( &Socket, &CHighPrioSocket::InvalidPacketReceived, this, &CClient::OnInvalidPacketReceived );
170172

171173
QObject::connect ( pSignalHandler, &CSignalHandler::HandledSignal, this, &CClient::OnHandledSignal );
@@ -717,6 +719,18 @@ void CClient::OnControllerInMuteMyself ( bool bMute )
717719
emit ControllerInMuteMyself ( bMute );
718720
}
719721

722+
void CClient::OnControllerInInputPanValue ( int iValue )
723+
{
724+
// in case of a headless client the panners cannot be moved so we need
725+
// to send the controller information directly to the server
726+
#ifdef HEADLESS
727+
// FIXME: no idea what to do here.
728+
//SetSliderAudioPan ( static_cast<float> ( iValue ) / AUD_MIX_PAN_MAX );
729+
#endif
730+
731+
emit ControllerInInputPanValue ( iValue );
732+
}
733+
720734
void CClient::OnClientIDReceived ( int iChanID )
721735
{
722736
// for headless mode we support to mute our own signal in the personal mix

src/client.h

+2
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ protected slots:
394394
void OnControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
395395
void OnControllerInFaderIsMute ( int iChannelIdx, bool bIsMute );
396396
void OnControllerInMuteMyself ( bool bMute );
397+
void OnControllerInInputPanValue ( int iValue );
397398
void OnClientIDReceived ( int iChanID );
398399

399400
signals:
@@ -425,4 +426,5 @@ protected slots:
425426
void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
426427
void ControllerInFaderIsMute ( int iChannelIdx, bool bIsMute );
427428
void ControllerInMuteMyself ( bool bMute );
429+
void ControllerInInputPanValue ( int iValue );
428430
};

src/clientdlg.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -523,6 +523,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
523523

524524
QObject::connect ( pClient, &CClient::ControllerInMuteMyself, this, &CClientDlg::OnControllerInMuteMyself );
525525

526+
QObject::connect ( pClient, &CClient::ControllerInInputPanValue, this, &CClientDlg::OnControllerInInputPanValue );
527+
526528
QObject::connect ( pClient, &CClient::CLChannelLevelListReceived, this, &CClientDlg::OnCLChannelLevelListReceived );
527529

528530
QObject::connect ( pClient, &CClient::VersionAndOSReceived, this, &CClientDlg::OnVersionAndOSReceived );

src/clientdlg.h

+2
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,8 @@ public slots:
151151

152152
void OnControllerInMuteMyself ( const bool bMute ) { chbLocalMute->setChecked ( bMute ); }
153153

154+
void OnControllerInInputPanValue ( const int iValue ) { ClientSettingsDlg.OnAudioPanValueChanged ( iValue ); }
155+
154156
void OnVersionAndOSReceived ( COSUtil::EOpSystemType, QString strVersion );
155157

156158
void OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString strVersion );

src/soundbase.cpp

+9
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::InputPan] = */ 'i',
3637
/* [EMidiCtlType::None] = */ '\0' };
3738

3839
/* Implementation *************************************************************/
@@ -399,6 +400,14 @@ void CSoundBase::ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes )
399400
emit ControllerInMuteMyself ( iValue >= 0x40 );
400401
}
401402
break;
403+
case InputPan:
404+
{
405+
// Pan levels need to be symmetric between 1 and 127
406+
const int iInputPanValue = static_cast<int> ( static_cast<double> ( qMax ( iValue, 1 ) - 1 ) / 126 * AUD_MIX_PAN_MAX );
407+
408+
emit ControllerInInputPanValue ( iInputPanValue );
409+
}
410+
break;
402411
default:
403412
break;
404413
}

src/soundbase.h

+2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ enum EMidiCtlType
4949
Solo,
5050
Mute,
5151
MuteMyself,
52+
InputPan,
5253
None
5354
};
5455

@@ -173,4 +174,5 @@ class CSoundBase : public QThread
173174
void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
174175
void ControllerInFaderIsMute ( int iChannelIdx, bool bIsMute );
175176
void ControllerInMuteMyself ( bool bMute );
177+
void ControllerInInputPanValue ( int iValue );
176178
};

0 commit comments

Comments
 (0)