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

Cannot Find File "SomeName.xgs" XACT

Last post 31/05/2009 21:09 by Crimshaft. 9 replies.
  • 05/01/2009 9:50

    Cannot Find File "SomeName.xgs" XACT

    Hello, I am having some issues trying to figure out the audio related stuff using XACT and I was hoping someone could help me.
    I am going through a tutorial in a beginner book and I have followed the directions correctly I believe.  My program compiles with zero errors but when I go run the file I get the following error.

    Could not find file 'C:\Users\Mars\Desktop\HDG\My Games\Apress\Tut1\Tut1\bin\x86\Debug\MySounds.xgs'.

    I have ran a search in Vista for "MySounds.xgs" to verify the path of that file and it appears to be in the correct location but at runtime I get that error. Any ideas would be most helpful as the tutorial was not real descriptive and I could have done something wrong.

    Thanks
    Joe



  • 05/01/2009 18:15 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    In your code when you're initializing the audio engine, check to see if you wrote "MySounds.xgs" or just "MySounds," if memory serves you have to write the extensions when initializing audio, which sometimes throws people off because you leave them out when using the ContentManager.
  • 05/01/2009 22:24 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    Here a c/p of the method I have initializing all the sound information.

          protected override void Initialize()
          {
             audioEngine = new AudioEngine("MySounds.xgs");
            
             //Assume the default names for the wave and sound bank.
             //To change these names, change properties in XACT.
             waveBank = new WaveBank(audioEngine, "Wave Bank.xwb");
             soundBank = new SoundBank(audioEngine, "Sound Bank.xsb");

             base.Initialize();
          }

    Here is a C/P of the exception that I am receiving.
    System.IO.FileNotFoundException was unhandled Message="Could not find file 'C:\\Users\\Mars\\Desktop\\HDG\\My Games\\Apress\\Tut1\\Tut1\\bin\\x86\\Debug\\MySounds.xgs'." Source="mscorlib" FileName="C:\\Users\\Mars\\Desktop\\HDG\\My Games\\Apress\\Tut1\\Tut1\\bin\\x86\\Debug\\MySounds.xgs"
    StackTrace:
           at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
           at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy)
           at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share)
           at System.IO.File.OpenRead(String path)
           at Microsoft.Xna.Framework.Audio.AudioEngine..ctor(String settingsFile, TimeSpan lookAheadTime, Guid rendererId)
           at Microsoft.Xna.Framework.Audio.AudioEngine..ctor(String settingsFile)
           at Tut1.Game1.Initialize() in C:\Users\Mars\Desktop\HDG\My Games\Apress\Tut1\Tut1\Game1.cs:line 33
           at Microsoft.Xna.Framework.Game.Run()
           at Tut1.Program.Main(String[] args) in C:\Users\Mars\Desktop\HDG\My Games\Apress\Tut1\Tut1\Program.cs:line 14

    I just removed the extension to test and added it back both ways give me errors.
    Joe


  • 05/01/2009 23:48 In reply to
    • (34)
    • premium membership
    • Posts 57

    Re: Cannot Find File "SomeName.xgs" XACT

    MrLeebo is right, remove the extension from your code and you'll be fine.


    Change this:
             audioEngine = new AudioEngine("MySounds.xgs");

    To this:
             audioEngine = new AudioEngine("MySounds");

    Oh, nm. I missed the end of your post.

    Do you have a folder that contains these sound files in the solution explorer?

    If so, you might want to add that.

    e.g. :

             audioEngine = new AudioEngine("SomeFolder\\MySounds.xgs");





    ____________________________________________________________________________________ The question is simple, but the answer is not.
  • 06/01/2009 0:35 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    Well I removed all the original stuff and I'm trying again. The problem is my tutorial for XACT doesn't tell me where I should save the stuff. So I saved it inside of a folder not related to the program called Sounds on my Desktop then right clicked on the "content" item in the solution explorer went to add existing item, and chose it from my desktop. However in order for XACT to work you have to click on File->New Project->Give it a name and choose where you want to save it. Then go in and insert the wave bank/wav files/sound bank/etc. But where do I put it to start with?
    Thanks
    joe
     
  • 06/01/2009 1:35 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    I managed to get it working I just had to manually edit some of the path information inside the actual .xap file while inside of visual studio. The other thing that was causing issues and I'm not entirely sure why but when it created the .xgs/.xwb/.xsb files it put it in C:\...\bin\x86\Debug\Content instead of C:\...\bin\x86\Debug so I copied the files into that folder as well, perhaps it is supposed to be looking in the content folder but I have not changed any of my setting in Visual Studio so I'm not sure why it would be looking in just the debug folder and not the debug\content folder. Either way it is working and hopefully by experimenting more with these tutorials I'll actually understand what it was that I did wrong. However I would just like to thank you guys for your help.
    Thanks
    Joe

  • 29/05/2009 16:43 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    I wonder, did you end up fixing this problem?  I have the exact same kind of issue which really frustrate me.  Same problem, it all works in theory in the books/tutorials, but never in practice.  I have to really mess around with all the code and re-edit stuff just to get my files found. 

    I don't understand why such the hassal.


  • 31/05/2009 1:18 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    The file paths for the audio files are weird, just another quirk of using the XACT tool.  You have to put all of your audio files in sub directories of the XACT project file (otherwise they won't be found), and when loading the wave banks and sound banks you need to specify the 'Content' directory/folder.

          mAudioEngine = new AudioEngine("Content/WhatTheAudio.xgs"); 
          mWaveBank = new WaveBank(mAudioEngine, "Content/Wave Bank.xwb"); 
          mSoundBank = new SoundBank(mAudioEngine, "Content/Sound Bank.xsb"); 
     

    Even though you specify your Content.RootDirectory setting in the Game object, the audio stuff ignores those settings for some reason.  Just put your .xap file into the root of your content project, and specify the Content directory as above and it should work.
  • 31/05/2009 4:21 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    I've tried all that.. in fact I did that from the start, and no it doesn't work.  I just don't know why we are getting this bug.

    Someone told me it may be due to the default of Visual C# because it creates such deep directories, and that there is a 255 character limit on file name sizes or something. 


  • 31/05/2009 21:09 In reply to

    Re: Cannot Find File "SomeName.xgs" XACT

    Hi I have had the same problem. According to all the tutorials and info there were to read I did it right but it just didn't work. So in the end in pure furiousy I just reinstalled visual c#. wrote the exact same things as I did before and, vioala, it worked!!!
    Just a note; I don't put everything in the Content folder but it works anyway, but I do have all the music in the same folder as the xact project file, haven't tried otherwise. Don't know if it is because i'm using torque but then i just put everything in the data folder and write _audioEngine = new AudioEngine("data\\music\\ music.xgs");
Page 1 of 1 (10 items) Previous Next