开发者

Why do calls to waveOutGetPosition hang?

开发者 https://www.devze.com 2022-12-22 18:42 出处:网络
I\'m using the winmm.dll API method waveOutGetPosition to get the current position of the playback of a WAV file.Sometimes this works as expected for me, but eventually one of the calls never returns

I'm using the winmm.dll API method waveOutGetPosition to get the current position of the playback of a WAV file. Sometimes this works as expected for me, but eventually one of the calls never returns and my application locks up.

I found this thread with a few users who have experienced the same problem:

http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/c6a1e80e-4a18-47e7-af11-56a89f638ad7

but no solution. Has anyone run into this problem before?

Update: I was able to create a sample app that reproduces the problem reliably:

Probl开发者_开发百科em with waveOutWrite and waveOutGetPosition deadlock

Still haven't fixed it, though.


Can you lock the call up in its own thread and kill it after a determined amount of time instead of letting it hang your app? Won't really fix the problem, but it would at least allow you to continue.


The solution is to use a MessageWindow instead of a callback - the MessageWindow allows waveOutGetPosition to return successfully without deadlocking.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号