Skip to main content
gamedev.net
🔒 Locked

Win32 : GetMessage

Started by GroZZleR Mar 10, 2004 at 9:19 AM 2 replies 500+ views
Original Post
GroZZleR
GroZZleR
Mornin'' all, I''ve got a small problem with my application. I''m writing an MP3 / Audio player and I''m facing a small problem with using GetMessage. The problem is, if I use GetMessage instead of PeekMessage, my time slider fails to update (as its waiting for a message that may not be coming). My alternative is to use PeekMessage logically, but this would increase the CPU usage of my application dramatically (as I''d constantly be updating instead of just delaying until a message arrives). What alternatives can I use to keep my GetMessage (and thus, low CPU usage) but keep my time slider constantly updating (as the song continues). Any solutions welcome =)
Agony
Agony
Try using PeekMessage, but after handling a message, or after updating your sliding, or, well, anywhere in your loop, call Sleep(n), where n represents the number of milliseconds to let other threads and processes do stuff. Probably something like Sleep(10) to Sleep(100) would be okay.


int main() { return *((int*)0); }
"We should have a great fewer disputes in the world if words were taken for what they are, the signs of our ideas nly, and not for things themselves." - John Locke o
SoDdit
SoDdit
you could also try SetTimer which posts a WM_TIMER message to the WindowProc which will allow you to update the slider at regular intervals.

PS: what mp3 decoding lib are you using?
i is 1337
GroZZleR
GroZZleR
Oh I didn''t even think of a Windows timer, thats why I come to GD =)

I''m using DirectShow for my audio processing.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.