diff options
author | Kurt Korbatits <kurt.korbatits@nokia.com> | 2010-04-09 02:59:47 (GMT) |
---|---|---|
committer | Kurt Korbatits <kurt.korbatits@nokia.com> | 2010-04-09 02:59:47 (GMT) |
commit | a5b4b54820b9266a2916981002e9be66fd0a7710 (patch) | |
tree | 1025927817d9a396b8cffce7ea0a8c223c052dde /src/multimedia/audio | |
parent | 0b1dd92c46c91711b31e1d4bded5cb5145ae161b (diff) | |
download | Qt-a5b4b54820b9266a2916981002e9be66fd0a7710.zip Qt-a5b4b54820b9266a2916981002e9be66fd0a7710.tar.gz Qt-a5b4b54820b9266a2916981002e9be66fd0a7710.tar.bz2 |
Just one (static) waveInCriticalSection but multiple QAudioInput to
record from different soundcards
Task-number:QTBUG-9221
Reviewed-by:Andrew den Exter
Diffstat (limited to 'src/multimedia/audio')
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.cpp | 10 | ||||
-rw-r--r-- | src/multimedia/audio/qaudioinput_win32_p.h | 2 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.cpp | 8 | ||||
-rw-r--r-- | src/multimedia/audio/qaudiooutput_win32_p.h | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/src/multimedia/audio/qaudioinput_win32_p.cpp b/src/multimedia/audio/qaudioinput_win32_p.cpp index ec0359a..bf13c43 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.cpp +++ b/src/multimedia/audio/qaudioinput_win32_p.cpp @@ -57,8 +57,6 @@ QT_BEGIN_NAMESPACE //#define DEBUG_AUDIO 1 -static CRITICAL_SECTION waveInCriticalSection; - static const int minimumIntervalTime = 50; QAudioInputPrivate::QAudioInputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -104,16 +102,16 @@ void CALLBACK QAudioInputPrivate::waveInProc( HWAVEIN hWaveIn, UINT uMsg, case WIM_OPEN: break; case WIM_DATA: - EnterCriticalSection(&waveInCriticalSection); + EnterCriticalSection(&qAudio->waveInCriticalSection); if(qAudio->waveFreeBlockCount > 0) qAudio->waveFreeBlockCount--; qAudio->feedback(); - LeaveCriticalSection(&waveInCriticalSection); + LeaveCriticalSection(&qAudio->waveInCriticalSection); break; case WIM_CLOSE: - EnterCriticalSection(&waveInCriticalSection); + EnterCriticalSection(&qAudio->waveInCriticalSection); qAudio->finished = true; - LeaveCriticalSection(&waveInCriticalSection); + LeaveCriticalSection(&qAudio->waveInCriticalSection); break; default: return; diff --git a/src/multimedia/audio/qaudioinput_win32_p.h b/src/multimedia/audio/qaudioinput_win32_p.h index d555eff..a12c75e 100644 --- a/src/multimedia/audio/qaudioinput_win32_p.h +++ b/src/multimedia/audio/qaudioinput_win32_p.h @@ -122,6 +122,8 @@ private: volatile int waveFreeBlockCount; int waveCurrentBlock; + CRITICAL_SECTION waveInCriticalSection; + static void CALLBACK waveInProc( HWAVEIN hWaveIn, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); diff --git a/src/multimedia/audio/qaudiooutput_win32_p.cpp b/src/multimedia/audio/qaudiooutput_win32_p.cpp index f3ba079..e818723 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.cpp +++ b/src/multimedia/audio/qaudiooutput_win32_p.cpp @@ -56,8 +56,6 @@ QT_BEGIN_NAMESPACE -static CRITICAL_SECTION waveOutCriticalSection; - static const int minimumIntervalTime = 50; QAudioOutputPrivate::QAudioOutputPrivate(const QByteArray &device, const QAudioFormat& audioFormat): @@ -107,16 +105,16 @@ void CALLBACK QAudioOutputPrivate::waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, case WOM_CLOSE: return; case WOM_DONE: - EnterCriticalSection(&waveOutCriticalSection); + EnterCriticalSection(&qAudio->waveOutCriticalSection); if(qAudio->finished || qAudio->buffer_size == 0 || qAudio->period_size == 0) { - LeaveCriticalSection(&waveOutCriticalSection); + LeaveCriticalSection(&qAudio->waveOutCriticalSection); return; } qAudio->waveFreeBlockCount++; if(qAudio->waveFreeBlockCount >= qAudio->buffer_size/qAudio->period_size) qAudio->waveFreeBlockCount = qAudio->buffer_size/qAudio->period_size; qAudio->feedback(); - LeaveCriticalSection(&waveOutCriticalSection); + LeaveCriticalSection(&qAudio->waveOutCriticalSection); break; default: return; diff --git a/src/multimedia/audio/qaudiooutput_win32_p.h b/src/multimedia/audio/qaudiooutput_win32_p.h index 6e0899f..a7a0b07 100644 --- a/src/multimedia/audio/qaudiooutput_win32_p.h +++ b/src/multimedia/audio/qaudiooutput_win32_p.h @@ -119,6 +119,8 @@ private: static void CALLBACK waveOutProc( HWAVEOUT hWaveOut, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2 ); + CRITICAL_SECTION waveOutCriticalSection; + WAVEHDR* allocateBlocks(int size, int count); void freeBlocks(WAVEHDR* blockArray); bool open(); |