move dummy sound card device selection code in base class

This commit is contained in:
Volker Fischer 2010-03-20 12:11:11 +00:00
parent cc6b8a85f8
commit 1345eac823
4 changed files with 23 additions and 34 deletions

View file

@ -66,12 +66,6 @@ public:
virtual void Start(); virtual void Start();
virtual void Stop(); 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 // these variables should be protected but cannot since we want
// to access them from the callback function // to access them from the callback function
CVector<short> vecsTmpAudioSndCrdStereo; CVector<short> vecsTmpAudioSndCrdStereo;
@ -102,12 +96,6 @@ public:
CSoundBase ( false, fpNewProcessCallback, pParg ) {} CSoundBase ( false, fpNewProcessCallback, pParg ) {}
virtual ~CSound() {} 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 // dummy definitions
virtual int Init ( const int iNewPrefMonoBufferSize ) { return CSoundBase::Init ( iNewPrefMonoBufferSize ); } virtual int Init ( const int iNewPrefMonoBufferSize ) { return CSoundBase::Init ( iNewPrefMonoBufferSize ); }
virtual bool Read ( CVector<short>& ) { printf ( "no sound!" ); return false; } virtual bool Read ( CVector<short>& ) { printf ( "no sound!" ); return false; }

View file

@ -45,12 +45,6 @@ public:
virtual void Start(); virtual void Start();
virtual void Stop(); 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 // these variables should be protected but cannot since we want
// to access them from the callback function // to access them from the callback function
CVector<short> vecsTmpAudioSndCrdStereo; CVector<short> vecsTmpAudioSndCrdStereo;

View file

@ -46,6 +46,13 @@ public:
virtual int Init ( const int iNewPrefMonoBufferSize ); virtual int Init ( const int iNewPrefMonoBufferSize );
virtual void Start(); virtual void Start();
virtual void Stop(); 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; } bool IsRunning() const { return bRun; }
virtual void OpenDriverSetup() {} virtual void OpenDriverSetup() {}

View file

@ -64,25 +64,25 @@ public:
virtual void OpenDriverSetup() { ASIOControlPanel(); } virtual void OpenDriverSetup() { ASIOControlPanel(); }
// device selection // device selection
int GetNumDev() { return lNumDevs; } virtual int GetNumDev() { return lNumDevs; }
QString GetDeviceName ( const int iDiD ) { return cDriverNames[iDiD]; } virtual QString GetDeviceName ( const int iDiD ) { return cDriverNames[iDiD]; }
QString SetDev ( const int iNewDev ); virtual QString SetDev ( const int iNewDev );
int GetDev() { return lCurDev; } virtual int GetDev() { return lCurDev; }
// channel selection // channel selection
int GetNumInputChannels() { return static_cast<int> ( lNumInChan ); } int GetNumInputChannels() { return static_cast<int> ( lNumInChan ); }
QString GetInputChannelName ( const int iDiD ) { return channelInfosInput[iDiD].name; } QString GetInputChannelName ( const int iDiD ) { return channelInfosInput[iDiD].name; }
void SetLeftInputChannel ( const int iNewChan ); void SetLeftInputChannel ( const int iNewChan );
void SetRightInputChannel ( const int iNewChan ); void SetRightInputChannel ( const int iNewChan );
int GetLeftInputChannel() { return vSelectedInputChannels[0]; } int GetLeftInputChannel() { return vSelectedInputChannels[0]; }
int GetRightInputChannel() { return vSelectedInputChannels[1]; } int GetRightInputChannel() { return vSelectedInputChannels[1]; }
int GetNumOutputChannels() { return static_cast<int> ( lNumOutChan ); } int GetNumOutputChannels() { return static_cast<int> ( lNumOutChan ); }
QString GetOutputChannelName ( const int iDiD ) { return channelInfosOutput[iDiD].name; } QString GetOutputChannelName ( const int iDiD ) { return channelInfosOutput[iDiD].name; }
void SetLeftOutputChannel ( const int iNewChan ); void SetLeftOutputChannel ( const int iNewChan );
void SetRightOutputChannel ( const int iNewChan ); void SetRightOutputChannel ( const int iNewChan );
int GetLeftOutputChannel() { return vSelectedOutputChannels[0]; } int GetLeftOutputChannel() { return vSelectedOutputChannels[0]; }
int GetRightOutputChannel() { return vSelectedOutputChannels[1]; } int GetRightOutputChannel() { return vSelectedOutputChannels[1]; }
protected: protected:
QVector<QString> LoadAndInitializeFirstValidDriver(); QVector<QString> LoadAndInitializeFirstValidDriver();