From 224f917a49f11b49a0b25ed949366b9bc32e9bbf Mon Sep 17 00:00:00 2001 From: the_fiddler Date: Fri, 4 Apr 2008 21:05:03 +0000 Subject: [PATCH] Added licenses. --- Source/Examples/OpenAL/StreamingPlayback.cs | 80 ++++++++++++++++++- Source/OpenTK/Audio/AudioContextException.cs | 10 ++- Source/OpenTK/Audio/AudioDeviceException.cs | 10 ++- Source/OpenTK/Audio/AudioException.cs | 10 ++- Source/OpenTK/Audio/SoundData.cs | 10 ++- Source/OpenTK/Audio/SoundFormat.cs | 10 ++- Source/Utilities/Audio/Sound.cs | 10 ++- Source/Utilities/Audio/SoundReader.cs | 10 ++- .../Utilities/Audio/SoundReaderException.cs | 10 ++- Source/Utilities/Audio/WaveReader.cs | 9 ++- 10 files changed, 158 insertions(+), 11 deletions(-) diff --git a/Source/Examples/OpenAL/StreamingPlayback.cs b/Source/Examples/OpenAL/StreamingPlayback.cs index a43b6073..4b6d87c3 100644 --- a/Source/Examples/OpenAL/StreamingPlayback.cs +++ b/Source/Examples/OpenAL/StreamingPlayback.cs @@ -1,10 +1,86 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; +using System.Threading; + +using OpenTK.Audio; namespace Examples.OpenAL { - class StreamingPlayback + [Example("Streaming Playback", ExampleCategory.OpenAL)] + public class StreamingPlayback { + const string filename = "Data\\Audio\\the_ring_that_fell.wav"; + const int buffer_size = 8096; + + static object openal_lock = new object(); + + public static void Main() + { + AudioContext context = new AudioContext(); + + 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("."); + lock (openal_lock) + { + 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) + { + lock (openal_lock) + { + 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(buffer_size)); + AL.SourceQueueBuffer(source, buffer); + } + } + } + } + } } } diff --git a/Source/OpenTK/Audio/AudioContextException.cs b/Source/OpenTK/Audio/AudioContextException.cs index 826aecf6..b9dd75cf 100644 --- a/Source/OpenTK/Audio/AudioContextException.cs +++ b/Source/OpenTK/Audio/AudioContextException.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; diff --git a/Source/OpenTK/Audio/AudioDeviceException.cs b/Source/OpenTK/Audio/AudioDeviceException.cs index 253a9457..c9d0bef8 100644 --- a/Source/OpenTK/Audio/AudioDeviceException.cs +++ b/Source/OpenTK/Audio/AudioDeviceException.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; diff --git a/Source/OpenTK/Audio/AudioException.cs b/Source/OpenTK/Audio/AudioException.cs index 17cdad62..4a5b136a 100644 --- a/Source/OpenTK/Audio/AudioException.cs +++ b/Source/OpenTK/Audio/AudioException.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; diff --git a/Source/OpenTK/Audio/SoundData.cs b/Source/OpenTK/Audio/SoundData.cs index de49e6e3..cf6963c2 100644 --- a/Source/OpenTK/Audio/SoundData.cs +++ b/Source/OpenTK/Audio/SoundData.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; diff --git a/Source/OpenTK/Audio/SoundFormat.cs b/Source/OpenTK/Audio/SoundFormat.cs index 09ff2ac9..152e2262 100644 --- a/Source/OpenTK/Audio/SoundFormat.cs +++ b/Source/OpenTK/Audio/SoundFormat.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; namespace OpenTK.Audio { diff --git a/Source/Utilities/Audio/Sound.cs b/Source/Utilities/Audio/Sound.cs index 5cb63b42..99070ab2 100644 --- a/Source/Utilities/Audio/Sound.cs +++ b/Source/Utilities/Audio/Sound.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; using System.IO; diff --git a/Source/Utilities/Audio/SoundReader.cs b/Source/Utilities/Audio/SoundReader.cs index 282773f3..73a834a4 100644 --- a/Source/Utilities/Audio/SoundReader.cs +++ b/Source/Utilities/Audio/SoundReader.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; using System.IO; diff --git a/Source/Utilities/Audio/SoundReaderException.cs b/Source/Utilities/Audio/SoundReaderException.cs index 4bb60bb5..1d2c35ac 100644 --- a/Source/Utilities/Audio/SoundReaderException.cs +++ b/Source/Utilities/Audio/SoundReaderException.cs @@ -1,4 +1,12 @@ -using System; +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + +using System; using System.Collections.Generic; using System.Text; diff --git a/Source/Utilities/Audio/WaveReader.cs b/Source/Utilities/Audio/WaveReader.cs index c3fdbf4a..953ebb59 100644 --- a/Source/Utilities/Audio/WaveReader.cs +++ b/Source/Utilities/Audio/WaveReader.cs @@ -1,4 +1,11 @@ -// created on 2/12/2008 at 5:17 PM +#region --- License --- +/* Licensed under the MIT/X11 license. + * Copyright (c) 2006-2008 the OpenTK Team. + * This notice may not be removed from any source distribution. + * See license.txt for licensing details. + */ +#endregion + using System; using System.IO;