Move streaming playback to its own file.

This commit is contained in:
the_fiddler 2008-04-04 20:20:33 +00:00
parent feea08d121
commit b5974951d7

View file

@ -13,7 +13,7 @@ using OpenTK.Audio;
namespace Examples namespace Examples
{ {
[Example("Playback Test", ExampleCategory.Test)] [Example("Playback", ExampleCategory.OpenAL)]
public partial class Playback public partial class Playback
{ {
public static void Main() public static void Main()
@ -22,22 +22,14 @@ namespace Examples
AudioContext context = new AudioContext(); AudioContext context = new AudioContext();
TestWaveReader(file); using (SoundReader sound = new SoundReader(file))
TestWaveReaderStreaming(file);
}
#region static void TestWaveReader(string filename)
static void TestWaveReader(string filename)
{
using (SoundReader sound = new SoundReader(filename))
{ {
Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", file);
int buffer = AL.GenBuffer(); int buffer = AL.GenBuffer();
int source = AL.GenSource(); int source = AL.GenSource();
int state; int state;
Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename);
AL.BufferData(buffer, sound.ReadToEnd()); AL.BufferData(buffer, sound.ReadToEnd());
AL.Source(source, ALSourcei.Buffer, buffer); AL.Source(source, ALSourcei.Buffer, buffer);
AL.SourcePlay(source); AL.SourcePlay(source);
@ -50,7 +42,8 @@ namespace Examples
Thread.Sleep(250); Thread.Sleep(250);
Console.Write("."); Console.Write(".");
AL.GetSource(source, ALGetSourcei.SourceState, out state); AL.GetSource(source, ALGetSourcei.SourceState, out state);
} while ((ALSourceState)state == ALSourceState.Playing); }
while ((ALSourceState)state == ALSourceState.Playing);
Console.WriteLine(); Console.WriteLine();
@ -62,8 +55,6 @@ namespace Examples
} }
} }
#endregion
#region static void TestWaveReaderStreaming(string filename) #region static void TestWaveReaderStreaming(string filename)
static void TestWaveReaderStreaming(string filename) static void TestWaveReaderStreaming(string filename)