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

Loading Songs from a ContentManager that is using streams

Last post 05-08-2008 12:39 PM by Shawn Hargreaves. 6 replies.
  • 05-07-2008 8:18 PM

    Loading Songs from a ContentManager that is using streams

    How do I load a Song when my ContentManager is using a single file containing all the content? Right now the content pipeline outputs a .xnb file and a .wma file, but if I have everything in one file this does not work...
  • 05-07-2008 9:04 PM In reply to

    Re: Loading Songs from a ContentManager that is using streams

    How do you have a single file containing all of the content?
  • 05-07-2008 10:20 PM In reply to

    Re: Loading Songs from a ContentManager that is using streams

    I combine all my .xnb files into a single zipped archive
  • 05-07-2008 10:33 PM In reply to

    Re: Loading Songs from a ContentManager that is using streams

    How were you previously loading content from there? Did you make a custom ContentManager class to stream them out? If you check out EasyZip (in my signature) it has a ZipContentManager that will read .XNB files out of a ZIP file no problem. I haven't tested it with the new 3.0 CTP, but it might work for you.
  • 05-07-2008 10:36 PM In reply to

    Re: Loading Songs from a ContentManager that is using streams

    I am using a custom content manager that pulls the data out using streams (probably similar to your easyzip code). I will do some tests, but my guess is that it is hardcoded to look for a matching .wma file in the directory...
  • 05-07-2008 10:54 PM In reply to

    Re: Loading Songs from a ContentManager that is using streams

    Using reflector and examining the SongProcessor class it does indeed seem that a matching .wma file must exist in the directory.

    Question for anyone on the XNA team - why is the .wma data in a separate file? Could the .wma data also be part of the .xnb file? Is there a workaround that could allow the .wma file to be loaded from a user defined stream instead of a file?

    *Edit - Using reflector and looking at the MediaPlayer class it's just hooking into windows media player to play the file, so my guess is that it will be unlikely to be able to provide a custom stream to play.

  • 05-08-2008 12:39 PM In reply to

    Re: Loading Songs from a ContentManager that is using streams

    Song data is streamed from disk in the background, so you cannot compress this or embed it inside another file (that's why we sit the .wma data alongside the .xnb, rather than merging them together).

    Just don't put the song bodies inside your archive file and all will be well.
    XNA Framework Developer - blog - homepage
Page 1 of 1 (7 items) Previous Next