2

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.)

svick
  • 236,525
  • 50
  • 385
  • 514
Adam L. S.
  • 825
  • 1
  • 7
  • 14

1 Answers1

2

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.

A-Type
  • 1,148
  • 1
  • 7
  • 17
  • That is sad, because I was planning to port my project in C++, and so I was trying to create as few different version of the resource, as possible. But if it is really dying, that means, that in future XNA, they must be planning to add advanced logic for it. I will look in to XACT then. Thanks! – Adam L. S. Apr 16 '12 at 20:48
  • Not necessarily. They might just leave XACT as-is and simply never update it, but never add advanced audio to XNA either. It's fairly capable right now anyways. If you are going to work with DirectX when porting to C++, you may want to look into the version of XACT for vanilla DirectX. I understand that there is some portability between XNA XACT and DirectX XACT, so moving your audio integration might not be that difficult in the end. – A-Type Apr 16 '12 at 20:54
  • I'm a cross-platform freak, and I would like to port it to system, where DirectX not available, so that is not an option for me, but thanks again. :) – Adam L. S. Apr 17 '12 at 09:56
  • XNA is not very cross-platform friendly :( – A-Type Apr 17 '12 at 19:27
  • Yes, I know. That is why I will port it to C++ afterwards. But C# has a very helpful IDE, that I can plan the structure of the program. Also I would like to port it to Xbox, just for fun. (So I can tell my friend that I wrote a game for the Xbox. ;P) – Adam L. S. Apr 18 '12 at 20:29