Adam L. S.
Adam L. S.

Reputation: 935

XNA Music mixing real-time

I've created a "format" to store segments of music (prelude part, repeated part, ending part) and time information for these segments (offset, scored length) so I can mix it up in real-time as if it were one piece of music, while repeating the repeated part (optionally) indefinitely. This way, the segments can store decay where the next segment is played, while the previous one is finished. (I've created a player for this in Java, and used the Clip class.)

I wanted this format, so I can provide a finite length music (for a jukebox feature), while I play infinite length music in-games.

However, when I wanted to code a class in XNA that manages this "format" I've noticed, that there is no obvious way to play "Songs" simultaneously/overlapped. How can I do this/what is the best practice, not leaving the XNA framework? (I don't want to create infinite play-lists.)

Upvotes: 2

Views: 443

Answers (1)

A-Type
A-Type

Reputation: 1148

You probably want to look into XACT. It should have come installed with your copy of XNA. XACT is auditioning software which lets you set up some logic for audio in your game. It integrates basically seamlessly with XNA. I think if you look into some advanced features of XACT you may be able to get it to do what you need. It's very powerful, but with a learning curve.

Outside of XACT you'll have a much harder time. I can't think of any way to do it in vanilla C#/XNA code. XACT was designed to make up for this shortcoming, though, so you should use it.

As for XACT's future, I believe it is dead/dying (as in, may not be supported in the future). At least the DirectX version is. I don't think they'll abandon the idea altogether, though, because like I said-- there really isn't a comparable way I've found to manage audio in XNA with this level of control.

Upvotes: 2

Related Questions