Reputation: 4068
This question borders between the world of the audio designer and the programmer. While this question might have to be partially answered by that domain of an audio designer, it is sure a problem for the programmer. In our project, we want to loop a sound (background music) while the game timer is greater than one minute left. When this time is hit, we wish to stop the music as authored, and then immediately continue with ending segment. I have been looking into XACT, and it seems to have support for different events. Unfortunately, the documentation is lacking, and the application is somewhat alien to me as a programmer.
What I am looking to do is something along these lines (different approaches):
The problem is that I haven't been able to find any mechanism to auto-play sound when another sound begins and that I can't find a way to hook up with the events made in the XACT project to C#.
If this can't be done (i.e. XACT/XNA lacks support for these operations), please gather your ideas on how to solve this problem with minimal cross-sound time errors. Preferably I would be able to control this as much as possible in C# with calls to XNA.
Upvotes: 1
Views: 2757
Reputation: 4068
Here's how I did it.
Close the window and test it by playing the Cue. Also test to stop it As Authored to see if the behaviour fulfilles your expectations.
In code, Stop the Cue As Authored to get this behaviour. Immediate stops the cue without playing the sound outro. I hope this helps other people who might run into this problem in the future. The question and answer wasn't that much code oriented as I thought initially. Also, this applies for XNA 2.0. I don't know if there will be other options for controlling this kind of behaviour in XNA 3.0+.
Upvotes: 4