preparation for MIDI controller audio fader level support

This commit is contained in:
Volker Fischer 2019-01-12 12:45:08 +00:00
parent deb1d075df
commit ea24503fdc
17 changed files with 115 additions and 28 deletions

View File

@ -26,8 +26,10 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ) : CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg ) void* arg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel )
{ {
} }

View File

@ -36,7 +36,9 @@
class CSound : public CSoundBase class CSound : public CSoundBase
{ {
public: public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ); CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg,
const int iCtrlMIDIChannel );
virtual ~CSound() {} virtual ~CSound() {}
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );

View File

@ -60,8 +60,10 @@
class CSound : public CSoundBase class CSound : public CSoundBase
{ {
public: public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ) : CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSoundBase ( "Jack", true, fpNewProcessCallback, arg ), iJACKBufferSizeMono ( 0 ), void* arg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel ), iJACKBufferSizeMono ( 0 ),
iJACKBufferSizeStero ( 0 ) { OpenJack(); } iJACKBufferSizeStero ( 0 ) { OpenJack(); }
virtual ~CSound() { CloseJack(); } virtual ~CSound() { CloseJack(); }
@ -85,18 +87,20 @@ protected:
void CloseJack(); void CloseJack();
// callbacks // callbacks
static int process ( jack_nframes_t nframes, void* arg ); static int process ( jack_nframes_t nframes, void* arg );
static int bufferSizeCallback ( jack_nframes_t, void *arg ); static int bufferSizeCallback ( jack_nframes_t, void *arg );
static void shutdownCallback ( void* ); static void shutdownCallback ( void* );
jack_client_t* pJackClient; jack_client_t* pJackClient;
}; };
#else #else
// no sound -> dummy class definition // no sound -> dummy class definition
class CSound : public CSoundBase class CSound : public CSoundBase
{ {
public: public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ), void* pParg ) : CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg ) {} void* pParg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg, iCtrlMIDIChannel ) {}
virtual ~CSound() {} virtual ~CSound() {}
}; };
#endif // WITH_SOUND #endif // WITH_SOUND

View File

@ -26,8 +26,10 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ) : CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
CSoundBase ( "CoreAudio", true, fpNewProcessCallback, arg ) void* arg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "CoreAudio", true, fpNewProcessCallback, arg, iCtrlMIDIChannel )
{ {
// Apple Mailing Lists: Subject: GUI Apps should set kAudioHardwarePropertyRunLoop // Apple Mailing Lists: Subject: GUI Apps should set kAudioHardwarePropertyRunLoop
// in the HAL, From: Jeff Moore, Date: Fri, 6 Dec 2002 // in the HAL, From: Jeff Moore, Date: Fri, 6 Dec 2002

View File

@ -26,6 +26,7 @@
#define _SOUND_H__9518A621345F78_363456876UZGSDF82CF549__INCLUDED_ #define _SOUND_H__9518A621345F78_363456876UZGSDF82CF549__INCLUDED_
#include <CoreAudio/CoreAudio.h> #include <CoreAudio/CoreAudio.h>
#include <CoreMIDI/CoreMIDI.h>
#include <QMutex> #include <QMutex>
#include "soundbase.h" #include "soundbase.h"
#include "global.h" #include "global.h"
@ -35,7 +36,9 @@
class CSound : public CSoundBase class CSound : public CSoundBase
{ {
public: public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ); CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg,
const int iCtrlMIDIChannel );
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start(); virtual void Start();

View File

@ -669,6 +669,19 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
emit NumClientsChanged ( iNumConnectedClients ); emit NumClientsChanged ( iNumConnectedClients );
} }
void CAudioMixerBoard::SetFaderLevel ( const int iChannelIdx,
const double dValue )
{
// only apply new fader level if channel index is valid and the fader is visible
if ( ( iChannelIdx >= 0 ) && ( iChannelIdx < MAX_NUM_CHANNELS ) )
{
if ( vecpChanFader[iChannelIdx]->IsVisible() )
{
vecpChanFader[iChannelIdx]->SetFaderLevel ( dValue );
}
}
}
void CAudioMixerBoard::UpdateSoloStates() void CAudioMixerBoard::UpdateSoloStates()
{ {
// first check if any channel has a solo state active // first check if any channel has a solo state active

View File

@ -102,6 +102,9 @@ public:
void SetServerName ( const QString& strNewServerName ); void SetServerName ( const QString& strNewServerName );
void SetGUIDesign ( const EGUIDesign eNewDesign ); void SetGUIDesign ( const EGUIDesign eNewDesign );
void SetFaderLevel ( const int iChannelIdx,
const double dValue );
// settings // settings
CVector<QString> vecStoredFaderTags; CVector<QString> vecStoredFaderTags;
CVector<int> vecStoredFaderLevels; CVector<int> vecStoredFaderLevels;
@ -115,7 +118,8 @@ protected:
void StoreFaderSettings ( CChannelFader* pChanFader ); void StoreFaderSettings ( CChannelFader* pChanFader );
void UpdateSoloStates(); void UpdateSoloStates();
void OnGainValueChanged ( const int iChannelIdx, const double dValue ); void OnGainValueChanged ( const int iChannelIdx,
const double dValue );
CVector<CChannelFader*> vecpChanFader; CVector<CChannelFader*> vecpChanFader;
QHBoxLayout* pMainLayout; QHBoxLayout* pMainLayout;

View File

@ -27,7 +27,8 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CClient::CClient ( const quint16 iPortNumber, CClient::CClient ( const quint16 iPortNumber,
const QString& strConnOnStartupAddress ) : const QString& strConnOnStartupAddress,
const int iCtrlMIDIChannel ) :
vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ), vstrIPAddress ( MAX_NUM_SERVER_ADDR_ITEMS, "" ),
ChannelInfo (), ChannelInfo (),
vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ), vecStoredFaderTags ( MAX_NUM_STORED_FADER_SETTINGS, "" ),
@ -50,7 +51,7 @@ CClient::CClient ( const quint16 iPortNumber,
eAudioChannelConf ( CC_MONO ), eAudioChannelConf ( CC_MONO ),
bIsInitializationPhase ( true ), bIsInitializationPhase ( true ),
Socket ( &Channel, iPortNumber ), Socket ( &Channel, iPortNumber ),
Sound ( AudioCallback, this ), Sound ( AudioCallback, this, iCtrlMIDIChannel ),
iAudioInFader ( AUD_FADER_IN_MIDDLE ), iAudioInFader ( AUD_FADER_IN_MIDDLE ),
bReverbOnLeftChan ( false ), bReverbOnLeftChan ( false ),
iReverbLevel ( 0 ), iReverbLevel ( 0 ),
@ -196,6 +197,10 @@ CClient::CClient ( const quint16 iPortNumber,
QObject::connect ( &Sound, SIGNAL ( ReinitRequest ( int ) ), QObject::connect ( &Sound, SIGNAL ( ReinitRequest ( int ) ),
this, SLOT ( OnSndCrdReinitRequest ( int ) ) ); this, SLOT ( OnSndCrdReinitRequest ( int ) ) );
QObject::connect ( &Sound,
SIGNAL ( ControllerInFaderLevel ( int, double ) ),
SIGNAL ( ControllerInFaderLevel ( int, double ) ) );
QObject::connect ( &Socket, SIGNAL ( InvalidPacketReceived ( CHostAddress ) ), QObject::connect ( &Socket, SIGNAL ( InvalidPacketReceived ( CHostAddress ) ),
this, SLOT ( OnInvalidPacketReceived ( CHostAddress ) ) ); this, SLOT ( OnInvalidPacketReceived ( CHostAddress ) ) );

View File

@ -100,7 +100,8 @@ class CClient : public QObject
public: public:
CClient ( const quint16 iPortNumber, CClient ( const quint16 iPortNumber,
const QString& strConnOnStartupAddress ); const QString& strConnOnStartupAddress,
const int iCtrlMIDIChannel );
void Start(); void Start();
void Stop(); void Stop();
@ -410,6 +411,7 @@ signals:
#endif #endif
void Disconnected(); void Disconnected();
void ControllerInFaderLevel ( int iChannelIdx, double dValue );
}; };
#endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */ #endif /* !defined ( CLIENT_HOIHGE76GEKJH98_3_43445KJIUHF1912__INCLUDED_ ) */

View File

@ -482,6 +482,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
SIGNAL ( CLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ), SIGNAL ( CLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ),
this, SLOT ( OnCLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ) ); this, SLOT ( OnCLPingTimeWithNumClientsReceived ( CHostAddress, int, int ) ) );
QObject::connect ( pClient,
SIGNAL ( ControllerInFaderLevel ( int, double ) ),
this, SLOT ( OnControllerInFaderLevel ( int, double ) ) );
#ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING #ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING
QObject::connect ( pClient, QObject::connect ( pClient,
SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ), SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ),

View File

@ -134,6 +134,10 @@ public slots:
int iPingTime, int iPingTime,
int iNumClients ); int iNumClients );
void OnControllerInFaderLevel ( const int iChannelIdx,
const double dValue ) { MainMixerBoard->SetFaderLevel ( iChannelIdx,
dValue ); }
#ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING #ifdef ENABLE_CLIENT_VERSION_AND_OS_DEBUGGING
void OnCLVersionAndOSReceived ( CHostAddress InetAddr, void OnCLVersionAndOSReceived ( CHostAddress InetAddr,
COSUtil::EOpSystemType eOSType, COSUtil::EOpSystemType eOSType,

View File

@ -57,6 +57,7 @@ int main ( int argc, char** argv )
bool bShowAnalyzerConsole = false; bool bShowAnalyzerConsole = false;
bool bCentServPingServerInList = false; bool bCentServPingServerInList = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS; int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
int iCtrlMIDIChannel = INVALID_MIDI_CH;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER; quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
ELicenceType eLicenceType = LT_NO_LICENCE; ELicenceType eLicenceType = LT_NO_LICENCE;
QString strConnOnStartupAddress = ""; QString strConnOnStartupAddress = "";
@ -199,6 +200,23 @@ int main ( int argc, char** argv )
} }
// Controller MIDI channel ---------------------------------------------
if ( GetNumericArgument ( tsConsole,
argc,
argv,
i,
"--ctrlmidich", // no short form
"--ctrlmidich",
0,
15,
rDbleArgument ) )
{
iCtrlMIDIChannel = static_cast<int> ( rDbleArgument );
tsConsole << "- selected controller MIDI channel: " << iCtrlMIDIChannel << endl;
continue;
}
// Use logging --------------------------------------------------------- // Use logging ---------------------------------------------------------
if ( GetStringArgument ( tsConsole, if ( GetStringArgument ( tsConsole,
argc, argc,
@ -412,7 +430,8 @@ int main ( int argc, char** argv )
// Client: // Client:
// actual client object // actual client object
CClient Client ( iPortNumber, CClient Client ( iPortNumber,
strConnOnStartupAddress ); strConnOnStartupAddress,
iCtrlMIDIChannel );
// load settings from init-file // load settings from init-file
CSettings Settings ( &Client, strIniFileName ); CSettings Settings ( &Client, strIniFileName );
@ -558,6 +577,7 @@ QString UsageArguments ( char **argv )
" -y, --history enable connection history and set file\n" " -y, --history enable connection history and set file\n"
" name (server only)\n" " name (server only)\n"
" -z, --startminimized start minimizied (server only)\n" " -z, --startminimized start minimizied (server only)\n"
" --ctrlmidich MIDI controller channel to listen (client only)"
"\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n"; "\nExample: " + QString ( argv[0] ) + " -l -inifile myinifile.ini\n";
} }

View File

@ -27,9 +27,10 @@
/* Implementation *************************************************************/ /* Implementation *************************************************************/
CSoundBase::CSoundBase ( const QString& strNewSystemDriverTechniqueName, CSoundBase::CSoundBase ( const QString& strNewSystemDriverTechniqueName,
const bool bNewIsCallbackAudioInterface, const bool bNewIsCallbackAudioInterface,
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ), void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
void* pParg ) : void* pParg,
const int iCtrlMIDIChannel ) :
fpProcessCallback ( fpNewProcessCallback ), fpProcessCallback ( fpNewProcessCallback ),
pProcessCallbackArg ( pParg ), bRun ( false ), pProcessCallbackArg ( pParg ), bRun ( false ),
bIsCallbackAudioInterface ( bNewIsCallbackAudioInterface ), bIsCallbackAudioInterface ( bNewIsCallbackAudioInterface ),
@ -96,6 +97,15 @@ void CSoundBase::run()
} }
} }
void CSoundBase::ParseMIDIMessage ( const CVector<int8_t>& vMIDIPaketBytes )
{
// TODO
int iChannelIdx = 0;
double dFaderLevel = 0;
EmitControllerInFaderLevel ( iChannelIdx, dFaderLevel );
}
/******************************************************************************\ /******************************************************************************\
* Device handling * * Device handling *

View File

@ -49,9 +49,10 @@ class CSoundBase : public QThread
public: public:
CSoundBase ( const QString& strNewSystemDriverTechniqueName, CSoundBase ( const QString& strNewSystemDriverTechniqueName,
const bool bNewIsCallbackAudioInterface, const bool bNewIsCallbackAudioInterface,
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ), void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
void* pParg ); void* pParg,
const int iCtrlMIDIChannel );
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start(); virtual void Start();
@ -88,6 +89,9 @@ public:
void EmitReinitRequestSignal ( const ESndCrdResetType eSndCrdResetType ) void EmitReinitRequestSignal ( const ESndCrdResetType eSndCrdResetType )
{ emit ReinitRequest ( eSndCrdResetType ); } { emit ReinitRequest ( eSndCrdResetType ); }
void EmitControllerInFaderLevel ( const int iChannelIdx,
const double dValue ) { emit ControllerInFaderLevel ( iChannelIdx, dValue ); }
protected: protected:
// driver handling // driver handling
virtual QString LoadAndInitializeDriver ( int ) { return ""; } virtual QString LoadAndInitializeDriver ( int ) { return ""; }
@ -112,6 +116,8 @@ protected:
void run(); void run();
bool bRun; bool bRun;
void ParseMIDIMessage ( const CVector<int8_t>& vMIDIPaketBytes );
bool bIsCallbackAudioInterface; bool bIsCallbackAudioInterface;
QString strSystemDriverTechniqueName; QString strSystemDriverTechniqueName;
@ -123,6 +129,7 @@ protected:
signals: signals:
void ReinitRequest ( int iSndCrdResetType ); void ReinitRequest ( int iSndCrdResetType );
void ControllerInFaderLevel ( int iChannelIdx, double dValue );
}; };
#endif /* !defined ( SOUNDBASE_HOIHGEH8_3_4344456456345634565KJIUHF1912__INCLUDED_ ) */ #endif /* !defined ( SOUNDBASE_HOIHGEH8_3_4344456456345634565KJIUHF1912__INCLUDED_ ) */

View File

@ -64,6 +64,7 @@ class CClient; // forward declaration of CClient
/* Definitions ****************************************************************/ /* Definitions ****************************************************************/
#define METER_FLY_BACK 2 #define METER_FLY_BACK 2
#define INVALID_MIDI_CH -1 // invalid MIDI channel definition
/* Global functions ***********************************************************/ /* Global functions ***********************************************************/

View File

@ -449,8 +449,10 @@ void CSound::Stop()
} }
} }
CSound::CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), void* arg ) : CSound::CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
CSoundBase ( "ASIO", true, fpNewCallback, arg ), void* arg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "ASIO", true, fpNewCallback, arg, iCtrlMIDIChannel ),
vSelectedInputChannels ( NUM_IN_OUT_CHANNELS ), vSelectedInputChannels ( NUM_IN_OUT_CHANNELS ),
vSelectedOutputChannels ( NUM_IN_OUT_CHANNELS ), vSelectedOutputChannels ( NUM_IN_OUT_CHANNELS ),
lNumInChan ( 0 ), lNumInChan ( 0 ),

View File

@ -48,7 +48,9 @@
class CSound : public CSoundBase class CSound : public CSoundBase
{ {
public: public:
CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ), void* arg ); CSound ( void (*fpNewCallback) ( CVector<int16_t>& psData, void* arg ),
void* arg,
const int );
virtual ~CSound() { UnloadCurrentDriver(); } virtual ~CSound() { UnloadCurrentDriver(); }
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );