Commit 1adae878 authored by Ghislain MARY's avatar Ghislain MARY

Do not consider the AudioClient already being initialized as an error.

parent 97ca81a1
...@@ -191,7 +191,9 @@ int MSWASAPIReader::activate() ...@@ -191,7 +191,9 @@ int MSWASAPIReader::activate()
REPORT_ERROR("Audio format not supported by the MSWASAPI audio input interface [%x]", result); REPORT_ERROR("Audio format not supported by the MSWASAPI audio input interface [%x]", result);
} }
result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, flags, requestedDuration, 0, pUsedWfx, NULL); result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, flags, requestedDuration, 0, pUsedWfx, NULL);
REPORT_ERROR("Could not initialize the MSWASAPI audio input interface [%x]", result); if ((result != S_OK) && (result != AUDCLNT_E_ALREADY_INITIALIZED)) {
REPORT_ERROR("Could not initialize the MSWASAPI audio input interface [%x]", result);
}
result = mAudioClient->GetBufferSize(&mBufferFrameCount); result = mAudioClient->GetBufferSize(&mBufferFrameCount);
REPORT_ERROR("Could not get buffer size for the MSWASAPI audio input interface [%x]", result); REPORT_ERROR("Could not get buffer size for the MSWASAPI audio input interface [%x]", result);
ms_message("MSWASAPI audio input interface buffer size: %i", mBufferFrameCount); ms_message("MSWASAPI audio input interface buffer size: %i", mBufferFrameCount);
......
...@@ -184,7 +184,9 @@ int MSWASAPIWriter::activate() ...@@ -184,7 +184,9 @@ int MSWASAPIWriter::activate()
REPORT_ERROR("Audio format not supported by the MSWASAPI audio output interface [%x]", result); REPORT_ERROR("Audio format not supported by the MSWASAPI audio output interface [%x]", result);
} }
result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST, requestedDuration, 0, pUsedWfx, NULL); result = mAudioClient->Initialize(AUDCLNT_SHAREMODE_SHARED, AUDCLNT_STREAMFLAGS_NOPERSIST, requestedDuration, 0, pUsedWfx, NULL);
REPORT_ERROR("Could not initialize the MSWASAPI audio output interface [%x]", result); if ((result != S_OK) && (result != AUDCLNT_E_ALREADY_INITIALIZED)) {
REPORT_ERROR("Could not initialize the MSWASAPI audio output interface [%x]", result);
}
result = mAudioClient->GetBufferSize(&mBufferFrameCount); result = mAudioClient->GetBufferSize(&mBufferFrameCount);
REPORT_ERROR("Could not get buffer size for the MSWASAPI audio output interface [%x]", result); REPORT_ERROR("Could not get buffer size for the MSWASAPI audio output interface [%x]", result);
ms_message("MSWASAPI audio output interface buffer size: %i", mBufferFrameCount); ms_message("MSWASAPI audio output interface buffer size: %i", mBufferFrameCount);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment