Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <blockquote> <p>I neither want to distribute any binaries with my application nor depend on P/Invoke, as the project should run at least on Windows and Linux. I'm fine with bundling .Net assemblies as long as they are license-compatible with GPL.</p> </blockquote> <p>Unfortunatly its going to be impossible to avoid distributing binaries, or avoid P/Invoke. The .net class libraries use P/Invoke underneath anyway, the managed code has to communicate with the unmanage operating system API at some point, in order to do anything.</p> <p>Converting the OGG file to PCM should be possible in Managed code, but because there is no Native Support for Audio in .net, you really have 3 options:</p> <ol> <li><p>Call an external program to play the sound (as suggested earlier)</p></li> <li><p>P/Invoke a C module to play the sound</p></li> <li><p>P/Invoke the OS APIs to play the sound.</p></li> </ol> <p>(4.) If you're only running this code on windows you could probably just use DirectShow. </p> <p>P/Invoke can be used in a cross platform way <a href="http://www.mono-project.com/Interop_with_Native_Libraries#Library_Names" rel="nofollow noreferrer">http://www.mono-project.com/Interop_with_Native_Libraries#Library_Names</a></p> <p>Once you have your PCM data (using a OGG C Lib or Managed Code, something like this <a href="http://www.robburke.net/mle/mp3sharp/" rel="nofollow noreferrer">http://www.robburke.net/mle/mp3sharp/</a> of course there are licencing issues with MP3), you will need a way to play it, unfortunatly .net does not provide any direct assess to your sound card or methods to play streaming audio. You could convert the ogg files to PCM at startup, and then use System.Media.SoundPlayer, to play the wav files generated. The current method Microsoft suggests uses P/Invoke to access Sound playing API in the OS <a href="http://msdn.microsoft.com/en-us/library/ms229685.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms229685.aspx</a></p> <p>A cross platform API to play PCM sound is OpenAL and you should be able to play (PCM) sound using the c# bindings for OpenAL at www.taoframework.com, you will unfortunatly need to copy a number of DLL and .so files with your application in order for it to work when distributed, but this is, as i've explained earlier unavoidable.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload