Check out and contribute to CodePedia, the wiki for developers.

C/C++ Windows API

Moderators: Lundin
Number of threads: 382
Number of posts: 1110

This Forum Only
Post New Thread

Report
General Recording/Playback Problem under Windows7 Posted by Der_Wanderer on 27 Nov 2009 at 5:56 AM
I have a strange problem when doing recording and playback of audio at the same time under Windows7.

The problem can be described as follows:

The Win32 API knows a waveIn and a waveOut unit.
All functions that make some noise (e.g. PlaySound)
come sooner or later down to use the waveOut unit,
while all functions that do recording use at the lower end
the waveIn unit.

The problem I have is, that if the waveIn and the
waveOut unit run at the same time AND are operated
from different threads, the waveOut unit gets 
occasionally blocked (e.g. hangs within the PlaySound() call) if at the same time the waveIn unit operates (means I am processing WIM_DATA Messages and do waveInUnprepare=>something=>waveInPrepare=>waveInAddBuffer). 
This happens on ALL Windows7 machines and ALL soundcards, so it is NOT hardware or driver related. WindowsXP and Vista are working fine with the very same executable.

Speculation:
This problem is new in Windows7. Looks like they removed
some semaphore protection or something from winmm.dll.
However, it is too easy to point into Microsofts' direction.
I haven't found anything about this problem in the Internet,
where plenty of complains must arise if this is a bug in 
Microsofts' winmm.dll code.
So i guess I must do something wrong on my end.
Do I need to put the code executed on WIM_DATA into a critical section and do the same for any PlaySound Call?

Any help or hint is very appreciated!





 
Popular resources and forums for programmers on Programmersheaven.com
Assembly, Basic, C, C#, C++, Delphi, Java, JavaScript, Pascal, Perl, PHP, Python, Ruby, Visual Basic
© Copyright 2009 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Publisher: Lars Hagelin. Read the latest words from the publisher here.
Be the first to sign up for Lars Hagelin’s In-depth Outsourcing Newsletter here.
bootstrapLabs Logo A BootstrapLabs project.