From 1345eac8231be8552a2d2465ecaf798d9233f3d0 Mon Sep 17 00:00:00 2001 From: Volker Fischer Date: Sat, 20 Mar 2010 12:11:11 +0000 Subject: [PATCH] move dummy sound card device selection code in base class --- linux/sound.h | 12 ------------ mac/sound.h | 6 ------ src/soundbase.h | 7 +++++++ windows/sound.h | 32 ++++++++++++++++---------------- 4 files changed, 23 insertions(+), 34 deletions(-) diff --git a/linux/sound.h b/linux/sound.h index d277c533..c5148452 100755 --- a/linux/sound.h +++ b/linux/sound.h @@ -66,12 +66,6 @@ public: virtual void Start(); virtual void Stop(); - // not implemented yet, always return one device and default string - int GetNumDev() { return 1; } - QString GetDeviceName ( const int ) { return "wave mapper"; } - QString SetDev ( const int ) { return ""; } // dummy - int GetDev() { return 0; } - // these variables should be protected but cannot since we want // to access them from the callback function CVector vecsTmpAudioSndCrdStereo; @@ -102,12 +96,6 @@ public: CSoundBase ( false, fpNewProcessCallback, pParg ) {} virtual ~CSound() {} - // not used - int GetNumDev() { return 1; } - QString GetDeviceName ( const int ) { return "wave mapper"; } - QString SetDev ( const int ) { return ""; } // dummy - int GetDev() { return 0; } - // dummy definitions virtual int Init ( const int iNewPrefMonoBufferSize ) { return CSoundBase::Init ( iNewPrefMonoBufferSize ); } virtual bool Read ( CVector& ) { printf ( "no sound!" ); return false; } diff --git a/mac/sound.h b/mac/sound.h index 80eb3199..427eaf06 100755 --- a/mac/sound.h +++ b/mac/sound.h @@ -45,12 +45,6 @@ public: virtual void Start(); virtual void Stop(); - // not implemented yet, always return one device and default string - int GetNumDev() { return 1; } - QString GetDeviceName ( const int ) { return "CoreAudio"; } - QString SetDev ( const int ) { return ""; } // dummy - int GetDev() { return 0; } - // these variables should be protected but cannot since we want // to access them from the callback function CVector vecsTmpAudioSndCrdStereo; diff --git a/src/soundbase.h b/src/soundbase.h index 8723af30..1b323eff 100755 --- a/src/soundbase.h +++ b/src/soundbase.h @@ -46,6 +46,13 @@ public: virtual int Init ( const int iNewPrefMonoBufferSize ); virtual void Start(); virtual void Stop(); + + // dummy implementation in base class + virtual int GetNumDev() { return 1; } + virtual QString GetDeviceName ( const int ) { return "Default"; } + virtual QString SetDev ( const int ) { return ""; } + virtual int GetDev() { return 0; } + bool IsRunning() const { return bRun; } virtual void OpenDriverSetup() {} diff --git a/windows/sound.h b/windows/sound.h index 13c2b06f..63f43601 100755 --- a/windows/sound.h +++ b/windows/sound.h @@ -64,25 +64,25 @@ public: virtual void OpenDriverSetup() { ASIOControlPanel(); } // device selection - int GetNumDev() { return lNumDevs; } - QString GetDeviceName ( const int iDiD ) { return cDriverNames[iDiD]; } - QString SetDev ( const int iNewDev ); - int GetDev() { return lCurDev; } + virtual int GetNumDev() { return lNumDevs; } + virtual QString GetDeviceName ( const int iDiD ) { return cDriverNames[iDiD]; } + virtual QString SetDev ( const int iNewDev ); + virtual int GetDev() { return lCurDev; } // channel selection - int GetNumInputChannels() { return static_cast ( lNumInChan ); } - QString GetInputChannelName ( const int iDiD ) { return channelInfosInput[iDiD].name; } - void SetLeftInputChannel ( const int iNewChan ); - void SetRightInputChannel ( const int iNewChan ); - int GetLeftInputChannel() { return vSelectedInputChannels[0]; } - int GetRightInputChannel() { return vSelectedInputChannels[1]; } + int GetNumInputChannels() { return static_cast ( lNumInChan ); } + QString GetInputChannelName ( const int iDiD ) { return channelInfosInput[iDiD].name; } + void SetLeftInputChannel ( const int iNewChan ); + void SetRightInputChannel ( const int iNewChan ); + int GetLeftInputChannel() { return vSelectedInputChannels[0]; } + int GetRightInputChannel() { return vSelectedInputChannels[1]; } - int GetNumOutputChannels() { return static_cast ( lNumOutChan ); } - QString GetOutputChannelName ( const int iDiD ) { return channelInfosOutput[iDiD].name; } - void SetLeftOutputChannel ( const int iNewChan ); - void SetRightOutputChannel ( const int iNewChan ); - int GetLeftOutputChannel() { return vSelectedOutputChannels[0]; } - int GetRightOutputChannel() { return vSelectedOutputChannels[1]; } + int GetNumOutputChannels() { return static_cast ( lNumOutChan ); } + QString GetOutputChannelName ( const int iDiD ) { return channelInfosOutput[iDiD].name; } + void SetLeftOutputChannel ( const int iNewChan ); + void SetRightOutputChannel ( const int iNewChan ); + int GetLeftOutputChannel() { return vSelectedOutputChannels[0]; } + int GetRightOutputChannel() { return vSelectedOutputChannels[1]; } protected: QVector LoadAndInitializeFirstValidDriver();