• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

100 Neutral

About AxPet

  • Rank
  1. For Ogg try this:[url="http://www.codeproject.com/Articles/11032/NET-Implementation-of-an-Ogg-Vorbis-Player"]http://www.codeproje...g-Vorbis-Player[/url] "What do I need to do?" Go to the link I gave you, download the source files and extract them. You'll have two directories: VS2003 and VS2005. Go to the latter and access OggPlayer Demo and pick-up the file TgPlayOgg_vorbisfile.dll and copy it in the same directory where you have the executable for your C# program. This dll file is actually a native C++ library and you'll have to import its functions in your C# application. Here is how you do it: Open the OggPlayer Sample directory, locate the file NativeMethods.cs and copy the code from it in a code file in your application. What that code does is that it imports the native functions from the dll into your managed application and now you'll be able to use them as if they are part of your code. An important note here: in order for this to work you'll have to check Allow Unsafe Code in your project's properties. Next take a look at the file OggPlayer.cs from that same directory to find out how to play streaming music. Sound effects are played by writing the decoded PCM data entirely in the sound buffer. "Also - should "sounds" (effects: rain, walking, etc) be preloaded into memory and music be streamed from the harddisk?" Sound effects are short enough and small enough even decoded into PCM that they can fit in the memory. Music, however, in decoded PCM format can be extremely large, so it has to be streamed. You can stream it either from the file located on the harddsik, or from a copy of that file loaded in a memory stream. I use the latter.
  • Advertisement