waveInPrepareHeader()/waveInAddBuffer() is not returning anything its getting struck only for motorola manufactured dekstop mics and only if the mic is not a system default mic

yugandhar saadili 1 Reputation point
2020-08-31T16:19:41.49+00:00

Hi Team,

We are using windows mmeapi's for capturing the PCM data from mic device from very long time about 5 years.
We are familial with the API's and usage and capturing the PCM data from mic with winmm API's.

We are opening the device(Motorola Desktop Microphone [v1.0.0]) with deviceID with below configurations of of WAVEFORMATEX structure nChannels(1) wBitsPerSample(16) nSamplesPerSec(16000) nBlockAlign(2) nAvgBytesPerSec(32000) cbSize (22).

Device is opening successfully and able to get the handle for the device.
Then we are allocating the memory of 640 bytes and then calling waveInPrepareHeader() and then we we are calling waveInAddBuffer() accordingly as expected by passing required arguments.

Here we are trying to allocate 7 buffer counts i.e 7 time we will be allocating memory and calling waveInPrepareHeader() and waveInAddBuffer() accordingly.

after 3/4 iterations(waveInPrepareHeader(), waveInAddBuffer) its getting struck and its not returning anything Application is getting blocked.

Note: This issue is facing only if "Motorola Desktop Microphone [v1.0.0]" Device is not a system default mic.
Same code base /application is working if the system default mic is set to "Motorola Desktop Microphone [v1.0.0]"
We are able to capture PCM mic data from the same device without any issues able to capture by opening with WAVE_MAPPER and as well as with device ID.
Only issues exists if the device "Motorola Desktop Microphone [v1.0.0]" is not a system default mic and if try to capture data from mic by opening the device with device ID.

Thanking you in Advance

Windows API - Win32
Windows API - Win32
A core set of Windows application programming interfaces (APIs) for desktop and server applications. Previously known as Win32 API.
2,455 questions
C++
C++
A high-level, general-purpose programming language, created as an extension of the C programming language, that has object-oriented, generic, and functional features in addition to facilities for low-level memory manipulation.
3,571 questions
{count} votes