Sign in to follow this  

DirectSound and Notify

Recommended Posts

Am working on a game that is a robot/PC hybrid mix. Need some help with audio: if anyone can point me in the right direction, would appreaciate it. Would also be happy to pay for a codesample to be written: this is not really my specialty. I have to animate a robot who's mouth needs to be in synch with the speech played from a wav file. I know the exact timing in milliseconds where mouth events are to occur. I have two files, really, a wav file and a timing file. The wav contains the robots speech, the timing file tells me when to open and close the mouth to synch with speech. Presently I am playing the audio with mcicommandstring, and running a timer in the background that fires events according to the timing file...However, this technique is not reliable enough..there is too much drift. Instead, I would like to use DirectSound API to do this since I see that this API has the ability for the programmer to attach event handlers to specific locations in the audio stream. What I would like to do is ask DirectSound to play this wav file, but also tell DirectSound to fire an event whenever certain locations in the playback are encountered. For example, I'd like to tell it to play test.wav, and to fire an event to me at 23msecs, 143 msecs, 2321 msecs, and so on. I have read and searched the web...there are many discussions of this cability of DirectSound, but I have never used this API before and am not very familiar with audio programming generally. I would like sample code showing, in the simplest possible case, the setting of time-oriented events in a directsound playback buffer, and those events being fired. Ideally, I would like this sample code in .NET/C#/VB.NET (there is a managed directsound assembly) but I will take an example in any form. I am also open to entirely different APIs/tools to accomplish this. Direct sound is simply the API that seems best suited since I want this to work on 2000 and XP machines.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this