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 *************************************************************/
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ) :
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg )
CSound::CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "OpenSL", true, fpNewProcessCallback, arg, iCtrlMIDIChannel )
{
}

View file

@ -36,7 +36,9 @@
class CSound : public CSoundBase
{
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 int Init ( const int iNewPrefMonoBufferSize );

View file

@ -60,8 +60,10 @@
class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ), void* arg ) :
CSoundBase ( "Jack", true, fpNewProcessCallback, arg ), iJACKBufferSizeMono ( 0 ),
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* arg ),
void* arg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "Jack", true, fpNewProcessCallback, arg, iCtrlMIDIChannel ), iJACKBufferSizeMono ( 0 ),
iJACKBufferSizeStero ( 0 ) { OpenJack(); }
virtual ~CSound() { CloseJack(); }
@ -95,8 +97,10 @@ protected:
class CSound : public CSoundBase
{
public:
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ), void* pParg ) :
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg ) {}
CSound ( void (*fpNewProcessCallback) ( CVector<short>& psData, void* pParg ),
void* pParg,
const int iCtrlMIDIChannel ) :
CSoundBase ( "nosound", false, fpNewProcessCallback, pParg, iCtrlMIDIChannel ) {}
virtual ~CSound() {}
};
#endif // WITH_SOUND

View file

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

View file

@ -26,6 +26,7 @@
#define _SOUND_H__9518A621345F78_363456876UZGSDF82CF549__INCLUDED_
#include <CoreAudio/CoreAudio.h>
#include <CoreMIDI/CoreMIDI.h>
#include <QMutex>
#include "soundbase.h"
#include "global.h"
@ -35,7 +36,9 @@
class CSound : public CSoundBase
{
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 void Start();

View file

@ -669,6 +669,19 @@ void CAudioMixerBoard::ApplyNewConClientList ( CVector<CChannelInfo>& vecChanInf
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()
{
// first check if any channel has a solo state active

View file

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

View file

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

View file

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

View file

@ -482,6 +482,10 @@ CClientDlg::CClientDlg ( CClient* pNCliP,
SIGNAL ( CLPingTimeWithNumClientsReceived ( 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
QObject::connect ( pClient,
SIGNAL ( CLVersionAndOSReceived ( CHostAddress, COSUtil::EOpSystemType, QString ) ),

View file

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

View file

@ -57,6 +57,7 @@ int main ( int argc, char** argv )
bool bShowAnalyzerConsole = false;
bool bCentServPingServerInList = false;
int iNumServerChannels = DEFAULT_USED_NUM_CHANNELS;
int iCtrlMIDIChannel = INVALID_MIDI_CH;
quint16 iPortNumber = LLCON_DEFAULT_PORT_NUMBER;
ELicenceType eLicenceType = LT_NO_LICENCE;
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 ---------------------------------------------------------
if ( GetStringArgument ( tsConsole,
argc,
@ -412,7 +430,8 @@ int main ( int argc, char** argv )
// Client:
// actual client object
CClient Client ( iPortNumber,
strConnOnStartupAddress );
strConnOnStartupAddress,
iCtrlMIDIChannel );
// load settings from init-file
CSettings Settings ( &Client, strIniFileName );
@ -558,6 +577,7 @@ QString UsageArguments ( char **argv )
" -y, --history enable connection history and set file\n"
" name (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";
}

View file

@ -29,7 +29,8 @@
CSoundBase::CSoundBase ( const QString& strNewSystemDriverTechniqueName,
const bool bNewIsCallbackAudioInterface,
void (*fpNewProcessCallback) ( CVector<int16_t>& psData, void* pParg ),
void* pParg ) :
void* pParg,
const int iCtrlMIDIChannel ) :
fpProcessCallback ( fpNewProcessCallback ),
pProcessCallbackArg ( pParg ), bRun ( false ),
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 *

View file

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

View file

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

View file

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

View file

@ -48,7 +48,9 @@
class CSound : public CSoundBase
{
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 int Init ( const int iNewPrefMonoBufferSize );