diff --git a/Source/Examples/OpenAL/Playback.cs b/Source/Examples/OpenAL/Playback.cs index 48f940f1..48798ae7 100644 --- a/Source/Examples/OpenAL/Playback.cs +++ b/Source/Examples/OpenAL/Playback.cs @@ -14,17 +14,17 @@ using OpenTK.Audio; namespace Examples { [Example("Playback", ExampleCategory.OpenAL)] - public partial class Playback + public class Playback { + const string filename = "Data\\Audio\\the_ring_that_fell.wav"; + public static void Main() { - const string file = "Data\\Audio\\the_ring_that_fell.wav"; - AudioContext context = new AudioContext(); - using (SoundReader sound = new SoundReader(file)) + using (SoundReader sound = new SoundReader(filename)) { - Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", file); + Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename); int buffer = AL.GenBuffer(); int source = AL.GenSource(); @@ -54,61 +54,5 @@ namespace Examples sound.Dispose(); } } - - #region static void TestWaveReaderStreaming(string filename) - - static void TestWaveReaderStreaming(string filename) - { - using (SoundReader sound = new SoundReader(filename)) - { - int[] buffers = AL.GenBuffers(2); - int source = AL.GenSource(); - int state; - - Console.WriteLine("Testing WaveReader({0}).ReadSamples()", filename); - - Console.Write("Playing"); - - //new Thread().Start(buffers - - - - // Query the source to find out when it stops playing. - do - { - Thread.Sleep(100); - Console.Write("."); - AL.GetSource(source, ALGetSourcei.SourceState, out state); - } while ((ALSourceState)state == ALSourceState.Playing); - - Console.WriteLine(); - - AL.SourceStop(source); - AL.DeleteSources(ref source); - AL.DeleteBuffers(buffers); - - sound.Dispose(); - } - } - - class SoundStreamer - { - public SoundStreamer(SoundReader sound, int source, int[] buffers) - { - while (!sound.EndOfFile) - { - int processed_count; - AL.GetSource(source, ALGetSourcei.BuffersProcessed, out processed_count); - while (processed_count-- > 0) - { - int buffer = AL.SourceUnqueueBuffer(source); - AL.BufferData(buffer, sound.ReadSamples(8096)); - AL.SourceQueueBuffer(source, buffer); - } - } - } - } - - #endregion } }