Skip to content

Commit

Permalink
Add MIDI control for inputfader using i
Browse files Browse the repository at this point in the history
  • Loading branch information
henkdegroot committed Feb 21, 2022
1 parent 8630648 commit 6a6e8f2
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/client.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,8 @@ CClient::CClient ( const quint16 iPortNumber,

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

QObject::connect ( &Sound, &CSound::ControllerInInputPanValue, this, &CClient::OnControllerInInputPanValue );

QObject::connect ( &Socket, &CHighPrioSocket::InvalidPacketReceived, this, &CClient::OnInvalidPacketReceived );

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

void CClient::OnControllerInInputPanValue ( int iValue )
{
// in case of a headless client the panners cannot be moved so we need
// to send the controller information directly to the server
#ifdef HEADLESS
// FIXME: no idea what to do here.
//SetSliderAudioPan ( static_cast<float> ( iValue ) / AUD_MIX_PAN_MAX );
#endif

emit ControllerInInputPanValue ( iValue );
}

void CClient::OnClientIDReceived ( int iChanID )
{
// for headless mode we support to mute our own signal in the personal mix
Expand Down
2 changes: 2 additions & 0 deletions src/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ protected slots:
void OnControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
void OnControllerInFaderIsMute ( int iChannelIdx, bool bIsMute );
void OnControllerInMuteMyself ( bool bMute );
void OnControllerInInputPanValue ( int iValue );
void OnClientIDReceived ( int iChanID );

signals:
Expand Down Expand Up @@ -425,4 +426,5 @@ protected slots:
void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
void ControllerInFaderIsMute ( int iChannelIdx, bool bIsMute );
void ControllerInMuteMyself ( bool bMute );
void ControllerInInputPanValue ( int iValue );
};
2 changes: 2 additions & 0 deletions src/clientdlg.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,8 @@ CClientDlg::CClientDlg ( CClient* pNCliP,

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

QObject::connect ( pClient, &CClient::ControllerInInputPanValue, this, &CClientDlg::OnControllerInInputPanValue );

QObject::connect ( pClient, &CClient::CLChannelLevelListReceived, this, &CClientDlg::OnCLChannelLevelListReceived );

QObject::connect ( pClient, &CClient::VersionAndOSReceived, this, &CClientDlg::OnVersionAndOSReceived );
Expand Down
2 changes: 2 additions & 0 deletions src/clientdlg.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ public slots:

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

void OnControllerInInputPanValue ( const int iValue ) { ClientSettingsDlg.OnAudioPanValueChanged ( iValue ); }

void OnVersionAndOSReceived ( COSUtil::EOpSystemType, QString strVersion );

void OnCLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString strVersion );
Expand Down
9 changes: 9 additions & 0 deletions src/soundbase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ char const sMidiCtlChar[] = {
/* [EMidiCtlType::Solo] = */ 's',
/* [EMidiCtlType::Mute] = */ 'm',
/* [EMidiCtlType::MuteMyself] = */ 'o',
/* [EMidiCtlType::InputPan] = */ 'i',
/* [EMidiCtlType::None] = */ '\0' };

/* Implementation *************************************************************/
Expand Down Expand Up @@ -399,6 +400,14 @@ void CSoundBase::ParseMIDIMessage ( const CVector<uint8_t>& vMIDIPaketBytes )
emit ControllerInMuteMyself ( iValue >= 0x40 );
}
break;
case InputPan:
{
// Pan levels need to be symmetric between 1 and 127
const int iInputPanValue = static_cast<int> ( static_cast<double> ( qMax ( iValue, 1 ) - 1 ) / 126 * AUD_MIX_PAN_MAX );

emit ControllerInInputPanValue ( iInputPanValue );
}
break;
default:
break;
}
Expand Down
2 changes: 2 additions & 0 deletions src/soundbase.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ enum EMidiCtlType
Solo,
Mute,
MuteMyself,
InputPan,
None
};

Expand Down Expand Up @@ -173,4 +174,5 @@ class CSoundBase : public QThread
void ControllerInFaderIsSolo ( int iChannelIdx, bool bIsSolo );
void ControllerInFaderIsMute ( int iChannelIdx, bool bIsMute );
void ControllerInMuteMyself ( bool bMute );
void ControllerInInputPanValue ( int iValue );
};

0 comments on commit 6a6e8f2

Please sign in to comment.