Started with DMusic, but latency is killing me.

Started by
11 comments, last by Roof Top Pew Wee 20 years, 11 months ago
I''m pretty new with sound, so forgive me for asking stupid questions. Last week I went through the tutorial in the SDK and set up a DMusic wrapper class that seems to work fine. . . well, it did until I put it to the test. I threw together a short demo with an airplane shooting bullets, and I found that the sound would play around half of a second too late. I''ve read that DMusic had some latency problems, but Microsoft also claimed to have addressed this problem for DX9. So basically my question is: Is there any way to overcome this latency problem in DMusic? If not, what is the purpose of DMusic, at least, in any situation where you''d need sounds to be timed to an event, which is most of the time, I''m guessing. DSound seems like it''s the only way to go, but then again, DMusic has some functionality not available to DSound. Any direction would be great on this subject. Thanks all, --Vic-- The future of 2D game development: Flat Red Ball
Advertisement
Couple things:
1) Make sure that you are SETTING the latency to it''s lowest value. This is documented in the SDK and isn''t hard. By default, it is higher than you''d want it for sound effects.
2) You can always use DirectSound and DirectMusic together... for example simply use DirectMusic to play the music and DirectSound to play the effects. This system works remarkably well, although it''s more difficult to set up (check out IDirectMusicPerformance::InitAudio).
I will look into the setting for latency. I am also wondering if it would even be worth it to use DMusic. I am planning on making a game where things will happen to the music. And the events will need to be very accurate. For this reason, wouldn''t it be worth it to do everything with DSound?


--Vic--

The future of 2D game development:
Flat Red Ball
i suggest using FMOD, if you''re looking for a powerful and easy-to-use library. Or, if you have a bunch of time, make your own library :-D. Thats all the advice I can give you, sorry.
I eat heart attacks
Well I dunno... when you are using dynamic music, changes normally have to be aligned at least to the "beat" level, which means that latency is no longer an issue.

What kinds of things were you thinking of?
Well, I want to make one of my next games (Planes 2) a very new type of game. It is going to be more of an interactive music video. Things will happen to the beat as you have suggested. But the issue is how do I know when the music really starts? I mean, I could tell it to start, but it might start 400 milliseconds later. How would I know for sure? And also, what do I do when the song is nearing the end.

Tell me about FMOD. I''m interested in hearing about it.


--Vic--

The future of 2D game development:
Flat Red Ball
Don''t try to time it yourself! Use DirectMusic notify messages... they can be set up to call a predefined call-back on beats/measures/starts/ends, practically whatever you want! This is definitely the way to go and it solves all of your problems nicely.
But wav files don''t have any kind of internal timing methods. On the other hand, there are programs that I can use to find the BPM (I''m using techno/trance songs). So I could time things that way, I''m guessing.

--Vic--
Well if you''re ONLY using WAV files, I''d suggest using DirectSound exclusively anyways (which will give you almost no latency), and forget about DirectMusic (and performances, loaders, etc).
Well, that''s the answer I was looking for. Thanks.

--Vic--

This topic is closed to new replies.

Advertisement