XNA Creators Club Online
Page 1 of 1 (9 items)
Sort Posts: Previous Next

Audio beginner help

Last post 8/14/2009 9:01 PM by CHUNKIEluver00. 8 replies.
  • 8/11/2009 11:46 AM

    Audio beginner help

    Hey, I just had this awesome composer make some audio for my game, and now I can't even get it initialized.

    He made all the wav files and created the XACT project, and I am just trying to initialize the audio engine.

    I'm pretty sure it's a problem with the XACT rather than the code, but here is my Game.cs anyway:

    fields
     
            AudioEngine audio; 
            WaveBank SFX; 
            WaveBank music; 
            public SoundBank GameplayBank; 
            public SoundBank MenuBank; 

    initialization
     
                audio = new AudioEngine("Content\\Audio\\Trippin_Alien.xgs"); 
                SFX = new WaveBank(audio, "Content\\Audio\\SFX.xwb"); 
                music = new WaveBank(audio, "Content\\Audio\\Music.xwb"); 
                GameplayBank = new SoundBank(audio, "Content\\Audio\\Gamelay.xsb"); 
                MenuBank = new SoundBank(audio, "Content\\Audio\\Menu.xsb"); 


    When I run it, I get the ambiguous "InvalidOperationException Unhandled" error on the line where I initialize the music wavebank. The file paths are right, all the files are included in the content folder, it just won't run.

    Any and all help appreciated.
  • 8/11/2009 12:43 PM In reply to

    Re: Audio beginner help

    There's no InnerException message?
    Jim Perry - Microsoft XNA MVP
    If people spent a minute searching the forums and reading the FAQs before posting I'd be out of a job.
      Got some XNA Game Studio/XNA Framework development info to share with the community? Put it on the XNA Wiki.
        Please mark posts as Answers or Good Feedback when appropriate.
  • 8/11/2009 1:49 PM In reply to

    Re: Audio beginner help

    No, it just says "This resource could not be created."
  • 8/11/2009 2:36 PM In reply to

    Re: Audio beginner help

    If you created the Game using the base Game template, you shouldn't need the "Content\\' at that start of all of your paths. I know the MSDN samples show using that, but they've removed the line that sets the base content folder that is added by default in the Game template.

    So if you have this line in your Game class

     Content.RootDirectory = "Content";

    You'll need to remove the "Content\\" at the start of all of your file paths.
  • 8/12/2009 11:18 AM In reply to

    Re: Audio beginner help

    GameplayBank = new SoundBank(audio, "Content\\Audio\\Gamelay.xsb");

    it's not failing on this? "Gamelay" seems like a typo to me.
  • 8/14/2009 1:10 AM In reply to

    Re: Audio beginner help

    Korenn:

    it's not failing on this? "Gamelay" seems like a typo to me.


    That was a typo, thanks, but no. I fixed that and it still only fails on the music line.

    I tried removing the music initialization line from the picture altogether, and it ran fine. Then I put it back in, and it threw me the same error. Does anyone know what this could be? It is really frustrating and forcing development to a halt.
  • 8/14/2009 3:06 AM In reply to

    Re: Audio beginner help

    Have you tried rebuilding the XACT project in your machine?
    Open XACT3, open the .xap file, go to the file manu a select Build... then click on Finish.
  • 8/14/2009 4:37 AM In reply to

    Re: Audio beginner help

    XACT does not go through the content manager, so it does need the "Content" prefix.

    If your music wavebank is marked as Streaming, it has to be created/loaded using the other constructor for wavebank (which allows you to specify number of buffering sectors). I use 16 for buffering, and it works pretty well.
    Jon Watte, Direct3D MVP
    Tweets, occasionally
    kW X-port 3ds Max .X exporter
    kW Animation source code
  • 8/14/2009 9:01 PM In reply to

    Re: Audio beginner help

    Fixed! It turned out that the person who created the XACT project for me had accidentally set the Music wavebank to "streaming," and all I had to do was change it to memory and it works great. Thanks to all.
Page 1 of 1 (9 items) Previous Next