mirror of
https://github.com/Ryujinx/Opentk.git
synced 2024-12-23 16:15:34 +00:00
Moved OpenTK.OpenAL to OpenTK.Audio.
Added SoundReader class. Added OpenTK.Math.Functions.NextPowerOfTwo Fixed several AL functions, and added overloads to AL.BufferData. Added OpenAL wave playback sample.
This commit is contained in:
parent
78911ac4d4
commit
5ff51ba9fe
|
@ -187,7 +187,7 @@
|
|||
|
||||
<Files>
|
||||
<Match path="." pattern="*.cs" recurse="true"/>
|
||||
<Match path="../Examples/Data" pattern="^.*\.(png|jpg|txt|glsl)$" useRegex="true" recurse="true" buildAction="None" copyToOutput="Always"/>
|
||||
<Match path="../Examples/Data" pattern="^.*\.(png|jpg|txt|glsl|wav|ogg)$" useRegex="true" recurse="true" buildAction="None" copyToOutput="Always"/>
|
||||
<Match path="./Data" pattern="*.txt" recurse="true" buildAction="None" copyToOutput="Always"/>
|
||||
<Match path="./Data" pattern="*.glsl" recurse="true" buildAction="None" copyToOutput="Always"/>
|
||||
<Match path="../OpenTK" pattern="OpenTK.dll.config" buildAction="None" copyToOutput="Always"/>
|
||||
|
|
|
@ -38,7 +38,7 @@ class names have been altered. Please, run the following project-wide search and
|
|||
replace operations:
|
||||
1. "GLContext" -> "GraphicsContext"
|
||||
2. "OpenTK.OpenGL" -> "OpenTK.Graphics.OpenGL"
|
||||
3. "OpenTK.OpenAL" -> "OpenTK.Audio.OpenAL"
|
||||
3. "OpenTK.OpenAL" -> "OpenTK.Audio"
|
||||
4. "GL.ReadPixel" -> "GL.ReadPixels"
|
||||
|
||||
The "DisplayMode" class has been marked as obsolete. Its functionality has been
|
||||
|
|
|
@ -126,10 +126,20 @@ namespace Examples
|
|||
// Select first item
|
||||
if (listBox1.Items.Count > 0)
|
||||
this.listBox1.SelectedIndex = 0;
|
||||
|
||||
RaiseWindow();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
void RaiseWindow()
|
||||
{
|
||||
// Force the ExampleLauncher to appear.
|
||||
this.TopMost = false;
|
||||
this.TopMost = true;
|
||||
this.TopMost = false;
|
||||
}
|
||||
|
||||
#region private void RunExample()
|
||||
|
||||
private void RunExample()
|
||||
|
@ -172,8 +182,7 @@ namespace Examples
|
|||
finally
|
||||
{
|
||||
this.Visible = true;
|
||||
this.TopMost = true; // Bring the ExampleLauncher window to front
|
||||
this.TopMost = false; // but allow the user to cover it with other windows.
|
||||
RaiseWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -236,9 +245,10 @@ namespace Examples
|
|||
//FileIOPermission fileIO = new FileIOPermission(FileIOPermissionAccess.AllAccess, ".");
|
||||
//fileIO.Demand();
|
||||
|
||||
Application.EnableVisualStyles();
|
||||
Application.SetCompatibleTextRenderingDefault(true);
|
||||
using (Form exampleLauncher = new ExampleLauncher())
|
||||
{
|
||||
Application.EnableVisualStyles();
|
||||
Application.Run(exampleLauncher);
|
||||
}
|
||||
|
||||
|
|
84
Source/Examples/OpenAL/PlayStatic.cs
Normal file
84
Source/Examples/OpenAL/PlayStatic.cs
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
* Copyright (c) 2006, Creative Labs Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
|
||||
* that the following conditions are met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright notice, this list of conditions and
|
||||
* the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
||||
* and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
||||
* * Neither the name of Creative Labs Inc. nor the names of its contributors may be used to endorse or
|
||||
* promote products derived from this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
||||
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
||||
* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
|
||||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
|
||||
* TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
using OpenTK.Math;
|
||||
using OpenTK.Audio;
|
||||
|
||||
|
||||
namespace Examples
|
||||
{
|
||||
#if false
|
||||
[Example("PlayStatic Sample", ExampleCategory.OpenAL)]
|
||||
public partial class PlayStatic
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
AudioContext context = new AudioContext();
|
||||
|
||||
Sound sound = new Sound("Data\\Audio\\Asterisk.wav");
|
||||
uint buffer;
|
||||
uint source;
|
||||
int state;
|
||||
|
||||
Console.WriteLine("PlayStatic Test Application\n");
|
||||
|
||||
// Generate an AL Buffer
|
||||
AL.GenBuffers(out buffer);
|
||||
|
||||
// Load Wave file into OpenAL Buffer
|
||||
AL.BufferData(buffer, sound.ReadToEnd());
|
||||
|
||||
// Generate a Source to playback the Buffer
|
||||
AL.GenSources(out source);
|
||||
|
||||
// Attach Source to Buffer
|
||||
AL.Source(source, ALSourcei.Buffer, (int)buffer);
|
||||
|
||||
// Play Source
|
||||
AL.SourcePlay(source);
|
||||
Console.WriteLine("Playing Source ");
|
||||
|
||||
do
|
||||
{
|
||||
Thread.Sleep(100);
|
||||
Console.Write(".");
|
||||
// Get Source State
|
||||
AL.GetSource(source, ALGetSourcei.SourceState, out state);
|
||||
} while ((ALSourceState)state == ALSourceState.Playing);
|
||||
|
||||
Console.WriteLine();
|
||||
|
||||
// Clean up by deleting Source(s) and Buffer(s)
|
||||
AL.SourceStop(source);
|
||||
AL.DeleteSources(ref source);
|
||||
AL.DeleteBuffers(ref buffer);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
|
@ -1,13 +1,13 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2006-2008 the OpenTK team
|
||||
* See license.txt for licensing details
|
||||
/* 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 OpenTK.OpenAL;
|
||||
using OpenTK.OpenAL.Enums;
|
||||
using OpenTK.Audio;
|
||||
|
||||
using AlContext = System.IntPtr;
|
||||
|
@ -175,7 +175,7 @@ main (int argc, char **argv)
|
|||
/*
|
||||
|
||||
* Processing Loop Example:
|
||||
// PlaceCamera - places OpenGL camera & updates OpenAL listener data
|
||||
// PlaceCamera - places OpenGL camera & updates OpenAL listener buffer
|
||||
void AVEnvironment::PlaceCamera()
|
||||
{
|
||||
// update OpenGL camera position
|
||||
|
|
123
Source/Examples/OpenAL/TestPlayback.cs
Normal file
123
Source/Examples/OpenAL/TestPlayback.cs
Normal file
|
@ -0,0 +1,123 @@
|
|||
#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.Threading;
|
||||
|
||||
using OpenTK.Audio;
|
||||
|
||||
namespace Examples
|
||||
{
|
||||
[Example("Playback Test", ExampleCategory.Test)]
|
||||
public partial class Playback
|
||||
{
|
||||
public static void Main()
|
||||
{
|
||||
const string file = "Data\\Audio\\the_ring_that_fell.wav";
|
||||
|
||||
AudioContext context = new AudioContext();
|
||||
|
||||
TestWaveReader(file);
|
||||
TestWaveReaderStreaming(file);
|
||||
}
|
||||
|
||||
#region static void TestWaveReader(string filename)
|
||||
|
||||
static void TestWaveReader(string filename)
|
||||
{
|
||||
using (SoundReader sound = new SoundReader(filename))
|
||||
{
|
||||
int buffer = AL.GenBuffer();
|
||||
int source = AL.GenSource();
|
||||
int state;
|
||||
|
||||
Console.WriteLine("Testing WaveReader({0}).ReadToEnd()", filename);
|
||||
|
||||
AL.BufferData(buffer, sound.ReadToEnd());
|
||||
AL.Source(source, ALSourcei.Buffer, buffer);
|
||||
AL.SourcePlay(source);
|
||||
|
||||
Console.Write("Playing");
|
||||
|
||||
// Query the source to find out when it stops playing.
|
||||
do
|
||||
{
|
||||
Thread.Sleep(250);
|
||||
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(ref buffer);
|
||||
|
||||
sound.Dispose();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#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
|
||||
}
|
||||
}
|
|
@ -10,9 +10,7 @@ using System.Diagnostics;
|
|||
using OpenTK;
|
||||
using OpenTK.Graphics.OpenGL;
|
||||
using OpenTK.Graphics.OpenGL.Enums;
|
||||
using OpenTK.OpenAL;
|
||||
using OpenTK.OpenAL.Enums;
|
||||
using OpenTK.Audio;
|
||||
|
||||
using OpenTK.Input;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace Examples.Tests
|
|||
for (int i = 100000000; --i != 0; )
|
||||
;
|
||||
watch.Stop();
|
||||
Trace.WriteLine(String.Format("Noop\t\t\t\t\t\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
Trace.WriteLine(String.format("Noop\t\t\t\t\t\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
|
||||
watch.Reset();
|
||||
watch.Start();
|
||||
|
@ -45,7 +45,7 @@ namespace Examples.Tests
|
|||
res = Vector3.Add(res, a);
|
||||
watch.Stop();
|
||||
res += res; // To make sure the whole for-loop isn't optimized-out
|
||||
Trace.WriteLine(String.Format("res = Vector3.Add(a, b)\t\t\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
Trace.WriteLine(String.format("res = Vector3.Add(a, b)\t\t\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
res = Vector3.Zero;
|
||||
|
||||
watch.Reset();
|
||||
|
@ -54,7 +54,7 @@ namespace Examples.Tests
|
|||
res = res + a;
|
||||
watch.Stop();
|
||||
res += res; // To make sure the whole for-loop isn't optimized-out
|
||||
Trace.WriteLine(String.Format("res = a + b\t\t\t\t\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
Trace.WriteLine(String.format("res = a + b\t\t\t\t\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
|
||||
watch.Reset();
|
||||
watch.Start();
|
||||
|
@ -62,7 +62,7 @@ namespace Examples.Tests
|
|||
Vector3.Add(ref res, ref a, out res);
|
||||
watch.Stop();
|
||||
res += res; // To make sure the whole for-loop isn't optimized-out
|
||||
Trace.WriteLine(String.Format("Vector3.Add(ref a, ref b, out res)\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
Trace.WriteLine(String.format("Vector3.Add(ref a, ref b, out res)\t{0}ns", (watch.Elapsed.TotalSeconds / 10.0).ToString()));
|
||||
*/
|
||||
/*
|
||||
a = Vector3.UnitX;
|
||||
|
|
|
@ -24,7 +24,7 @@ namespace Examples.Tutorial
|
|||
[Example("Simple Window", ExampleCategory.Tutorial, 1)]
|
||||
public class T01_Simple_Window : GameWindow
|
||||
{
|
||||
public T01_Simple_Window() : base()
|
||||
public T01_Simple_Window() : base(640, 480, new GraphicsMode(16))
|
||||
{
|
||||
Keyboard.KeyDown += new OpenTK.Input.KeyDownEvent(Keyboard_KeyDown);
|
||||
}
|
||||
|
|
|
@ -179,7 +179,7 @@ namespace Examples.Tutorial
|
|||
GL.LoadIdentity();
|
||||
|
||||
//GL.Translate(0.7f, 1.0f, 0.0f);
|
||||
//sans.Print(String.Format("{0:f1}", RenderFrequency));
|
||||
//sans.Print(String.format("{0:f1}", RenderFrequency));
|
||||
|
||||
GL.PopMatrix();
|
||||
|
||||
|
|
|
@ -65,8 +65,8 @@ namespace Examples.Tutorial
|
|||
|
||||
// Create the Vertex Buffer Object:
|
||||
// 1) Generate the buffer handles.
|
||||
// 2) Bind the Vertex Buffer and upload your vertex data. Check that the data was uploaded correctly.
|
||||
// 3) Bind the Index Buffer and upload your index data. Check that the data was uploaded correctly.
|
||||
// 2) Bind the Vertex Buffer and upload your vertex buffer. Check that the buffer was uploaded correctly.
|
||||
// 3) Bind the Index Buffer and upload your index buffer. Check that the buffer was uploaded correctly.
|
||||
|
||||
vbo[0] = LoadVBO(cube.Vertices, cube.Indices);
|
||||
vbo[1] = LoadVBO(cube.Vertices, cube.Indices);
|
||||
|
|
|
@ -132,34 +132,34 @@ namespace Examples.Tutorial
|
|||
GL.GenBuffers(1, out color_buffer_object);
|
||||
GL.GenBuffers(1, out element_buffer_object);
|
||||
|
||||
// Upload the vertex data.
|
||||
// Upload the vertex buffer.
|
||||
GL.BindBuffer(BufferTarget.ArrayBuffer, vertex_buffer_object);
|
||||
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(shape.Vertices.Length * 3 * sizeof(float)), shape.Vertices,
|
||||
BufferUsageHint.StaticDraw);
|
||||
GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
|
||||
if (size != shape.Vertices.Length * 3 * sizeof(Single))
|
||||
throw new ApplicationException(String.Format(
|
||||
"Problem uploading vertex data to VBO (vertices). Tried to upload {0} bytes, uploaded {1}.",
|
||||
"Problem uploading vertex buffer to VBO (vertices). Tried to upload {0} bytes, uploaded {1}.",
|
||||
shape.Vertices.Length * 3 * sizeof(Single), size));
|
||||
|
||||
// Upload the color data.
|
||||
// Upload the color buffer.
|
||||
GL.BindBuffer(BufferTarget.ArrayBuffer, color_buffer_object);
|
||||
GL.BufferData(BufferTarget.ArrayBuffer, (IntPtr)(shape.Colors.Length * sizeof(int)), shape.Colors,
|
||||
BufferUsageHint.StaticDraw);
|
||||
GL.GetBufferParameter(BufferTarget.ArrayBuffer, BufferParameterName.BufferSize, out size);
|
||||
if (size != shape.Colors.Length * sizeof(int))
|
||||
throw new ApplicationException(String.Format(
|
||||
"Problem uploading vertex data to VBO (colors). Tried to upload {0} bytes, uploaded {1}.",
|
||||
"Problem uploading vertex buffer to VBO (colors). Tried to upload {0} bytes, uploaded {1}.",
|
||||
shape.Colors.Length * sizeof(int), size));
|
||||
|
||||
// Upload the index data (elements inside the vertex data, not color indices as per the IndexPointer function!)
|
||||
// Upload the index buffer (elements inside the vertex buffer, not color indices as per the IndexPointer function!)
|
||||
GL.BindBuffer(BufferTarget.ElementArrayBuffer, element_buffer_object);
|
||||
GL.BufferData(BufferTarget.ElementArrayBuffer, (IntPtr)(shape.Indices.Length * sizeof(Int32)), shape.Indices,
|
||||
BufferUsageHint.StaticDraw);
|
||||
GL.GetBufferParameter(BufferTarget.ElementArrayBuffer, BufferParameterName.BufferSize, out size);
|
||||
if (size != shape.Indices.Length * sizeof(int))
|
||||
throw new ApplicationException(String.Format(
|
||||
"Problem uploading vertex data to VBO (offsets). Tried to upload {0} bytes, uploaded {1}.",
|
||||
"Problem uploading vertex buffer to VBO (offsets). Tried to upload {0} bytes, uploaded {1}.",
|
||||
shape.Indices.Length * sizeof(int), size));
|
||||
}
|
||||
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
#region --- License ---
|
||||
/* Copyright (c) 2008 the OpenTK team
|
||||
* See license.txt for license details
|
||||
* http://www.opentk.com
|
||||
/* 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 OpenTK.OpenAL;
|
||||
using OpenTK.OpenAL.Enums;
|
||||
using System.Diagnostics;
|
||||
|
||||
using OpenTK.Audio;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -240,7 +240,8 @@ namespace OpenTK.Audio
|
|||
if (device_handle == IntPtr.Zero)
|
||||
device_handle = Alc.OpenDevice(null);
|
||||
if (device_handle == IntPtr.Zero)
|
||||
throw new AudioDeviceException("The specified audio device does not exist or is tied up by another application.");
|
||||
throw new AudioDeviceException(String.Format("Audio device '{0}' does not exist or is tied up by another application.",
|
||||
String.IsNullOrEmpty(device) ? "default" : device));
|
||||
|
||||
CheckForAlcErrors();
|
||||
|
||||
|
@ -579,22 +580,4 @@ namespace OpenTK.Audio
|
|||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region --- Exceptions ---
|
||||
|
||||
/// <summary>Represents errors related to an Audio device.</summary>
|
||||
public class AudioDeviceException : Exception
|
||||
{
|
||||
public AudioDeviceException() : base() { }
|
||||
public AudioDeviceException(string message) : base(message) { }
|
||||
}
|
||||
|
||||
/// <summary>Represents errors related to an AudioContext.</summary>
|
||||
public class AudioContextException : Exception
|
||||
{
|
||||
public AudioContextException() : base() { }
|
||||
public AudioContextException(string message) : base(message) { }
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
|
16
Source/OpenTK/Audio/AudioContextException.cs
Normal file
16
Source/OpenTK/Audio/AudioContextException.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>Represents exceptions related to an OpenTK.Audio.AudioContext.</summary>
|
||||
public class AudioContextException : Exception
|
||||
{
|
||||
/// <summary>Constructs a new AudioContextException.</summary>
|
||||
public AudioContextException() : base() { }
|
||||
/// <summary>Constructs a new AudioContextException with the specified error message.</summary>
|
||||
/// <param name="message">The error message of the AudioContextException.</param>
|
||||
public AudioContextException(string message) : base(message) { }
|
||||
}
|
||||
}
|
16
Source/OpenTK/Audio/AudioDeviceException.cs
Normal file
16
Source/OpenTK/Audio/AudioDeviceException.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>Represents exceptions related to an OpenTK.Audio device.</summary>
|
||||
public class AudioDeviceException : AudioException
|
||||
{
|
||||
/// <summary>Constructs a new AudioDeviceException.</summary>
|
||||
public AudioDeviceException() : base() { }
|
||||
/// <summary>Constructs a new AudioDeviceException with the specified error message.</summary>
|
||||
/// <param name="message">The error message of the AudioDeviceException.</param>
|
||||
public AudioDeviceException(string message) : base(message) { }
|
||||
}
|
||||
}
|
16
Source/OpenTK/Audio/AudioException.cs
Normal file
16
Source/OpenTK/Audio/AudioException.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>Represents exceptions related to the OpenTK.Audio subsystem.</summary>
|
||||
public class AudioException : Exception
|
||||
{
|
||||
/// <summary>Constructs a new AudioException.</summary>
|
||||
public AudioException() : base() { }
|
||||
/// <summary>Constructs a new AudioException with the specified error message.</summary>
|
||||
/// <param name="message">The error message of the AudioException.</param>
|
||||
public AudioException(string message) : base(message) { }
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ typedef void ALvoid;
|
|||
* void
|
||||
*/
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
// AL = Audio Library
|
||||
|
@ -82,20 +82,20 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>This function enables a feature of the OpenAL driver. There are no capabilities defined in OpenAL 1.1 to be used with this function, but it may be used by an extension.</summary>
|
||||
/// <param name="capability">The name of a capability to enable.</param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alEnable", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Enable( Enums.ALCapability capability );
|
||||
public static extern void Enable( ALCapability capability );
|
||||
//AL_API void AL_APIENTRY alEnable( ALenum capability );
|
||||
|
||||
/// <summary>This function disables a feature of the OpenAL driver.</summary>
|
||||
/// <param name="capability">The name of a capability to disable.</param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alDisable", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Disable( Enums.ALCapability capability );
|
||||
public static extern void Disable( ALCapability capability );
|
||||
// AL_API void AL_APIENTRY alDisable( ALenum capability );
|
||||
|
||||
/// <summary>This function returns a boolean indicating if a specific feature is enabled in the OpenAL driver.</summary>
|
||||
/// <param name="capability">The name of a capability to enable.</param>
|
||||
/// <returns>True if enabled, False if disabled.</returns>
|
||||
[DllImport( AL.Lib, EntryPoint = "alIsEnabled", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern bool IsEnabled( Enums.ALCapability capability );
|
||||
public static extern bool IsEnabled( ALCapability capability );
|
||||
// AL_API ALboolean AL_APIENTRY alIsEnabled( ALenum capability );
|
||||
|
||||
#endregion Renderer State management
|
||||
|
@ -103,13 +103,13 @@ namespace OpenTK.OpenAL
|
|||
#region State retrieval
|
||||
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetString", ExactSpelling = true, CallingConvention = AL.Style, CharSet = CharSet.Ansi ), SuppressUnmanagedCodeSecurity( )]
|
||||
private static extern IntPtr GetStringPrivate( Enums.ALGetString param ); // accepts the enums Enums.AlError, Enums.AlContextString
|
||||
private static extern IntPtr GetStringPrivate( ALGetString param ); // accepts the enums AlError, AlContextString
|
||||
// AL_API const ALchar* AL_APIENTRY alGetString( ALenum param );
|
||||
|
||||
/// <summary>This function retrieves an OpenAL string property.</summary>
|
||||
/// <param name="param">The property to be returned: Vendor, Version, Renderer and Extensions</param>
|
||||
/// <returns>Returns a pointer to a null-terminated string.</returns>
|
||||
public static string Get( Enums.ALGetString param )
|
||||
public static string Get( ALGetString param )
|
||||
{
|
||||
return Marshal.PtrToStringAnsi( GetStringPrivate( param ) );
|
||||
}
|
||||
|
@ -117,16 +117,16 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>This function retrieves an OpenAL string property.</summary>
|
||||
/// <param name="param">The human-readable errorstring to be returned.</param>
|
||||
/// <returns>Returns a pointer to a null-terminated string.</returns>
|
||||
public static string GetErrorString( Enums.ALError param )
|
||||
public static string GetErrorString( ALError param )
|
||||
{
|
||||
return Marshal.PtrToStringAnsi( GetStringPrivate( (Enums.ALGetString) param ) );
|
||||
return Marshal.PtrToStringAnsi( GetStringPrivate( (ALGetString) param ) );
|
||||
}
|
||||
|
||||
/* no functions return more than 1 result ..
|
||||
// AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* data );
|
||||
// AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* data );
|
||||
// AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* data );
|
||||
// AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* data );
|
||||
// AL_API void AL_APIENTRY alGetBooleanv( ALenum param, ALboolean* buffer );
|
||||
// AL_API void AL_APIENTRY alGetIntegerv( ALenum param, ALint* buffer );
|
||||
// AL_API void AL_APIENTRY alGetFloatv( ALenum param, ALfloat* buffer );
|
||||
// AL_API void AL_APIENTRY alGetDoublev( ALenum param, ALdouble* buffer );
|
||||
*/
|
||||
|
||||
/* disabled due to no token using it
|
||||
|
@ -134,7 +134,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the state to be queried: AL_DOPPLER_FACTOR, AL_SPEED_OF_SOUND, AL_DISTANCE_MODEL</param>
|
||||
/// <returns>The boolean state described by param will be returned.</returns>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetBoolean", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern bool Get( Enums.ALGetBoolean param );
|
||||
public static extern bool Get( ALGetBoolean param );
|
||||
// AL_API ALboolean AL_APIENTRY alGetBoolean( ALenum param );
|
||||
*/
|
||||
|
||||
|
@ -142,14 +142,14 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the state to be queried: DistanceModel.</param>
|
||||
/// <returns>The integer state described by param will be returned.</returns>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetInteger", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern int Get( Enums.ALGetInteger param );
|
||||
public static extern int Get( ALGetInteger param );
|
||||
// AL_API ALint AL_APIENTRY alGetInteger( ALenum param );
|
||||
|
||||
/// <summary>This function returns a floating point OpenAL state.</summary>
|
||||
/// <param name="param">the state to be queried: DopplerFactor, SpeedOfSound.</param>
|
||||
/// <returns>The floating point state described by param will be returned.</returns>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetFloat", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern float Get( Enums.ALGetFloat param );
|
||||
public static extern float Get( ALGetFloat param );
|
||||
// AL_API ALfloat AL_APIENTRY alGetFloat( ALenum param );
|
||||
|
||||
/* disabled due to no token using it
|
||||
|
@ -157,14 +157,14 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the state to be queried: AL_DOPPLER_FACTOR, AL_SPEED_OF_SOUND, AL_DISTANCE_MODEL</param>
|
||||
/// <returns>The double value described by param will be returned.</returns>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetDouble", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern double Get( Enums.ALGetDouble param );
|
||||
public static extern double Get( ALGetDouble param );
|
||||
// AL_API ALdouble AL_APIENTRY alGetDouble( ALenum param );
|
||||
*/
|
||||
|
||||
/// <summary>Error support. Obtain the most recent error generated in the AL state machine. When an error is detected by AL, a flag is set and the error code is recorded. Further errors, if they occur, do not affect this recorded code. When alGetError is called, the code is returned and the flag is cleared, so that a further error will again record its code.</summary>
|
||||
/// <returns>The first error that occured. can be used with AL.GetString. Returns an Alenum representing the error state. When an OpenAL error occurs, the error state is set and will not be changed until the error state is retrieved using alGetError. Whenever alGetError is called, the error state is cleared and the last state (the current state when the call was made) is returned. To isolate error detection to a specific portion of code, alGetError should be called before the isolated section to clear the current error state.</returns>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetError", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern Enums.ALError GetError( );
|
||||
public static extern ALError GetError( );
|
||||
// AL_API ALenum AL_APIENTRY alGetError( void );
|
||||
|
||||
#endregion State retrieval
|
||||
|
@ -212,7 +212,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to be set: ALListenerf.Gain</param>
|
||||
/// <param name="value">The float value to set the attribute to.</param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alListenerf", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Listener( Enums.ALListenerf param, float value );
|
||||
public static extern void Listener( ALListenerf param, float value );
|
||||
// AL_API void AL_APIENTRY alListenerf( ALenum param, ALfloat value );
|
||||
|
||||
/// <summary>This function sets a floating point property for the listener.</summary>
|
||||
|
@ -221,25 +221,25 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">The value to set the attribute to.</param>
|
||||
/// <param name="value3">The value to set the attribute to.</param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alListener3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Listener( Enums.ALListener3f param, float value1, float value2, float value3 );
|
||||
public static extern void Listener( ALListener3f param, float value1, float value2, float value3 );
|
||||
// AL_API void AL_APIENTRY alListener3f( ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
/// <summary>This function sets a Math.Vector3 property for the listener.</summary>
|
||||
/// <param name="param">The name of the attribute to set: ALListener3f.Position, ALListener3f.Velocity</param>
|
||||
/// <param name="values">The Math.Vector3 to set the attribute to.</param>
|
||||
public static void Listener( Enums.ALListener3f param, ref Vector3 values )
|
||||
public static void Listener( ALListener3f param, ref Vector3 values )
|
||||
{
|
||||
Listener( param, values.X, values.Y, values.Z );
|
||||
}
|
||||
|
||||
[DllImport( AL.Lib, EntryPoint = "alListenerfv", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
unsafe private static extern void ListenerPrivate( Enums.ALListenerfv param, float* values );
|
||||
unsafe private static extern void ListenerPrivate( ALListenerfv param, float* values );
|
||||
// AL_API void AL_APIENTRY alListenerfv( ALenum param, const ALfloat* values );
|
||||
|
||||
/// <summary>This function sets a floating point-vector property of the listener.</summary>
|
||||
/// <param name="param">The name of the attribute to be set: ALListener3f.Position, ALListener3f.Velocity, ALListenerfv.Orientation</param>
|
||||
/// <param name="values">Pointer to floating point-vector values.</param>
|
||||
public static void Listener( Enums.ALListenerfv param, ref float[] values )
|
||||
public static void Listener( ALListenerfv param, ref float[] values )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -254,7 +254,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to be set: ALListenerfv.Orientation</param>
|
||||
/// <param name="at">A Math.Vector3 for the At-Vector.</param>
|
||||
/// <param name="up">A Math.Vector3 for the Up-Vector.</param>
|
||||
public static void Listener( Enums.ALListenerfv param, ref Vector3 at, ref Vector3 up )
|
||||
public static void Listener( ALListenerfv param, ref Vector3 at, ref Vector3 up )
|
||||
{
|
||||
float[] temp = new float[6];
|
||||
|
||||
|
@ -288,7 +288,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the name of the attribute to be retrieved: ALListenerf.Gain</param>
|
||||
/// <param name="value">a pointer to the floating point value being retrieved.</param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetListenerf", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetListener( Enums.ALListenerf param, [Out] out float value );
|
||||
public static extern void GetListener( ALListenerf param, [Out] out float value );
|
||||
// AL_API void AL_APIENTRY alGetListenerf( ALenum param, ALfloat* value );
|
||||
|
||||
/// <summary>This function retrieves a set of three floating point values from a property of the listener.</summary>
|
||||
|
@ -297,13 +297,13 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">Pointers to the three floating point being retrieved.</param>
|
||||
/// <param name="value3">Pointers to the three floating point being retrieved.</param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alGetListener3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetListener( Enums.ALListener3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3 );
|
||||
public static extern void GetListener( ALListener3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3 );
|
||||
// AL_API void AL_APIENTRY alGetListener3f( ALenum param, ALfloat *value1, ALfloat *value2, ALfloat *value3 );
|
||||
|
||||
/// <summary>This function retrieves a Math.Vector3 from a property of the listener.</summary>
|
||||
/// <param name="param">The name of the attribute to be retrieved: ALListener3f.Position, ALListener3f.Velocity</param>
|
||||
/// <param name="values">A Math.Vector3 to hold the three floats being retrieved.</param>
|
||||
public static void GetListener( Enums.ALListener3f param, out Vector3 values )
|
||||
public static void GetListener( ALListener3f param, out Vector3 values )
|
||||
{
|
||||
GetListener( param, out values.X, out values.Y, out values.Z );
|
||||
}
|
||||
|
@ -312,14 +312,14 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the name of the attribute to be retrieved: ALListener3f.Position, ALListener3f.Velocity, ALListenerfv.Orientation</param>
|
||||
/// <param name="values">A pointer to the floating point-vector value being retrieved.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetListenerfv", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
unsafe public static extern void GetListener( Enums.ALListenerfv param, float* values );
|
||||
unsafe public static extern void GetListener( ALListenerfv param, float* values );
|
||||
// AL_API void AL_APIENTRY alGetListenerfv( ALenum param, ALfloat* values );
|
||||
|
||||
/// <summary>This function retrieves two Math.Vector3 properties of the listener.</summary>
|
||||
/// <param name="param">the name of the attribute to be retrieved: ALListenerfv.Orientation</param>
|
||||
/// <param name="at">A Math.Vector3 for the At-Vector.</param>
|
||||
/// <param name="up">A Math.Vector3 for the Up-Vector.</param>
|
||||
public static void GetListener( Enums.ALListenerfv param, out Vector3 at, out Vector3 up )
|
||||
public static void GetListener( ALListenerfv param, out Vector3 at, out Vector3 up )
|
||||
{
|
||||
float[] pinned = new float[6]; // should lose scope when the function exits
|
||||
unsafe
|
||||
|
@ -348,7 +348,7 @@ namespace OpenTK.OpenAL
|
|||
|
||||
/* Source
|
||||
* Sources represent individual sound objects in 3D-space.
|
||||
* Sources take the PCM data provided in the specified Buffer,
|
||||
* Sources take the PCM buffer provided in the specified Buffer,
|
||||
* apply Source-specific modifications, and then
|
||||
* submit them to be mixed according to spatial arrangement etc.
|
||||
*
|
||||
|
@ -394,33 +394,16 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>This function generates one or more sources. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <param name="n">The number of sources to be generated.</param>
|
||||
/// <param name="sources">Pointer to an array of uint values which will store the names of the new sources.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GenSources( int n, out uint sources )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &sources )
|
||||
{
|
||||
GenSourcesPrivate( n, (uint*) ptr );
|
||||
sources = *ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
[CLSCompliant(false)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void GenSources(int n, out uint sources);
|
||||
|
||||
/// <summary>This function generates one or more sources. References to sources are int values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <param name="n">The number of sources to be generated.</param>
|
||||
/// <param name="sources">Pointer to an array of int values which will store the names of the new sources.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GenSources( int n, out int[] sources )
|
||||
{
|
||||
uint[] temp = new uint[n];
|
||||
GenSources( n, out temp[0] );
|
||||
sources = new int[n];
|
||||
for ( int i = 0 ; i < n ; i++ )
|
||||
{
|
||||
sources[i] = (int) temp[i];
|
||||
}
|
||||
}
|
||||
[CLSCompliant(true)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alGenSources", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern void GenSources(int n, out int sources);
|
||||
|
||||
/// <summary>This function generates one or more sources. References to sources are int values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <param name="sources">Pointer to an array of int values which will store the names of the new sources.</param>
|
||||
|
@ -451,33 +434,14 @@ namespace OpenTK.OpenAL
|
|||
return sources;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>This function generates one source only. References to sources are uint values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <param name="source">Pointer to an uint value which will store the name of the new source.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GenSources( out uint source )
|
||||
{
|
||||
GenSources( 1, out source );
|
||||
}
|
||||
|
||||
/// <summary>This function generates one source only. References to sources are int values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <param name="source">Pointer to an int value which will store the name of the new source.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GenSources( out int source )
|
||||
{
|
||||
uint temp;
|
||||
GenSources( 1, out temp );
|
||||
source = (int) temp;
|
||||
}
|
||||
|
||||
/// <summary>This function generates one source only. References to sources are int values, which are used wherever a source reference is needed (in calls such as AL.DeleteSources and AL.Source with parameter ALSourcei).</summary>
|
||||
/// <returns>Pointer to an int value which will store the name of the new source.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public static int GenSources( )
|
||||
[CLSCompliant(true)]
|
||||
public static int GenSource()
|
||||
{
|
||||
uint temp;
|
||||
GenSources( 1, out temp );
|
||||
return (int) temp;
|
||||
int temp;
|
||||
GenSources(1, out temp);
|
||||
return (int)temp;
|
||||
}
|
||||
|
||||
#endregion GenSources()
|
||||
|
@ -593,7 +557,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
|
||||
/// <param name="value">The value to set the attribute to.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcef", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Source( uint sid, Enums.ALSourcef param, float value );
|
||||
public static extern void Source( uint sid, ALSourcef param, float value );
|
||||
// AL_API void AL_APIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value );
|
||||
|
||||
/// <summary>This function sets a floating point property of a source.</summary>
|
||||
|
@ -601,7 +565,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
|
||||
/// <param name="value">The value to set the attribute to.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void Source( int sid, Enums.ALSourcef param, float value )
|
||||
public static void Source( int sid, ALSourcef param, float value )
|
||||
{
|
||||
Source( (uint) sid, param, value );
|
||||
}
|
||||
|
@ -617,7 +581,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">The three ALfloat values which the attribute will be set to.</param>
|
||||
/// <param name="value3">The three ALfloat values which the attribute will be set to.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSource3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Source( uint sid, Enums.ALSource3f param, float value1, float value2, float value3 );
|
||||
public static extern void Source( uint sid, ALSource3f param, float value1, float value2, float value3 );
|
||||
// AL_API void AL_APIENTRY alSource3f( ALuint sid, ALenum param, ALfloat value1, ALfloat value2, ALfloat value3 );
|
||||
|
||||
/// <summary>This function sets a source property requiring three floating point values.</summary>
|
||||
|
@ -627,7 +591,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">The three ALfloat values which the attribute will be set to.</param>
|
||||
/// <param name="value3">The three ALfloat values which the attribute will be set to.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void Source( int sid, Enums.ALSource3f param, float value1, float value2, float value3 )
|
||||
public static void Source( int sid, ALSource3f param, float value1, float value2, float value3 )
|
||||
{
|
||||
Source( (uint) sid, param, value1, value2, value3 );
|
||||
}
|
||||
|
@ -637,7 +601,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSource3f.Position, Velocity, Direction.</param>
|
||||
/// <param name="values">A Math.Vector3 which the attribute will be set to.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void Source( uint sid, Enums.ALSource3f param, ref Vector3 values )
|
||||
public static void Source( uint sid, ALSource3f param, ref Vector3 values )
|
||||
{
|
||||
Source( sid, param, values.X, values.Y, values.Z );
|
||||
}
|
||||
|
@ -647,7 +611,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSource3f.Position, Velocity, Direction.</param>
|
||||
/// <param name="values">A Math.Vector3 which the attribute will be set to.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void Source( int sid, Enums.ALSource3f param, ref Vector3 values )
|
||||
public static void Source( int sid, ALSource3f param, ref Vector3 values )
|
||||
{
|
||||
Source( (uint) sid, param, values.X, values.Y, values.Z );
|
||||
}
|
||||
|
@ -661,7 +625,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState.</param>
|
||||
/// <param name="value">The value to set the attribute to.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourcei", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Source( uint sid, Enums.ALSourcei param, int value );
|
||||
public static extern void Source( uint sid, ALSourcei param, int value );
|
||||
// AL_API void AL_APIENTRY alSourcei( ALuint sid, ALenum param, ALint value );
|
||||
|
||||
/// <summary>This function sets an integer property of a source.</summary>
|
||||
|
@ -669,7 +633,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourcei.SourceRelative, ConeInnerAngle, ConeOuterAngle, Looping, Buffer, SourceState.</param>
|
||||
/// <param name="value">The value to set the attribute to.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void Source( int sid, Enums.ALSourcei param, int value )
|
||||
public static void Source( int sid, ALSourcei param, int value )
|
||||
{
|
||||
Source( (uint) sid, param, value );
|
||||
}
|
||||
|
@ -679,9 +643,9 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourceb.SourceRelative, Looping.</param>
|
||||
/// <param name="value">The value to set the attribute to.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void Source( uint sid, Enums.ALSourceb param, bool value )
|
||||
public static void Source( uint sid, ALSourceb param, bool value )
|
||||
{
|
||||
Source( sid, (Enums.ALSourcei) param, ( value ) ? 1 : 0 );
|
||||
Source( sid, (ALSourcei) param, ( value ) ? 1 : 0 );
|
||||
}
|
||||
|
||||
/// <summary>This function sets an bool property of a source.</summary>
|
||||
|
@ -689,9 +653,9 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourceb.SourceRelative, Looping.</param>
|
||||
/// <param name="value">The value to set the attribute to.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void Source( int sid, Enums.ALSourceb param, bool value )
|
||||
public static void Source( int sid, ALSourceb param, bool value )
|
||||
{
|
||||
Source( (uint) sid, (Enums.ALSourcei) param, ( value ) ? 1 : 0 );
|
||||
Source( (uint) sid, (ALSourcei) param, ( value ) ? 1 : 0 );
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Binds a Buffer to a Source handle.</summary>
|
||||
|
@ -700,7 +664,7 @@ namespace OpenTK.OpenAL
|
|||
[CLSCompliant( false )]
|
||||
public static void BindBufferToSource( uint source, uint buffer )
|
||||
{
|
||||
Source( source, Enums.ALSourcei.Buffer, (int) buffer );
|
||||
Source( source, ALSourcei.Buffer, (int) buffer );
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Binds a Buffer to a Source handle.</summary>
|
||||
|
@ -709,7 +673,7 @@ namespace OpenTK.OpenAL
|
|||
[CLSCompliant( true )]
|
||||
public static void BindBufferToSource( int source, int buffer )
|
||||
{
|
||||
Source( (uint) source, Enums.ALSourcei.Buffer, buffer );
|
||||
Source( (uint) source, ALSourcei.Buffer, buffer );
|
||||
}
|
||||
|
||||
#endregion Sourcei
|
||||
|
@ -723,7 +687,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">The value to set the attribute to. (EFX Extension) The Auxiliary Send number.</param>
|
||||
///<param name="value3">The value to set the attribute to. (EFX Extension) optional Filter ID.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSource3i", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void Source( uint sid, Enums.ALSource3i param, int value1, int value2, int value3 );
|
||||
public static extern void Source( uint sid, ALSource3i param, int value1, int value2, int value3 );
|
||||
// AL_API void AL_APIENTRY alSource3i( ALuint sid, ALenum param, ALint value1, ALint value2, ALint value3 );
|
||||
|
||||
/// <summary>This function sets 3 integer properties of a source. This property is used to establish connections between Sources and Auxiliary Effect Slots.</summary>
|
||||
|
@ -733,7 +697,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">The value to set the attribute to. (EFX Extension) The Auxiliary Send number.</param>
|
||||
///<param name="value3">The value to set the attribute to. (EFX Extension) optional Filter ID.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void Source( int sid, Enums.ALSource3i param, int value1, int value2, int value3 )
|
||||
public static void Source( int sid, ALSource3i param, int value1, int value2, int value3 )
|
||||
{
|
||||
Source( (uint) sid, param, value1, value2, value3 );
|
||||
}
|
||||
|
@ -755,7 +719,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
|
||||
/// <param name="value">A pointer to the floating point value being retrieved</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetSourcef", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetSource( uint sid, Enums.ALSourcef param, [Out] out float value );
|
||||
public static extern void GetSource( uint sid, ALSourcef param, [Out] out float value );
|
||||
// AL_API void AL_APIENTRY alGetSourcef( ALuint sid, ALenum param, ALfloat* value );
|
||||
|
||||
/// <summary>This function retrieves a floating point property of a source.</summary>
|
||||
|
@ -763,7 +727,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to set: ALSourcef.Pitch, Gain, MinGain, MaxGain, MaxDistance, RolloffFactor, ConeOuterGain, ConeInnerAngle, ConeOuterAngle, ReferenceDistance, EfxAirAbsorptionFactor, EfxRoomRolloffFactor, EfxConeOuterGainHighFrequency.</param>
|
||||
/// <param name="value">A pointer to the floating point value being retrieved</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GetSource( int sid, Enums.ALSourcef param, out float value )
|
||||
public static void GetSource( int sid, ALSourcef param, out float value )
|
||||
{
|
||||
GetSource( (uint) sid, param, out value );
|
||||
}
|
||||
|
@ -779,7 +743,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">Pointer to the value to retrieve.</param>
|
||||
/// <param name="value3">Pointer to the value to retrieve.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetSource3f", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetSource( uint sid, Enums.ALSource3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3 );
|
||||
public static extern void GetSource( uint sid, ALSource3f param, [Out] out float value1, [Out] out float value2, [Out] out float value3 );
|
||||
// AL_API void AL_APIENTRY alGetSource3f( ALuint sid, ALenum param, ALfloat* value1, ALfloat* value2, ALfloat* value3);
|
||||
|
||||
/// <summary>This function retrieves three floating point values representing a property of a source.</summary>
|
||||
|
@ -789,7 +753,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="value2">Pointer to the value to retrieve.</param>
|
||||
/// <param name="value3">Pointer to the value to retrieve.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GetSource( int sid, Enums.ALSource3f param, out float value1, out float value2, out float value3 )
|
||||
public static void GetSource( int sid, ALSource3f param, out float value1, out float value2, out float value3 )
|
||||
{
|
||||
GetSource( (uint) sid, param, out value1, out value2, out value3 );
|
||||
}
|
||||
|
@ -799,7 +763,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction.</param>
|
||||
/// <param name="values">A Math.Vector3 to retrieve the values to.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GetSource( uint sid, Enums.ALSource3f param, out Vector3 values )
|
||||
public static void GetSource( uint sid, ALSource3f param, out Vector3 values )
|
||||
{
|
||||
GetSource( sid, param, out values.X, out values.Y, out values.Z );
|
||||
}
|
||||
|
@ -809,7 +773,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">the name of the attribute being retrieved: ALSource3f.Position, Velocity, Direction.</param>
|
||||
/// <param name="values">A Math.Vector3 to retrieve the values to.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GetSource( int sid, Enums.ALSource3f param, out Vector3 values )
|
||||
public static void GetSource( int sid, ALSource3f param, out Vector3 values )
|
||||
{
|
||||
GetSource( (uint) sid, param, out values.X, out values.Y, out values.Z );
|
||||
}
|
||||
|
@ -823,7 +787,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed.</param>
|
||||
/// <param name="value">A pointer to the integer value being retrieved.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetSourcei", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetSource( uint sid, Enums.ALGetSourcei param, [Out] out int value );
|
||||
public static extern void GetSource( uint sid, ALGetSourcei param, [Out] out int value );
|
||||
// AL_API void AL_APIENTRY alGetSourcei( ALuint sid, ALenum param, ALint* value );
|
||||
|
||||
/// <summary>This function retrieves an integer property of a source.</summary>
|
||||
|
@ -831,7 +795,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to retrieve: ALSourcei.SourceRelative, Buffer, SourceState, BuffersQueued, BuffersProcessed.</param>
|
||||
/// <param name="value">A pointer to the integer value being retrieved.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GetSource( int sid, Enums.ALGetSourcei param, out int value )
|
||||
public static void GetSource( int sid, ALGetSourcei param, out int value )
|
||||
{
|
||||
GetSource( (uint) sid, param, out value );
|
||||
}
|
||||
|
@ -841,10 +805,10 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to get: ALSourceb.SourceRelative, Looping.</param>
|
||||
/// <param name="value">A pointer to the bool value being retrieved.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GetSource( uint sid, Enums.ALSourceb param, out bool value )
|
||||
public static void GetSource( uint sid, ALSourceb param, out bool value )
|
||||
{
|
||||
int result;
|
||||
GetSource( sid, (Enums.ALGetSourcei) param, out result );
|
||||
GetSource( sid, (ALGetSourcei) param, out result );
|
||||
if ( result == 1 )
|
||||
value = true;
|
||||
else
|
||||
|
@ -856,10 +820,10 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">The name of the attribute to get: ALSourceb.SourceRelative, Looping.</param>
|
||||
/// <param name="value">A pointer to the bool value being retrieved.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GetSource( int sid, Enums.ALSourceb param, out bool value )
|
||||
public static void GetSource( int sid, ALSourceb param, out bool value )
|
||||
{
|
||||
int result;
|
||||
GetSource( (uint) sid, (Enums.ALGetSourcei) param, out result );
|
||||
GetSource( (uint) sid, (ALGetSourcei) param, out result );
|
||||
if ( result == 1 )
|
||||
value = true;
|
||||
else
|
||||
|
@ -1233,6 +1197,14 @@ namespace OpenTK.OpenAL
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>This function queues a set of buffers on a source. All buffers attached to a source will be played in sequence, and the number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed. When first created, a source will be of type ALSourceType.Undetermined. A successful AL.SourceQueueBuffers call will change the source type to ALSourceType.Streaming.</summary>
|
||||
/// <param name="sid">The name of the source to queue buffers onto.</param>
|
||||
/// <param name="buffer">The name of the buffer to be queued.</param>
|
||||
public static void SourceQueueBuffer(int source, int buffer)
|
||||
{
|
||||
unsafe { AL.SourceQueueBuffers((uint)source, 1, (uint*)&buffer); }
|
||||
}
|
||||
|
||||
#endregion SourceQueueBuffers
|
||||
|
||||
#region SourceUnqueueBuffers
|
||||
|
@ -1241,55 +1213,58 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
/// <param name="numEntries">The number of buffers to be unqueued.</param>
|
||||
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alSourceUnqueueBuffers" ), SuppressUnmanagedCodeSecurity]
|
||||
unsafe public static extern void SourceUnqueueBuffers( uint sid, int numEntries, [In] uint* bids );
|
||||
[CLSCompliant(false), DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
|
||||
unsafe public static extern void SourceUnqueueBuffers(uint sid, int numEntries, [In] uint* bids);
|
||||
// AL_API void AL_APIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids );
|
||||
|
||||
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
|
||||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
/// <param name="numEntries">The number of buffers to be unqueued.</param>
|
||||
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void SourceUnqueueBuffers( uint sid, int numEntries, uint[] bids )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = bids )
|
||||
{
|
||||
SourceUnqueueBuffers( sid, numEntries, ptr );
|
||||
}
|
||||
}
|
||||
}
|
||||
[CLSCompliant(false)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void SourceUnqueueBuffers(uint sid, int numEntries, [Out] uint[] bids);
|
||||
|
||||
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
|
||||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
/// <param name="numEntries">The number of buffers to be unqueued.</param>
|
||||
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void SourceUnqueueBuffers( int sid, int numEntries, int[] bids )
|
||||
{
|
||||
uint[] temp = new uint[numEntries];
|
||||
for ( int i = 0 ; i < numEntries ; i++ )
|
||||
{
|
||||
temp[i] = (uint) bids[i];
|
||||
}
|
||||
SourceUnqueueBuffers( (uint) sid, numEntries, temp );
|
||||
}
|
||||
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void SourceUnqueueBuffers(int sid, int numEntries, [Out] int[] bids);
|
||||
|
||||
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
|
||||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
/// <param name="numEntries">The number of buffers to be unqueued.</param>
|
||||
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void SourceUnqueueBuffers( uint sid, int numEntries, ref uint bids )
|
||||
[CLSCompliant(false)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void SourceUnqueueBuffers(uint sid, int numEntries, ref uint bids);
|
||||
|
||||
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
|
||||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
/// <param name="numEntries">The number of buffers to be unqueued.</param>
|
||||
/// <param name="bids">A pointer to an array of buffer names that were removed.</param>
|
||||
[DllImport(AL.Lib, EntryPoint = "alSourceUnqueueBuffers"), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void SourceUnqueueBuffers(int sid, int numEntries, ref int bids);
|
||||
|
||||
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
|
||||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
public static int SourceUnqueueBuffer(int sid)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &bids )
|
||||
{
|
||||
SourceUnqueueBuffers( sid, numEntries, ptr );
|
||||
}
|
||||
}
|
||||
uint buf;
|
||||
unsafe { SourceUnqueueBuffers((uint)sid, 1, &buf); }
|
||||
return (int)buf;
|
||||
}
|
||||
|
||||
/// <summary>This function unqueues a set of buffers attached to a source. The number of processed buffers can be detected using AL.GetSource with parameter ALGetSourcei.BuffersProcessed, which is the maximum number of buffers that can be unqueued using this call. The unqueue operation will only take place if all n buffers can be removed from the queue.</summary>
|
||||
/// <param name="sid">The name of the source to unqueue buffers from.</param>
|
||||
/// <param name="numEntries">The number of buffers to be unqueued.</param>
|
||||
public static int[] SourceUnqueueBuffers(int sid, int numEntries)
|
||||
{
|
||||
if (numEntries <= 0) throw new ArgumentOutOfRangeException("numEntries", "Must be greater than zero.");
|
||||
int[] buf = new int[numEntries];
|
||||
SourceUnqueueBuffers(sid, numEntries, buf);
|
||||
return buf;
|
||||
}
|
||||
|
||||
#endregion SourceUnqueueBuffers
|
||||
|
@ -1298,7 +1273,7 @@ namespace OpenTK.OpenAL
|
|||
|
||||
/*
|
||||
* Buffer
|
||||
* Buffer objects are storage space for sample data.
|
||||
* Buffer objects are storage space for sample buffer.
|
||||
* Buffers are referred to by Sources. One Buffer can be used
|
||||
* by multiple Sources.
|
||||
*
|
||||
|
@ -1314,99 +1289,47 @@ namespace OpenTK.OpenAL
|
|||
|
||||
#region GenBuffers
|
||||
|
||||
/// <summary>This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="n">The number of buffers to be generated.</param>
|
||||
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
unsafe public static extern void GenBuffers( int n, [Out] uint* buffers );
|
||||
[CLSCompliant(false)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity]
|
||||
unsafe public static extern void GenBuffers(int n, [Out] uint* buffers);
|
||||
// AL_API void AL_APIENTRY alGenBuffers( ALsizei n, ALuint* Buffers );
|
||||
|
||||
/// <summary>This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="n">The number of buffers to be generated.</param>
|
||||
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GenBuffers( int n, out uint buffers )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed ( uint* ptr = &buffers )
|
||||
{
|
||||
GenBuffers( n, (uint*) ptr );
|
||||
buffers = *ptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
[CLSCompliant(false)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void GenBuffers(int n, out uint buffers);
|
||||
|
||||
/// <summary>This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <summary>This function generates one or more buffers, which contain audio buffer (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="n">The number of buffers to be generated.</param>
|
||||
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GenBuffers( int n, out int[] buffers )
|
||||
{
|
||||
uint[] temp = new uint[n];
|
||||
GenBuffers( n, out temp[0] );
|
||||
buffers = new int[n];
|
||||
for ( int i = 0 ; i < n ; i++ )
|
||||
{
|
||||
buffers[i] = (int) temp[i];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="buffers">Pointer to an array of uint values which will store the names of the new buffers.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GenBuffers( int[] buffers )
|
||||
{
|
||||
uint[] temp = new uint[buffers.Length];
|
||||
GenBuffers( temp.Length, out temp[0] );
|
||||
for ( int i = 0 ; i < temp.Length ; i++ )
|
||||
{
|
||||
buffers[i] = (int) temp[i];
|
||||
}
|
||||
}
|
||||
[CLSCompliant(true)]
|
||||
[DllImport(AL.Lib, EntryPoint = "alGenBuffers", ExactSpelling = true, CallingConvention = AL.Style), SuppressUnmanagedCodeSecurity]
|
||||
public static extern void GenBuffers(int n, out int buffers);
|
||||
|
||||
/// <summary>This function generates one or more buffers, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="n">The number of buffers to be generated.</param>
|
||||
/// <returns>Pointer to an array of uint values which will store the names of the new buffers.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public static int[] GenBuffers( int n )
|
||||
[CLSCompliant(true)]
|
||||
public static int[] GenBuffers(int n)
|
||||
{
|
||||
uint[] temp = new uint[n];
|
||||
GenBuffers( temp.Length, out temp[0] );
|
||||
int[] buffers = new int[n];
|
||||
for ( int i = 0 ; i < temp.Length ; i++ )
|
||||
{
|
||||
buffers[i] = (int) temp[i];
|
||||
}
|
||||
GenBuffers(buffers.Length, out buffers[0]);
|
||||
return buffers;
|
||||
}
|
||||
|
||||
/// <summary>This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="buffer">Pointer to an uint value which will store the name of the new buffer.</param>
|
||||
[CLSCompliant( false )]
|
||||
public static void GenBuffers( out uint buffer )
|
||||
{
|
||||
GenBuffers( 1, out buffer );
|
||||
}
|
||||
|
||||
/// <summary>This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <param name="buffer">Pointer to an uint value which will store the name of the new buffer.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GenBuffers( out int buffer )
|
||||
{
|
||||
uint temp;
|
||||
GenBuffers( 1, out temp );
|
||||
buffer = (int) temp;
|
||||
}
|
||||
|
||||
/// <summary>This function generates one buffer only, which contain audio data (see AL.BufferData). References to buffers are uint values, which are used wherever a buffer reference is needed (in calls such as AL.DeleteBuffers, AL.Source with parameter ALSourcei, AL.SourceQueueBuffers, and AL.SourceUnqueueBuffers).</summary>
|
||||
/// <returns>Pointer to an uint value which will store the name of the new buffer.</returns>
|
||||
[CLSCompliant( true )]
|
||||
public static int GenBuffers( )
|
||||
[CLSCompliant(true)]
|
||||
public static int GenBuffer()
|
||||
{
|
||||
uint temp;
|
||||
GenBuffers( 1, out temp );
|
||||
return (int) temp;
|
||||
int temp;
|
||||
GenBuffers(1, out temp);
|
||||
return (int)temp;
|
||||
}
|
||||
|
||||
#endregion GenBuffers
|
||||
|
@ -1520,28 +1443,55 @@ namespace OpenTK.OpenAL
|
|||
|
||||
#region BufferData
|
||||
|
||||
/// <summary>This function fills a buffer with audio data. All the pre-defined formats are PCM data, but this function may be used by extensions to load other data types as well.</summary>
|
||||
/// <param name="bid">buffer Handle/Name to be filled with data.</param>
|
||||
/// <summary>This function fills a buffer with audio buffer. All the pre-defined formats are PCM buffer, but this function may be used by extensions to load other buffer types as well.</summary>
|
||||
/// <param name="bid">buffer Handle/Name to be filled with buffer.</param>
|
||||
/// <param name="format">Format type from among the following: ALFormat.Mono8, ALFormat.Mono16, ALFormat.Stereo8, ALFormat.Stereo16.</param>
|
||||
/// <param name="data">Pointer to the audio data. YOU MUST PIN THIS MANUALLY.</param>
|
||||
/// <param name="size">The size of the audio data in bytes.</param>
|
||||
/// <param name="freq">The frequency of the audio data.</param>
|
||||
/// <param name="buffer">Pointer to the audio buffer. YOU MUST PIN THIS MANUALLY.</param>
|
||||
/// <param name="size">The size of the audio buffer in bytes.</param>
|
||||
/// <param name="freq">The frequency of the audio buffer.</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alBufferData", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void BufferData( uint bid, Enums.ALFormat format, IntPtr data, int size, int freq );
|
||||
// AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* data, ALsizei size, ALsizei freq );
|
||||
public static extern void BufferData( uint bid, ALFormat format, IntPtr data, int size, int freq );
|
||||
// AL_API void AL_APIENTRY alBufferData( ALuint bid, ALenum format, const ALvoid* buffer, ALsizei size, ALsizei freq );
|
||||
|
||||
/// <summary>This function fills a buffer with audio data. All the pre-defined formats are PCM data, but this function may be used by extensions to load other data types as well.</summary>
|
||||
/// <param name="bid">buffer Handle/Name to be filled with data.</param>
|
||||
/// <summary>This function fills a buffer with audio buffer. All the pre-defined formats are PCM buffer, but this function may be used by extensions to load other buffer types as well.</summary>
|
||||
/// <param name="bid">buffer Handle/Name to be filled with buffer.</param>
|
||||
/// <param name="format">Format type from among the following: ALFormat.Mono8, ALFormat.Mono16, ALFormat.Stereo8, ALFormat.Stereo16.</param>
|
||||
/// <param name="data">Pointer to the audio data. YOU MUST PIN THIS MANUALLY.</param>
|
||||
/// <param name="size">The size of the audio data in bytes.</param>
|
||||
/// <param name="freq">The frequency of the audio data.</param>
|
||||
/// <param name="buffer">Pointer to the audio buffer. YOU MUST PIN THIS MANUALLY.</param>
|
||||
/// <param name="size">The size of the audio buffer in bytes.</param>
|
||||
/// <param name="freq">The frequency of the audio buffer.</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void BufferData( int bid, Enums.ALFormat format, IntPtr data, int size, int freq )
|
||||
public static void BufferData( int bid, ALFormat format, IntPtr data, int size, int freq )
|
||||
{
|
||||
BufferData( (uint) bid, format, data, size, freq );
|
||||
}
|
||||
|
||||
/// <summary>This function fills a buffer with audio buffer (PCM format).</summary>
|
||||
/// <param name="bid">Buffer Handle/Name to be filled with buffer.</param>
|
||||
/// <param name="buffer">A SoundData object containing the buffer to upload.</param>
|
||||
[CLSCompliant(false)]
|
||||
public static void BufferData(uint bid, SoundData data)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* data_ptr = &data.Data[0])
|
||||
BufferData(bid, data.SoundFormat.SampleFormatAsOpenALFormat, (IntPtr)data_ptr, data.Data.Length,
|
||||
data.SoundFormat.SampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>This function fills a buffer with audio buffer (PCM format).</summary>
|
||||
/// <param name="bid">Buffer Handle/Name to be filled with buffer.</param>
|
||||
/// <param name="buffer">A SoundData object containing the buffer to upload.</param>
|
||||
public static void BufferData(int bid, SoundData data)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
fixed (byte* data_ptr = &data.Data[0])
|
||||
BufferData(bid, data.SoundFormat.SampleFormatAsOpenALFormat, (IntPtr)data_ptr, data.Data.Length,
|
||||
data.SoundFormat.SampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion BufferData
|
||||
|
||||
#endregion Buffer objects
|
||||
|
@ -1579,17 +1529,17 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>This function retrieves an integer property of a buffer.</summary>
|
||||
/// <param name="bid">Buffer name whose attribute is being retrieved</param>
|
||||
/// <param name="param">The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous).</param>
|
||||
/// <param name="value">A pointer to an int to hold the retrieved data</param>
|
||||
/// <param name="value">A pointer to an int to hold the retrieved buffer</param>
|
||||
[CLSCompliant( false ), DllImport( AL.Lib, EntryPoint = "alGetBufferi", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetBuffer( uint bid, Enums.ALGetBufferi param, [Out] out int value );
|
||||
public static extern void GetBuffer( uint bid, ALGetBufferi param, [Out] out int value );
|
||||
// AL_API void AL_APIENTRY alGetBufferi( ALuint bid, ALenum param, ALint* value );
|
||||
|
||||
/// <summary>This function retrieves an integer property of a buffer.</summary>
|
||||
/// <param name="bid">Buffer name whose attribute is being retrieved</param>
|
||||
/// <param name="param">The name of the attribute to be retrieved: ALGetBufferi.Frequency, Bits, Channels, Size, and the currently hidden AL_DATA (dangerous).</param>
|
||||
/// <param name="value">A pointer to an int to hold the retrieved data</param>
|
||||
/// <param name="value">A pointer to an int to hold the retrieved buffer</param>
|
||||
[CLSCompliant( true )]
|
||||
public static void GetBuffer( int bid, Enums.ALGetBufferi param, out int value )
|
||||
public static void GetBuffer( int bid, ALGetBufferi param, out int value )
|
||||
{
|
||||
GetBuffer( (uint) bid, param, out value );
|
||||
}
|
||||
|
@ -1656,10 +1606,10 @@ namespace OpenTK.OpenAL
|
|||
/// </remarks>
|
||||
/// <param name="distancemodel"></param>
|
||||
[DllImport( AL.Lib, EntryPoint = "alDistanceModel", ExactSpelling = true, CallingConvention = AL.Style ), SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void DistanceModel( Enums.ALDistanceModel distancemodel );
|
||||
public static extern void DistanceModel( ALDistanceModel distancemodel );
|
||||
// AL_API void AL_APIENTRY alDistanceModel( ALenum distanceModel );
|
||||
|
||||
#endregion Global Parameters
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
///<summary>A list of valid Enable/Disable/IsEnabled parameters</summary>
|
||||
|
@ -244,7 +244,7 @@ namespace OpenTK.OpenAL.Enums
|
|||
/// <summary>size of the Buffer in bytes.</summary>
|
||||
Size = 0x2004,
|
||||
|
||||
// Deprecated: From Manual, not in header: AL_DATA ( i, iv ) original location where data was copied from generally useless, as was probably freed after buffer creation
|
||||
// Deprecated: From Manual, not in header: AL_DATA ( i, iv ) original location where buffer was copied from generally useless, as was probably freed after buffer creation
|
||||
}
|
||||
|
||||
///<summary>Buffer state. Not supported for public use (yet).</summary>
|
||||
|
|
|
@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
|
|||
|
||||
using OpenTK.Math;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
public partial class EfxExtension
|
||||
|
@ -25,19 +25,19 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>(Helper) Selects the Effect type used by this Effect handle.</summary>
|
||||
/// <param name="eid">Effect id returned from a successful call to GenEffects.</param>
|
||||
/// <param name="type">Effect type.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void BindEffect( uint eid, Enums.EfxEffectType type )
|
||||
[CLSCompliant(false)]
|
||||
public void BindEffect( uint eid,EfxEffectType type )
|
||||
{
|
||||
Imported_alEffecti( eid, Enums.EfxEffecti.EffectType, (int) type );
|
||||
Imported_alEffecti(eid,EfxEffecti.EffectType,(int) type);
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Selects the Effect type used by this Effect handle.</summary>
|
||||
/// <param name="eid">Effect id returned from a successful call to GenEffects.</param>
|
||||
/// <param name="type">Effect type.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void BindEffect( int eid, Enums.EfxEffectType type )
|
||||
public void BindEffect( int eid, EfxEffectType type )
|
||||
{
|
||||
Imported_alEffecti( (uint) eid, Enums.EfxEffecti.EffectType, (int) type );
|
||||
Imported_alEffecti( (uint)eid, EfxEffecti.EffectType, (int) type );
|
||||
}
|
||||
|
||||
#endregion BindEffect
|
||||
|
@ -50,7 +50,7 @@ namespace OpenTK.OpenAL
|
|||
[CLSCompliant( false )]
|
||||
public void BindFilterToSource( uint source, uint filter )
|
||||
{
|
||||
AL.Source( source, Enums.ALSourcei.EfxDirectFilter, (int) filter );
|
||||
AL.Source(source,ALSourcei.EfxDirectFilter,(int) filter);
|
||||
}
|
||||
|
||||
/// <summary>(Helper) reroutes the output of a Source through a Filter.</summary>
|
||||
|
@ -59,7 +59,7 @@ namespace OpenTK.OpenAL
|
|||
[CLSCompliant( true )]
|
||||
public void BindFilterToSource( int source, int filter )
|
||||
{
|
||||
AL.Source( (uint) source, Enums.ALSourcei.EfxDirectFilter, (int) filter );
|
||||
AL.Source( (uint)source, ALSourcei.EfxDirectFilter, (int) filter );
|
||||
}
|
||||
|
||||
#endregion BindFilterToSource
|
||||
|
@ -72,7 +72,7 @@ namespace OpenTK.OpenAL
|
|||
[CLSCompliant( false )]
|
||||
public void BindEffectToAuxiliarySlot( uint auxiliaryeffectslot, uint effect )
|
||||
{
|
||||
AuxiliaryEffectSlot( auxiliaryeffectslot, Enums.EfxAuxiliaryi.EffectslotEffect, (int) effect );
|
||||
AuxiliaryEffectSlot(auxiliaryeffectslot,EfxAuxiliaryi.EffectslotEffect,(int) effect);
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Attaches an Effect to an Auxiliary Effect Slot.</summary>
|
||||
|
@ -81,7 +81,7 @@ namespace OpenTK.OpenAL
|
|||
[CLSCompliant( true )]
|
||||
public void BindEffectToAuxiliarySlot( int auxiliaryeffectslot, int effect )
|
||||
{
|
||||
AuxiliaryEffectSlot( (uint) auxiliaryeffectslot, Enums.EfxAuxiliaryi.EffectslotEffect, (int) effect );
|
||||
AuxiliaryEffectSlot( (uint)auxiliaryeffectslot, EfxAuxiliaryi.EffectslotEffect, (int) effect );
|
||||
}
|
||||
|
||||
#endregion BindEffectToAuxiliarySlot
|
||||
|
@ -91,23 +91,23 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>(Helper) Reroutes a Source's output into an Auxiliary Effect Slot.</summary>
|
||||
/// <param name="source">The Source handle who's output is forwarded.</param>
|
||||
/// <param name="slot">The Auxiliary Effect Slot handle that receives input from the Source.</param>
|
||||
/// <param name="slotnumber">Every Source has only a limited number of slots it can feed data to. The number must stay below AlcContextAttributes.EfxMaxAuxiliarySends</param>
|
||||
/// <param name="slotnumber">Every Source has only a limited number of slots it can feed buffer to. The number must stay below AlcContextAttributes.EfxMaxAuxiliarySends</param>
|
||||
/// <param name="filter">Filter handle to be attached between Source ouput and Auxiliary Slot input. Use 0 or EfxFilterType.FilterNull for no filter. </param>
|
||||
[CLSCompliant( false )]
|
||||
public void BindSourceToAuxiliarySlot( uint source, uint slot, int slotnumber, uint filter )
|
||||
{
|
||||
AL.Source( source, Enums.ALSource3i.EfxAuxiliarySendFilter, (int) slot, (int) slotnumber, (int) filter );
|
||||
AL.Source( source, ALSource3i.EfxAuxiliarySendFilter, (int) slot, (int) slotnumber, (int) filter );
|
||||
}
|
||||
|
||||
/// <summary>(Helper) Reroutes a Source's output into an Auxiliary Effect Slot.</summary>
|
||||
/// <param name="source">The Source handle who's output is forwarded.</param>
|
||||
/// <param name="slot">The Auxiliary Effect Slot handle that receives input from the Source.</param>
|
||||
/// <param name="slotnumber">Every Source has only a limited number of slots it can feed data to. The number must stay below AlcContextAttributes.EfxMaxAuxiliarySends</param>
|
||||
/// <param name="slotnumber">Every Source has only a limited number of slots it can feed buffer to. The number must stay below AlcContextAttributes.EfxMaxAuxiliarySends</param>
|
||||
/// <param name="filter">Filter handle to be attached between Source ouput and Auxiliary Slot input. Use 0 or EfxFilterType.FilterNull for no filter. </param>
|
||||
[CLSCompliant( true )]
|
||||
public void BindSourceToAuxiliarySlot( int source, int slot, int slotnumber, int filter )
|
||||
{
|
||||
AL.Source( (uint) source, Enums.ALSource3i.EfxAuxiliarySendFilter, (int) slot, (int) slotnumber, (int) filter );
|
||||
AL.Source( (uint)source, ALSource3i.EfxAuxiliarySendFilter, (int) slot,(int) slotnumber, (int) filter );
|
||||
}
|
||||
|
||||
#endregion BindSourceToAuxiliarySlot
|
||||
|
@ -342,7 +342,7 @@ namespace OpenTK.OpenAL
|
|||
#region alEffecti
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
private delegate void Delegate_alEffecti( uint eid, Enums.EfxEffecti param, int value );
|
||||
private delegate void Delegate_alEffecti( uint eid,EfxEffecti param,int value );
|
||||
// typedef void (__cdecl *LPALEFFECTI)( ALuint eid, ALenum param, ALint value);
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -352,8 +352,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void Effect( uint eid, Enums.EfxEffecti param, int value )
|
||||
[CLSCompliant(false)]
|
||||
public void Effect( uint eid,EfxEffecti param,int value )
|
||||
{
|
||||
Imported_alEffecti( eid, param, value );
|
||||
}
|
||||
|
@ -363,7 +363,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void Effect( int eid, Enums.EfxEffecti param, int value )
|
||||
public void Effect( int eid, EfxEffecti param, int value )
|
||||
{
|
||||
Imported_alEffecti( (uint) eid, param, value );
|
||||
}
|
||||
|
@ -373,7 +373,7 @@ namespace OpenTK.OpenAL
|
|||
#region alEffectf
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
private delegate void Delegate_alEffectf( uint eid, Enums.EfxEffectf param, float value );
|
||||
private delegate void Delegate_alEffectf( uint eid,EfxEffectf param,float value );
|
||||
// typedef void (__cdecl *LPALEFFECTF)( ALuint eid, ALenum param, ALfloat value);
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -383,8 +383,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void Effect( uint eid, Enums.EfxEffectf param, float value )
|
||||
[CLSCompliant(false)]
|
||||
public void Effect( uint eid,EfxEffectf param,float value )
|
||||
{
|
||||
Imported_alEffectf( eid, param, value );
|
||||
}
|
||||
|
@ -394,7 +394,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void Effect( int eid, Enums.EfxEffectf param, float value )
|
||||
public void Effect( int eid, EfxEffectf param, float value )
|
||||
{
|
||||
Imported_alEffectf( (uint) eid, param, value );
|
||||
}
|
||||
|
@ -404,7 +404,7 @@ namespace OpenTK.OpenAL
|
|||
#region alEffectfv
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alEffectfv( uint eid, Enums.EfxEffect3f param, [In] float* values );
|
||||
unsafe private delegate void Delegate_alEffectfv( uint eid,EfxEffect3f param,[In] float* values );
|
||||
// typedef void (__cdecl *LPALEFFECTFV)( ALuint eid, ALenum param, ALfloat* values );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -414,8 +414,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="values">Pointer to Math.Vector3.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void Effect( uint eid, Enums.EfxEffect3f param, ref Vector3 values )
|
||||
[CLSCompliant(false)]
|
||||
public void Effect( uint eid,EfxEffect3f param,ref Vector3 values )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -431,7 +431,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="values">Pointer to Math.Vector3.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void Effect( int eid, Enums.EfxEffect3f param, ref Vector3 values )
|
||||
public void Effect( int eid, EfxEffect3f param, ref Vector3 values )
|
||||
{
|
||||
Effect( (uint) eid, param, ref values );
|
||||
}
|
||||
|
@ -441,7 +441,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetEffecti
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetEffecti( uint eid, Enums.EfxEffecti pname, [Out] int* value );
|
||||
unsafe private delegate void Delegate_alGetEffecti( uint eid,EfxEffecti pname,[Out] int* value );
|
||||
// typedef void (__cdecl *LPALGETEFFECTI)( ALuint eid, ALenum pname, ALint* value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -451,8 +451,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetEffect( uint eid, Enums.EfxEffecti pname, out int value )
|
||||
[CLSCompliant(false)]
|
||||
public void GetEffect( uint eid,EfxEffecti pname,out int value )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -468,7 +468,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetEffect( int eid, Enums.EfxEffecti pname, out int value )
|
||||
public void GetEffect( int eid, EfxEffecti pname, out int value )
|
||||
{
|
||||
GetEffect( (uint) eid, pname, out value );
|
||||
}
|
||||
|
@ -478,7 +478,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetEffectf
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetEffectf( uint eid, Enums.EfxEffectf pname, [Out]float* value );
|
||||
unsafe private delegate void Delegate_alGetEffectf( uint eid,EfxEffectf pname,[Out]float* value );
|
||||
// typedef void (__cdecl *LPALGETEFFECTF)( ALuint eid, ALenum pname, ALfloat* value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -488,8 +488,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetEffect( uint eid, Enums.EfxEffectf pname, out float value )
|
||||
[CLSCompliant(false)]
|
||||
public void GetEffect( uint eid,EfxEffectf pname,out float value )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -505,7 +505,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetEffect( int eid, Enums.EfxEffectf pname, out float value )
|
||||
public void GetEffect( int eid, EfxEffectf pname, out float value )
|
||||
{
|
||||
GetEffect( (uint) eid, pname, out value );
|
||||
}
|
||||
|
@ -515,7 +515,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetEffectfv
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetEffectfv( uint eid, Enums.EfxEffect3f param, [Out] float* values );
|
||||
unsafe private delegate void Delegate_alGetEffectfv( uint eid,EfxEffect3f param,[Out] float* values );
|
||||
// typedef void (__cdecl *LPALGETEFFECTFV)( ALuint eid, ALenum pname, ALfloat* values );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -525,8 +525,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="eid">Effect object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">A Math.Vector3 to hold the values.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetEffect( uint eid, Enums.EfxEffect3f param, out Vector3 values )
|
||||
[CLSCompliant(false)]
|
||||
public void GetEffect( uint eid,EfxEffect3f param,out Vector3 values )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -545,7 +545,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">A Math.Vector3 to hold the values.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetEffect( int eid, Enums.EfxEffect3f param, out Vector3 values )
|
||||
public void GetEffect( int eid, EfxEffect3f param, out Vector3 values )
|
||||
{
|
||||
GetEffect( (uint) eid, param, out values );
|
||||
}
|
||||
|
@ -786,7 +786,7 @@ namespace OpenTK.OpenAL
|
|||
#region alFilteri
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
private delegate void Delegate_alFilteri( uint fid, Enums.EfxFilteri param, int value );
|
||||
private delegate void Delegate_alFilteri( uint fid,EfxFilteri param,int value );
|
||||
// typedef void (__cdecl *LPALFILTERI)( ALuint fid, ALenum param, ALint value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -796,8 +796,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void Filter( uint fid, Enums.EfxFilteri param, int value )
|
||||
[CLSCompliant(false)]
|
||||
public void Filter( uint fid,EfxFilteri param,int value )
|
||||
{
|
||||
Imported_alFilteri( fid, param, value );
|
||||
}
|
||||
|
@ -807,7 +807,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void Filter( int fid, Enums.EfxFilteri param, int value )
|
||||
public void Filter( int fid, EfxFilteri param, int value )
|
||||
{
|
||||
Imported_alFilteri( (uint) fid, param, value );
|
||||
}
|
||||
|
@ -817,7 +817,7 @@ namespace OpenTK.OpenAL
|
|||
#region alFilterf
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
private delegate void Delegate_alFilterf( uint fid, Enums.EfxFilterf param, float value );
|
||||
private delegate void Delegate_alFilterf( uint fid,EfxFilterf param,float value );
|
||||
// typedef void (__cdecl *LPALFILTERF)( ALuint fid, ALenum param, ALfloat value);
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -827,8 +827,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void Filter( uint fid, Enums.EfxFilterf param, float value )
|
||||
[CLSCompliant(false)]
|
||||
public void Filter( uint fid,EfxFilterf param,float value )
|
||||
{
|
||||
Imported_alFilterf( fid, param, value );
|
||||
}
|
||||
|
@ -838,7 +838,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Effect property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void Filter( int fid, Enums.EfxFilterf param, float value )
|
||||
public void Filter( int fid, EfxFilterf param, float value )
|
||||
{
|
||||
Imported_alFilterf( (uint) fid, param, value );
|
||||
}
|
||||
|
@ -848,7 +848,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetFilteri
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetFilteri( uint fid, Enums.EfxFilteri pname, [Out] int* value );
|
||||
unsafe private delegate void Delegate_alGetFilteri( uint fid,EfxFilteri pname,[Out] int* value );
|
||||
// typedef void (__cdecl *LPALGETFILTERI)( ALuint fid, ALenum pname, ALint* value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -858,8 +858,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetFilter( uint fid, Enums.EfxFilteri pname, out int value )
|
||||
[CLSCompliant(false)]
|
||||
public void GetFilter( uint fid,EfxFilteri pname,out int value )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -875,7 +875,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetFilter( int fid, Enums.EfxFilteri pname, out int value )
|
||||
public void GetFilter( int fid, EfxFilteri pname, out int value )
|
||||
{
|
||||
GetFilter( (uint) fid, pname, out value );
|
||||
}
|
||||
|
@ -885,7 +885,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetFilterf
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetFilterf( uint fid, Enums.EfxFilterf pname, [Out] float* value );
|
||||
unsafe private delegate void Delegate_alGetFilterf( uint fid,EfxFilterf pname,[Out] float* value );
|
||||
// typedef void (__cdecl *LPALGETFILTERF)( ALuint fid, ALenum pname, ALfloat* value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -895,8 +895,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="fid">Filter object identifier.</param>
|
||||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetFilter( uint fid, Enums.EfxFilterf pname, out float value )
|
||||
[CLSCompliant(false)]
|
||||
public void GetFilter( uint fid,EfxFilterf pname,out float value )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -912,7 +912,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Effect property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetFilter( int fid, Enums.EfxFilterf pname, out float value )
|
||||
public void GetFilter( int fid, EfxFilterf pname, out float value )
|
||||
{
|
||||
GetFilter( (uint) fid, pname, out value );
|
||||
}
|
||||
|
@ -1156,7 +1156,7 @@ namespace OpenTK.OpenAL
|
|||
#region alAuxiliaryEffectSloti
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
private delegate void Delegate_alAuxiliaryEffectSloti( uint asid, Enums.EfxAuxiliaryi param, int value );
|
||||
private delegate void Delegate_alAuxiliaryEffectSloti( uint asid,EfxAuxiliaryi param,int value );
|
||||
// typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTI)( ALuint asid, ALenum param, ALint value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -1166,8 +1166,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="param">Auxiliary Effect Slot property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void AuxiliaryEffectSlot( uint asid, Enums.EfxAuxiliaryi param, int value )
|
||||
[CLSCompliant(false)]
|
||||
public void AuxiliaryEffectSlot( uint asid,EfxAuxiliaryi param,int value )
|
||||
{
|
||||
Imported_alAuxiliaryEffectSloti( asid, param, value );
|
||||
}
|
||||
|
@ -1177,7 +1177,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Auxiliary Effect Slot property to set.</param>
|
||||
/// <param name="value">Integer value.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void AuxiliaryEffectSlot( int asid, Enums.EfxAuxiliaryi param, int value )
|
||||
public void AuxiliaryEffectSlot( int asid, EfxAuxiliaryi param, int value )
|
||||
{
|
||||
Imported_alAuxiliaryEffectSloti( (uint) asid, param, value );
|
||||
}
|
||||
|
@ -1187,7 +1187,7 @@ namespace OpenTK.OpenAL
|
|||
#region alAuxiliaryEffectSlotf
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
private delegate void Delegate_alAuxiliaryEffectSlotf( uint asid, Enums.EfxAuxiliaryf param, float value );
|
||||
private delegate void Delegate_alAuxiliaryEffectSlotf( uint asid,EfxAuxiliaryf param,float value );
|
||||
// typedef void (__cdecl *LPALAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum param, ALfloat value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -1197,8 +1197,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="param">Auxiliary Effect Slot property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void AuxiliaryEffectSlot( uint asid, Enums.EfxAuxiliaryf param, float value )
|
||||
[CLSCompliant(false)]
|
||||
public void AuxiliaryEffectSlot( uint asid,EfxAuxiliaryf param,float value )
|
||||
{
|
||||
Imported_alAuxiliaryEffectSlotf( asid, param, value );
|
||||
}
|
||||
|
@ -1208,7 +1208,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="param">Auxiliary Effect Slot property to set.</param>
|
||||
/// <param name="value">Floating point value.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void AuxiliaryEffectSlot( int asid, Enums.EfxAuxiliaryf param, float value )
|
||||
public void AuxiliaryEffectSlot( int asid, EfxAuxiliaryf param, float value )
|
||||
{
|
||||
Imported_alAuxiliaryEffectSlotf( (uint) asid, param, value );
|
||||
}
|
||||
|
@ -1218,7 +1218,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetAuxiliaryEffectSloti
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetAuxiliaryEffectSloti( uint asid, Enums.EfxAuxiliaryi pname, [Out] int* value );
|
||||
unsafe private delegate void Delegate_alGetAuxiliaryEffectSloti( uint asid,EfxAuxiliaryi pname,[Out] int* value );
|
||||
// typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTI)( ALuint asid, ALenum pname, ALint* value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -1228,8 +1228,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="pname">Auxiliary Effect Slot property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetAuxiliaryEffectSlot( uint asid, Enums.EfxAuxiliaryi pname, out int value )
|
||||
[CLSCompliant(false)]
|
||||
public void GetAuxiliaryEffectSlot( uint asid,EfxAuxiliaryi pname,out int value )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -1245,7 +1245,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Auxiliary Effect Slot property to retrieve.</param>
|
||||
/// <param name="value">Address where integer value will be stored.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetAuxiliaryEffectSlot( int asid, Enums.EfxAuxiliaryi pname, out int value )
|
||||
public void GetAuxiliaryEffectSlot( int asid, EfxAuxiliaryi pname, out int value )
|
||||
{
|
||||
GetAuxiliaryEffectSlot( (uint) asid, pname, out value );
|
||||
}
|
||||
|
@ -1255,7 +1255,7 @@ namespace OpenTK.OpenAL
|
|||
#region alGetAuxiliaryEffectSlotf
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
unsafe private delegate void Delegate_alGetAuxiliaryEffectSlotf( uint asid, Enums.EfxAuxiliaryf pname, [Out] float* value );
|
||||
unsafe private delegate void Delegate_alGetAuxiliaryEffectSlotf( uint asid,EfxAuxiliaryf pname,[Out] float* value );
|
||||
// typedef void (__cdecl *LPALGETAUXILIARYEFFECTSLOTF)( ALuint asid, ALenum pname, ALfloat* value );
|
||||
|
||||
//[CLSCompliant(false)]
|
||||
|
@ -1265,8 +1265,8 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="asid">Auxiliary Effect Slot object identifier.</param>
|
||||
/// <param name="pname">Auxiliary Effect Slot property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
[CLSCompliant( false )]
|
||||
public void GetAuxiliaryEffectSlot( uint asid, Enums.EfxAuxiliaryf pname, out float value )
|
||||
[CLSCompliant(false)]
|
||||
public void GetAuxiliaryEffectSlot( uint asid,EfxAuxiliaryf pname,out float value )
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
|
@ -1282,7 +1282,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="pname">Auxiliary Effect Slot property to retrieve.</param>
|
||||
/// <param name="value">Address where floating point value will be stored.</param>
|
||||
[CLSCompliant( true )]
|
||||
public void GetAuxiliaryEffectSlot( int asid, Enums.EfxAuxiliaryf pname, out float value )
|
||||
public void GetAuxiliaryEffectSlot( int asid, EfxAuxiliaryf pname, out float value )
|
||||
{
|
||||
GetAuxiliaryEffectSlot( (uint) asid, pname, out value );
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
#region Effect
|
||||
|
|
|
@ -11,7 +11,7 @@ using System;
|
|||
|
||||
using OpenTK.Math;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
public partial class EfxExtension
|
||||
|
|
|
@ -11,7 +11,7 @@ using System;
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
///<summary>The X-Ram Extension is provided on the top-end Sound Blaster X-Fi solutions (Sound Blaster X-Fi Fatal1ty, Sound Blaster X-Fi Elite Pro, or later). These products feature 64MB of X-Ram that can only be used for audio purposes, which can be controlled by this Extension.</summary>
|
||||
|
@ -102,13 +102,13 @@ namespace OpenTK.OpenAL
|
|||
/// <summary>Query total amount of X-RAM in bytes.</summary>
|
||||
public int GetRamSize( )
|
||||
{
|
||||
return AL.Get( (Enums.ALGetInteger) AL_EAX_RAM_SIZE );
|
||||
return AL.Get( (ALGetInteger) AL_EAX_RAM_SIZE );
|
||||
}
|
||||
|
||||
/// <summary>Query free X-RAM available in bytes.</summary>
|
||||
public int GetRamFree( )
|
||||
{
|
||||
return AL.Get( (Enums.ALGetInteger) AL_EAX_RAM_FREE );
|
||||
return AL.Get( (ALGetInteger) AL_EAX_RAM_FREE );
|
||||
}
|
||||
|
||||
/// <summary>This enum is used to abstract the need of using AL.GetEnumValue() with the Extension. The values do NOT correspond to AL_STORAGE_* tokens!</summary>
|
||||
|
|
|
@ -66,7 +66,7 @@ typedef void ALCvoid;
|
|||
* IntPtr
|
||||
*/
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
/// <summary>Alc = Audio Library Context</summary>
|
||||
|
@ -174,7 +174,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="device">a pointer to the device to retrieve the error state from</param>
|
||||
/// <returns>Errorcode Int32.</returns>
|
||||
[DllImport(Alc.Lib,EntryPoint = "alcGetError",ExactSpelling = true,CallingConvention = Alc.Style),SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern Enums.AlcError GetError( [In] IntPtr device );
|
||||
public static extern AlcError GetError( [In] IntPtr device );
|
||||
// ALC_API ALCenum ALC_APIENTRY alcGetError( ALCdevice *device );
|
||||
|
||||
#endregion Error support.
|
||||
|
@ -210,7 +210,7 @@ namespace OpenTK.OpenAL
|
|||
#region Query functions
|
||||
|
||||
[DllImport(Alc.Lib,EntryPoint = "alcGetString",ExactSpelling = true,CallingConvention = Alc.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )]
|
||||
private static extern IntPtr GetStringPrivate( [In] IntPtr device,Enums.AlcGetString param );
|
||||
private static extern IntPtr GetStringPrivate( [In] IntPtr device,AlcGetString param );
|
||||
// ALC_API const ALCchar * ALC_APIENTRY alcGetString( ALCdevice *device, ALCenum param );
|
||||
|
||||
/// <summary>This function returns pointers to strings related to the context.</summary>
|
||||
|
@ -224,7 +224,7 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="device">a pointer to the device to be queried.</param>
|
||||
/// <param name="param">an attribute to be retrieved: ALC_DEFAULT_DEVICE_SPECIFIER, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER, ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_EXTENSIONS</param>
|
||||
/// <returns>A string containing the name of the Device.</returns>
|
||||
public static string GetString( IntPtr device,Enums.AlcGetString param )
|
||||
public static string GetString( IntPtr device,AlcGetString param )
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(GetStringPrivate(device,param));
|
||||
}
|
||||
|
@ -238,10 +238,10 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="device">a pointer to the device to be queried.</param>
|
||||
/// <param name="param">an attribute to be retrieved: ALC_DEVICE_SPECIFIER, ALC_CAPTURE_DEVICE_SPECIFIER, ALC_ALL_DEVICES_SPECIFIER</param>
|
||||
/// <returns>A List of strings containing the names of the Devices.</returns>
|
||||
public static IList<string> GetString(IntPtr device, Enums.AlcGetStringList param)
|
||||
public static IList<string> GetString(IntPtr device, AlcGetStringList param)
|
||||
{
|
||||
List<string> result = new List<string>();
|
||||
IntPtr t = GetStringPrivate(IntPtr.Zero, (Enums.AlcGetString)param);
|
||||
IntPtr t = GetStringPrivate(IntPtr.Zero, (AlcGetString)param);
|
||||
System.Text.StringBuilder sb = new System.Text.StringBuilder();
|
||||
byte b;
|
||||
int offset = 0;
|
||||
|
@ -267,10 +267,10 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="device">a pointer to the device to be queried.</param>
|
||||
/// <param name="param">an attribute to be retrieved: ALC_MAJOR_VERSION, ALC_MINOR_VERSION, ALC_ATTRIBUTES_SIZE, ALC_ALL_ATTRIBUTES</param>
|
||||
/// <param name="size">the size of the destination buffer provided. In bytes.</param>
|
||||
/// <param name="data">a pointer to the data to be returned</param>
|
||||
/// <param name="buffer">a pointer to the buffer to be returned</param>
|
||||
[DllImport(Alc.Lib,EntryPoint = "alcGetIntegerv",ExactSpelling = true,CallingConvention = Alc.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void GetInteger( [In] IntPtr device,Enums.AlcGetInteger param,int size,[Out] out int data );
|
||||
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data );
|
||||
public static extern void GetInteger( [In] IntPtr device,AlcGetInteger param,int size,[Out] out int data );
|
||||
// ALC_API void ALC_APIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *buffer );
|
||||
|
||||
#endregion Query functions
|
||||
|
||||
|
@ -278,12 +278,12 @@ namespace OpenTK.OpenAL
|
|||
|
||||
/// <summary>This function opens a capture device by name. </summary>
|
||||
/// <param name="devicename">a pointer to a device name string</param>
|
||||
/// <param name="frequency">the frequency that the data should be captured at</param>
|
||||
/// <param name="frequency">the frequency that the buffer should be captured at</param>
|
||||
/// <param name="format">the requested capture buffer format</param>
|
||||
/// <param name="buffersize">the size of the capture buffer in bytes</param>
|
||||
/// <returns>Returns the capture device pointer, or NULL on failure.</returns>
|
||||
[CLSCompliant(false),DllImport(Alc.Lib,EntryPoint = "alcCaptureOpenDevice",ExactSpelling = true,CallingConvention = Alc.Style,CharSet = CharSet.Ansi),SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern IntPtr CaptureOpenDevice( string devicename,uint frequency,Enums.ALFormat format,int buffersize );
|
||||
public static extern IntPtr CaptureOpenDevice( string devicename,uint frequency,ALFormat format,int buffersize );
|
||||
// ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize );
|
||||
|
||||
/// <summary>This function closes the specified capture device.</summary>
|
||||
|
@ -308,7 +308,7 @@ namespace OpenTK.OpenAL
|
|||
|
||||
/// <summary>This function completes a capture operation, and does not block.</summary>
|
||||
/// <param name="device">a pointer to a capture device.</param>
|
||||
/// <param name="buffer">a pointer to a data buffer, which must be large enough to accommodate samples number of samples.</param>
|
||||
/// <param name="buffer">a pointer to a buffer buffer, which must be large enough to accommodate samples number of samples.</param>
|
||||
/// <param name="samples">the number of samples to be retrieved.</param>
|
||||
[DllImport(Alc.Lib,EntryPoint = "alcCaptureSamples",ExactSpelling = true,CallingConvention = Alc.Style),SuppressUnmanagedCodeSecurity( )]
|
||||
public static extern void CaptureSamples( [In] IntPtr device,[Out] out IntPtr buffer,[Out] out int samples );
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
public enum AlcContextAttributes : int
|
||||
|
|
|
@ -11,7 +11,7 @@ using System;
|
|||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
|
||||
namespace OpenTK.OpenAL
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
/// <summary>Alut, FreeAlut = Free Audio Library Utilities</summary>
|
||||
|
@ -67,19 +67,19 @@ namespace OpenTK.OpenAL
|
|||
#region Error Checking
|
||||
|
||||
/// <summary>Any ALUT routine that fails will return AL_FALSE / AL_NONE / NULL and set the global error state. If a subsequent error occurs while there is still an error recorded internally, the second error will simply be ignored. Calling alutGetError will reset the error code to ALUT_ERROR_NO_ERROR. Note that the error state is not cleared by other successful ALUT calls. Alut.GetError can be called in any ALUT state and will never fail.</summary>
|
||||
/// <returns><see cref="Enums.AlutError"/></returns>
|
||||
/// <returns><see cref="AlutError"/></returns>
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetError", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern Enums.AlutError GetError();
|
||||
public static extern AlutError GetError();
|
||||
// ALUT_API ALenum ALUT_APIENTRY alutGetError (void);
|
||||
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetErrorString", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
private static extern IntPtr GetErrorStringPrivate(Enums.AlutError error);
|
||||
private static extern IntPtr GetErrorStringPrivate(AlutError error);
|
||||
// ALUT_API const char *ALUT_APIENTRY alutGetErrorString (ALenum error);
|
||||
|
||||
/// <summary>Alut.GetErrorString can be used to convert an error code into a human-readable description. The precise text of these descriptions may vary from implementation to implementation and should not be relied upon by the application.</summary>
|
||||
/// <param name="error">Retrieve first occured error with Alut.GetError</param>
|
||||
/// <returns>A human-readable description of the Error.</returns>
|
||||
public static string GetErrorString(Enums.AlutError error)
|
||||
public static string GetErrorString(AlutError error)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(GetErrorStringPrivate(error));
|
||||
}
|
||||
|
@ -88,20 +88,20 @@ namespace OpenTK.OpenAL
|
|||
|
||||
#region File Loading
|
||||
|
||||
/// <summary>Alut.CreateBufferFromFile tries to guess the sound data format by looking at the filename and/or the file contents and loads the sound data into an OpenAL buffer.</summary>
|
||||
/// <summary>Alut.CreateBufferFromFile tries to guess the sound buffer format by looking at the filename and/or the file contents and loads the sound buffer into an OpenAL buffer.</summary>
|
||||
/// <param name="filename">The file to be loaded</param>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferFromFile", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferFromFile([In] string filename);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFile (const char *fileName);
|
||||
|
||||
/// <summary>Alut.CreateBufferFromFileImage tries to guess the sound data format by looking at the contents of the memory region given as parameters and loads the sound data into an OpenAL buffer.</summary>
|
||||
/// <param name="data">A Pointer to the sound data in memory.</param>
|
||||
/// <param name="length">Size in Bytes of the sound data.</param>
|
||||
/// <summary>Alut.CreateBufferFromFileImage tries to guess the sound buffer format by looking at the contents of the memory region given as parameters and loads the sound buffer into an OpenAL buffer.</summary>
|
||||
/// <param name="buffer">A Pointer to the sound buffer in memory.</param>
|
||||
/// <param name="length">Size in Bytes of the sound buffer.</param>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferFromFileImage", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferFromFileImage([In] IntPtr data, int length);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFileImage (const ALvoid *data, ALsizei length);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferFromFileImage (const ALvoid *buffer, ALsizei length);
|
||||
|
||||
|
||||
/// <summary>Alut.CreateBufferHelloWorld returns a handle to an OpenAL buffer containing the sound of someone saying 'Hello, world!'.</summary>
|
||||
|
@ -117,12 +117,12 @@ namespace OpenTK.OpenAL
|
|||
/// <param name="duration">Duration (in seconds)</param>
|
||||
/// <returns>OpenAL Buffer, 0 on failure.</returns>
|
||||
[CLSCompliant(false), DllImport(Alut.Lib, EntryPoint = "alutCreateBufferWaveform", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern uint CreateBufferWaveform(Enums.AlutWaveform waveshape, float frequency, float phase, float duration);
|
||||
public static extern uint CreateBufferWaveform(AlutWaveform waveshape, float frequency, float phase, float duration);
|
||||
// ALUT_API ALuint ALUT_APIENTRY alutCreateBufferWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration);
|
||||
|
||||
// Warning: these leak memory if not properly free'd
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFile (const char *fileName, ALenum *format, ALsizei *size, ALfloat *frequency);
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFileImage (const ALvoid *data, ALsizei length, ALenum *format, ALsizei *size, ALfloat *frequency);
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryFromFileImage (const ALvoid *buffer, ALsizei length, ALenum *format, ALsizei *size, ALfloat *frequency);
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryHelloWorld (ALenum *format, ALsizei *size, ALfloat *frequency);
|
||||
// ALUT_API ALvoid *ALUT_APIENTRY alutLoadMemoryWaveform (ALenum waveshape, ALfloat frequency, ALfloat phase, ALfloat duration, ALenum *format, ALsizei *size, ALfloat *freq);
|
||||
|
||||
|
@ -130,26 +130,26 @@ namespace OpenTK.OpenAL
|
|||
|
||||
#region Misc
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetMIMETypes", ExactSpelling = true, CallingConvention = Alut.Style, CharSet = CharSet.Ansi), SuppressUnmanagedCodeSecurity()]
|
||||
private static extern IntPtr GetMIMETypesPrivate(Enums.AlutLoader loader);
|
||||
private static extern IntPtr GetMIMETypesPrivate(AlutLoader loader);
|
||||
// ALUT_API const char *ALUT_APIENTRY alutGetMIMETypes (ALenum loader);
|
||||
|
||||
/// <summary>Alut.GetMIMETypes returns a comma-separated list of supported MIME types for the given loader type, e.g. something like "audio/basic,audio/mpeg,audio/x-wav".
|
||||
/// It is possible that Enums.AlutLoader.Memory loaders will be unable to support some file types that Enums.AlutLoader.Buffer loaders can support (although the reverse is never the case). Furthermore, it is possible that for some file types (notably audio/x-wav) the support may be only for a few sub-formats. For example, an implementation may advertise that audio/x-wav is supported when in fact it only supports uncompressed (i.e. PCM) WAV files and not any of the compressed subformats. In this event, the various ALUT loaders may return an error and set ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE rather than ALUT_ERROR_UNSUPPORTED_FILE_TYPE which would indicate that no files of this type are allowed.
|
||||
/// It is possible that AlutLoader.Memory loaders will be unable to support some file types that AlutLoader.Buffer loaders can support (although the reverse is never the case). Furthermore, it is possible that for some file types (notably audio/x-wav) the support may be only for a few sub-formats. For example, an implementation may advertise that audio/x-wav is supported when in fact it only supports uncompressed (i.e. PCM) WAV files and not any of the compressed subformats. In this event, the various ALUT loaders may return an error and set ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE rather than ALUT_ERROR_UNSUPPORTED_FILE_TYPE which would indicate that no files of this type are allowed.
|
||||
/// </summary>
|
||||
/// <param name="loader"><see cref="Enums.AlutLoader"/></param>
|
||||
/// <param name="loader"><see cref="AlutLoader"/></param>
|
||||
/// <returns>A comma-separated list of supported MIME types.</returns>
|
||||
public static string GetMIMETypes(Enums.AlutLoader loader)
|
||||
public static string GetMIMETypes(AlutLoader loader)
|
||||
{
|
||||
return Marshal.PtrToStringAnsi(GetMIMETypesPrivate(loader));
|
||||
}
|
||||
|
||||
/// <summary>Alut.GetMajorVersion returns the major version number of the ALUT in use, which will match the major version number of the corresponding ALUT specification document. Can be compared using Enums.AlutVersions.</summary>
|
||||
/// <summary>Alut.GetMajorVersion returns the major version number of the ALUT in use, which will match the major version number of the corresponding ALUT specification document. Can be compared using AlutVersions.</summary>
|
||||
/// <returns>Major Version Number.</returns>
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetMajorVersion", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern int GetMajorVersion();
|
||||
// ALUT_API ALint ALUT_APIENTRY alutGetMajorVersion (void);
|
||||
|
||||
/// <summary>Alut.GetMinorVersion returns the minor version number of the ALUT in use, which will match the minor version number of the corresponding ALUT specification document. Can be compared using Enums.AlutVersions.</summary>
|
||||
/// <summary>Alut.GetMinorVersion returns the minor version number of the ALUT in use, which will match the minor version number of the corresponding ALUT specification document. Can be compared using AlutVersions.</summary>
|
||||
/// <returns>Minor Version Number.</returns>
|
||||
[DllImport(Alut.Lib, EntryPoint = "alutGetMinorVersion", ExactSpelling = true, CallingConvention = Alut.Style), SuppressUnmanagedCodeSecurity()]
|
||||
public static extern int GetMinorVersion();
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
using System;
|
||||
|
||||
namespace OpenTK.OpenAL.Enums
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
|
||||
public enum AlutVersions : int
|
||||
|
@ -50,7 +50,7 @@ namespace OpenTK.OpenAL.Enums
|
|||
DestroyContext = 0x20B,
|
||||
/// <summary>There was an error generating an AL buffer.</summary>
|
||||
GenBuffers = 0x20C,
|
||||
/// <summary>There was an error passing buffer data to AL.</summary>
|
||||
/// <summary>There was an error passing buffer buffer to AL.</summary>
|
||||
BufferData = 0x20D,
|
||||
/// <summary>I/O error, consult errno for more details.</summary>
|
||||
IoError = 0x20E,
|
||||
|
@ -58,7 +58,7 @@ namespace OpenTK.OpenAL.Enums
|
|||
UnsupportedFileType = 0x20F,
|
||||
/// <summary>Unsupported mode within an otherwise usable file type.</summary>
|
||||
UnsupportedFileSubtype = 0x210,
|
||||
/// <summary>The sound data was corrupt or truncated.</summary>
|
||||
/// <summary>The sound buffer was corrupt or truncated.</summary>
|
||||
CorruptOrTruncatedData = 0x211,
|
||||
}
|
||||
|
||||
|
@ -73,9 +73,9 @@ namespace OpenTK.OpenAL.Enums
|
|||
|
||||
public enum AlutLoader : int
|
||||
{
|
||||
///<summary>For the loaders returning sound data in an OpenAL buffer, e.g. Alut.CreateBufferFromFile and Alut.CreateBufferFromFileImage</summary>
|
||||
///<summary>For the loaders returning sound buffer in an OpenAL buffer, e.g. Alut.CreateBufferFromFile and Alut.CreateBufferFromFileImage</summary>
|
||||
Buffer = 0x300,
|
||||
///<summary>For the loaders returning sound data in a newly allocated memory region, e.g. Alut.LoadMemoryFromFile and Alut.LoadMemoryFromFileImage.</summary>
|
||||
///<summary>For the loaders returning sound buffer in a newly allocated memory region, e.g. Alut.LoadMemoryFromFile and Alut.LoadMemoryFromFileImage.</summary>
|
||||
Memory = 0x301,
|
||||
}
|
||||
|
||||
|
|
44
Source/OpenTK/Audio/SoundData.cs
Normal file
44
Source/OpenTK/Audio/SoundData.cs
Normal file
|
@ -0,0 +1,44 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>Encapsulates a pointer to decoded sound buffer.</summary>
|
||||
public class SoundData
|
||||
{
|
||||
byte[] buffer;
|
||||
int data_length; // The actual position of the last sample (the buffer may be larger than this).
|
||||
SoundFormat format;
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
/// <internal />
|
||||
/// <summary>Constructs a new SoundData object.</summary>
|
||||
/// <param name="buffer">An array of PCM buffer.</param>
|
||||
internal SoundData(SoundFormat format, byte[] data)
|
||||
{
|
||||
if (data == null) throw new ArgumentNullException("buffer", "Must be a valid array of samples.");
|
||||
if (data.Length == 0) throw new ArgumentOutOfRangeException("buffer", "Data length must be higher than 0.");
|
||||
//Type t = typeof(SampleType);
|
||||
//if (!(t == typeof(Byte) || t == typeof(SByte) || t == typeof(Int16) || t == typeof(UInt16) || t == typeof(Int32) ||
|
||||
// t == typeof(UInt32) || t == typeof(Int64) || t == typeof(UInt64) || t == typeof(Single)))
|
||||
// throw new ArgumentException(
|
||||
// "SoundData must have one of the following types: byte, short, int, long, float or their unsigned equivalents.");
|
||||
|
||||
this.SoundFormat = format;
|
||||
|
||||
buffer = new byte[OpenTK.Math.Functions.NextPowerOfTwo(data.Length)];
|
||||
Array.Copy(data, buffer, data.Length);
|
||||
//buffer = (byte[])data.Clone();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>Gets the raw PCM buffer.</summary>
|
||||
public byte[] Data { get { return buffer; } internal set { buffer = value; } }
|
||||
|
||||
/// <summary>Gets the SoundFormat of the SoundData.</summary>
|
||||
public SoundFormat SoundFormat { get { return format; } internal set { format = value; } }
|
||||
}
|
||||
}
|
77
Source/OpenTK/Audio/SoundFormat.cs
Normal file
77
Source/OpenTK/Audio/SoundFormat.cs
Normal file
|
@ -0,0 +1,77 @@
|
|||
using System;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>Describes the format of the SoundData.</summary>
|
||||
public struct SoundFormat
|
||||
{
|
||||
#region --- Constructors ---
|
||||
|
||||
/// <summary>Constructs a new SoundFormat.</summary>
|
||||
public SoundFormat(int channels, int bitsPerSample, int sampleRate)
|
||||
{
|
||||
if (sampleRate <= 0) throw new ArgumentOutOfRangeException("sampleRate", "Must be higher than 0.");
|
||||
|
||||
SampleFormat = 0;
|
||||
|
||||
switch (channels)
|
||||
{
|
||||
case 1:
|
||||
if (bitsPerSample == 8) SampleFormat = SampleFormat.Mono8;
|
||||
else if (bitsPerSample == 16) SampleFormat = SampleFormat.Mono16;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
if (bitsPerSample == 8) SampleFormat = SampleFormat.Stereo8;
|
||||
else if (bitsPerSample == 16) SampleFormat = SampleFormat.Stereo16;
|
||||
break;
|
||||
}
|
||||
SampleRate = sampleRate;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Public Members ---
|
||||
|
||||
/// <summary>Describes the SampleFormat of the SoundData.</summary>
|
||||
public readonly SampleFormat SampleFormat;
|
||||
|
||||
/// <summary>Describes the sample rate (frequency) of the SoundData.</summary>
|
||||
public readonly int SampleRate;
|
||||
|
||||
/// <summary>Gets the SampleFormat of the buffer as an OpenTK.Audio.ALFormat enumeration.</summary>
|
||||
public OpenTK.Audio.ALFormat SampleFormatAsOpenALFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
switch (SampleFormat)
|
||||
{
|
||||
case SampleFormat.Mono8: return OpenTK.Audio.ALFormat.Mono8;
|
||||
case SampleFormat.Mono16: return OpenTK.Audio.ALFormat.Mono16;
|
||||
case SampleFormat.Stereo8: return OpenTK.Audio.ALFormat.Stereo8;
|
||||
case SampleFormat.Stereo16: return OpenTK.Audio.ALFormat.Stereo16;
|
||||
default: throw new NotSupportedException("Unknown PCM SampleFormat.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region public enum SampleFormat
|
||||
|
||||
/// <summary>Defines the available formats for SoundData.</summary>
|
||||
public enum SampleFormat
|
||||
{
|
||||
/// <summary>8 bits per sample, 1 channel.</summary>
|
||||
Mono8 = OpenTK.Audio.ALFormat.Mono8,
|
||||
/// <summary>16 bits per sample, 1 channel.</summary>
|
||||
Mono16 = OpenTK.Audio.ALFormat.Mono16,
|
||||
/// <summary>8 bits per sample, 2 channels.</summary>
|
||||
Stereo8 = OpenTK.Audio.ALFormat.Stereo8,
|
||||
/// <summary>16 bits per sample, 2 channels.</summary>
|
||||
Stereo16 = OpenTK.Audio.ALFormat.Stereo16
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
|
@ -19,7 +19,37 @@ namespace OpenTK.Math
|
|||
/// </summary>
|
||||
public static class Functions
|
||||
{
|
||||
/// <summary>
|
||||
#region public static long NextPowerOfTwo(long n)
|
||||
|
||||
/// <summary>
|
||||
/// Returns the next power of two that is larger than the specified number.
|
||||
/// </summary>
|
||||
/// <param name="n">The specified number.</param>
|
||||
/// <returns>The next power of two.</returns>
|
||||
public static long NextPowerOfTwo(long n)
|
||||
{
|
||||
if (n < 0) throw new ArgumentOutOfRangeException("n", "Must be positive.");
|
||||
return (long)System.Math.Pow(2, System.Math.Ceiling(System.Math.Log((double)n, 2)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public static int NextPowerOfTwo(int n)
|
||||
|
||||
/// <summary>
|
||||
/// Returns the next power of two that is larger than the specified number.
|
||||
/// </summary>
|
||||
/// <param name="n">The specified number.</param>
|
||||
/// <returns>The next power of two.</returns>
|
||||
public static int NextPowerOfTwo(int n)
|
||||
{
|
||||
if (n < 0) throw new ArgumentOutOfRangeException("n", "Must be positive.");
|
||||
return (int)System.Math.Pow(2, System.Math.Ceiling(System.Math.Log((double)n, 2)));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Calculates the factorial of a given natural number.
|
||||
/// </summary>
|
||||
/// <param name="n">The number.</param>
|
||||
|
|
|
@ -68,20 +68,20 @@ namespace OpenTK.Platform.Windows
|
|||
#region protected override void WndProc(ref Message msg)
|
||||
|
||||
/// <summary>
|
||||
/// Processes the input Windows Message, routing the data to the correct Keyboard, Mouse or HID.
|
||||
/// Processes the input Windows Message, routing the buffer to the correct Keyboard, Mouse or HID.
|
||||
/// </summary>
|
||||
/// <param name="msg">The WM_INPUT message, containing the data on the input event.</param>
|
||||
/// <param name="msg">The WM_INPUT message, containing the buffer on the input event.</param>
|
||||
protected override void WndProc(ref Message msg)
|
||||
{
|
||||
switch ((WindowMessage)msg.Msg)
|
||||
{
|
||||
case WindowMessage.INPUT:
|
||||
int size = 0;
|
||||
// Get the size of the input data
|
||||
// Get the size of the input buffer
|
||||
Functions.GetRawInputData(msg.LParam, GetRawInputDataEnum.INPUT,
|
||||
IntPtr.Zero, ref size, API.RawInputHeaderSize);
|
||||
|
||||
//if (data == null || API.RawInputSize < size)
|
||||
//if (buffer == null || API.RawInputSize < size)
|
||||
//{
|
||||
// throw new ApplicationException("Critical error when processing raw windows input.");
|
||||
//}
|
||||
|
@ -111,7 +111,7 @@ namespace OpenTK.Platform.Windows
|
|||
else
|
||||
{
|
||||
throw new ApplicationException(String.Format(
|
||||
"GetRawInputData returned invalid data. Windows error {0}. Please file a bug at http://opentk.sourceforge.net",
|
||||
"GetRawInputData returned invalid buffer. Windows error {0}. Please file a bug at http://opentk.sourceforge.net",
|
||||
Marshal.GetLastWin32Error()));
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace OpenTK.Platform.X11
|
||||
|
@ -59,8 +59,8 @@ namespace OpenTK.Platform.X11
|
|||
internal static Display DefaultDisplay { get { return defaultDisplay; } }
|
||||
//internal static int DefaultScreen { get { return defaultScreen; } }
|
||||
//internal static Window RootWindow { get { return rootWindow; } }
|
||||
internal static int ScreenCount { get { return screenCount; } }
|
||||
|
||||
internal static int ScreenCount { get { return screenCount; } }
|
||||
|
||||
internal static object Lock = new object();
|
||||
|
||||
#endregion
|
||||
|
@ -69,34 +69,34 @@ namespace OpenTK.Platform.X11
|
|||
{
|
||||
Debug.Print("Initializing threaded X11: {0}.", Functions.XInitThreads().ToString());
|
||||
|
||||
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
|
||||
|
||||
// Bad idea - Windows.Forms will steal our events!
|
||||
AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
|
||||
|
||||
// Bad idea - Windows.Forms will steal our events!
|
||||
//Type xplatui = Type.GetType("System.Windows.Forms.XplatUIX11, System.Windows.Forms");
|
||||
//defaultDisplay = (IntPtr)xplatui.GetField("DisplayHandle", System.Reflection.BindingFlags.Static |
|
||||
// System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
|
||||
defaultDisplay = Functions.XOpenDisplay(IntPtr.Zero);
|
||||
|
||||
if (defaultDisplay == IntPtr.Zero)
|
||||
throw new PlatformException("Could not establish connection to the X-Server.");
|
||||
//defaultDisplay = (IntPtr)xplatui.GetField("DisplayHandle", System.Reflection.BindingFlags.Static |
|
||||
// System.Reflection.BindingFlags.NonPublic).GetValue(null);
|
||||
|
||||
defaultDisplay = Functions.XOpenDisplay(IntPtr.Zero);
|
||||
|
||||
if (defaultDisplay == IntPtr.Zero)
|
||||
throw new PlatformException("Could not establish connection to the X-Server.");
|
||||
|
||||
//defaultScreen = Functions.XDefaultScreen(DefaultDisplay);
|
||||
//rootWindow = Functions.XRootWindow(DefaultDisplay, DefaultScreen);
|
||||
screenCount = Functions.XScreenCount(DefaultDisplay);
|
||||
//Debug.Print("Default Display: {0}, Default Screen: {1}, Default Root Window: {2}, Screen Count: {3}",
|
||||
// DefaultDisplay, DefaultScreen, RootWindow, ScreenCount);
|
||||
// DefaultDisplay, DefaultScreen, RootWindow, ScreenCount);
|
||||
Debug.Print("Display connection: {0}, Screen count: {1}", DefaultDisplay, ScreenCount);
|
||||
}
|
||||
|
||||
static void CurrentDomain_ProcessExit(object sender, EventArgs e)
|
||||
{
|
||||
if (defaultDisplay != IntPtr.Zero)
|
||||
{
|
||||
Functions.XCloseDisplay(defaultDisplay);
|
||||
defaultDisplay = IntPtr.Zero;
|
||||
defaultScreen = 0;
|
||||
rootWindow = IntPtr.Zero;
|
||||
if (defaultDisplay != IntPtr.Zero)
|
||||
{
|
||||
Functions.XCloseDisplay(defaultDisplay);
|
||||
defaultDisplay = IntPtr.Zero;
|
||||
defaultScreen = 0;
|
||||
rootWindow = IntPtr.Zero;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -163,7 +163,7 @@ namespace OpenTK.Platform.X11
|
|||
/// <summary>
|
||||
/// Frees the memory used by an X structure. Only use on unmanaged structures!
|
||||
/// </summary>
|
||||
/// <param name="data">A pointer to the structure that will be freed.</param>
|
||||
/// <param name="buffer">A pointer to the structure that will be freed.</param>
|
||||
[DllImport(_dll_name, EntryPoint = "XFree")]
|
||||
extern public static void Free(IntPtr data);
|
||||
|
||||
|
@ -718,7 +718,7 @@ XF86VidModeGetGammaRampSize(
|
|||
|
||||
unsafe internal struct Screen
|
||||
{
|
||||
XExtData ext_data; /* hook for extension to hang data */
|
||||
XExtData ext_data; /* hook for extension to hang buffer */
|
||||
IntPtr display; /* back pointer to display structure */ /* _XDisplay */
|
||||
Window root; /* Root window id. */
|
||||
int width, height; /* width and height of screen */
|
||||
|
@ -748,10 +748,10 @@ XF86VidModeGetGammaRampSize(
|
|||
unsafe internal class XExtData
|
||||
{
|
||||
int number; /* number returned by XRegisterExtension */
|
||||
XExtData next; /* next item on list of data for structure */
|
||||
XExtData next; /* next item on list of buffer for structure */
|
||||
delegate int FreePrivateDelegate(XExtData extension);
|
||||
FreePrivateDelegate FreePrivate; /* called to free private storage */
|
||||
XPointer private_data; /* data private to this extension. */
|
||||
XPointer private_data; /* buffer private to this extension. */
|
||||
};
|
||||
|
||||
#pragma warning restore 0169
|
||||
|
@ -1239,9 +1239,9 @@ XF86VidModeGetGammaRampSize(
|
|||
Button2Mask = (1 << 9),
|
||||
Button3Mask = (1 << 10),
|
||||
Button4Mask = (1 << 11),
|
||||
Button5Mask = (1 << 12),
|
||||
Button6Mask = (1 << 13),
|
||||
Button7Mask = (1 << 14),
|
||||
Button5Mask = (1 << 12),
|
||||
Button6Mask = (1 << 13),
|
||||
Button7Mask = (1 << 14),
|
||||
Button8Mask = (1 << 15),
|
||||
ShiftMask = (1 << 0),
|
||||
LockMask = (1 << 1),
|
||||
|
|
79
Source/Utilities/Audio/Sound.cs
Normal file
79
Source/Utilities/Audio/Sound.cs
Normal file
|
@ -0,0 +1,79 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
#if false
|
||||
/// <summary>Defines methods to load and hold sound buffer.</summary>
|
||||
public class Sound<SampleType> : IDisposable
|
||||
{
|
||||
bool disposed;
|
||||
SoundReader<SampleType> reader;
|
||||
SoundData<SampleType> data;
|
||||
|
||||
public Sound(Stream s)
|
||||
{
|
||||
if (s == null) throw new ArgumentNullException("s", "Must be a valid System.IO.Stream.");
|
||||
|
||||
reader = SoundReader.Create(s);
|
||||
}
|
||||
|
||||
public Sound(string filename)
|
||||
{
|
||||
if (String.IsNullOrEmpty(filename)) throw new ArgumentNullException("s", "Must be a valid System.IO.Stream.");
|
||||
|
||||
reader = SoundReader.Create(filename);
|
||||
}
|
||||
|
||||
#region --- Public Members ---
|
||||
|
||||
public SoundData ReadSamples(int count)
|
||||
{
|
||||
if (count <= 0) throw new ArgumentOutOfRangeException("count", "Must be larger than zero.");
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public SoundData ReadToEnd()
|
||||
{
|
||||
return reader.ReadToEnd();
|
||||
}
|
||||
|
||||
public SoundData SoundData { get { return data; } }
|
||||
|
||||
public void WriteToBuffer(int buffer, int length)
|
||||
{
|
||||
if (buffer == 0) throw new ArgumentOutOfRangeException("buffer", "May not be zero.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- IDisposable Members ---
|
||||
|
||||
/// <summary>Disposes of the sound buffer.</summary>
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
private void Dispose(bool manual)
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
if (manual)
|
||||
reader.Dispose();
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~Sound()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
#endif
|
||||
}
|
214
Source/Utilities/Audio/SoundReader.cs
Normal file
214
Source/Utilities/Audio/SoundReader.cs
Normal file
|
@ -0,0 +1,214 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.IO;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>
|
||||
/// Encapsulates a sound stream and provides decoding and streaming capabilities.
|
||||
/// </summary>
|
||||
/// <typeparam name="SampleType"></typeparam>
|
||||
public class SoundReader : IDisposable
|
||||
{
|
||||
static object reader_lock = new object();
|
||||
static List<SoundReader> readers = new List<SoundReader>();
|
||||
|
||||
bool disposed;
|
||||
Stream stream;
|
||||
SoundReader implementation;
|
||||
|
||||
#region --- Constructors ---
|
||||
|
||||
#region static SoundReader()
|
||||
|
||||
static SoundReader()
|
||||
{
|
||||
// TODO: Plugin architecture for sound formats. This is overkill now that we only have a WaveLoader (future proofing).
|
||||
readers.Add(new WaveReader());
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region protected SoundReader()
|
||||
|
||||
protected SoundReader() { }
|
||||
|
||||
#endregion
|
||||
|
||||
#region public SoundReader(string filename)
|
||||
|
||||
/// <summary>Creates a new SoundReader that can read the specified sound file.</summary>
|
||||
/// <param name="filename">The path to the sound file.</param>
|
||||
/// <returns>A new OpenTK.Audio.SoundReader, which can be used to read from the specified sound file.</returns>
|
||||
public SoundReader(string filename)
|
||||
: this(new FileStream(filename, FileMode.Open))
|
||||
{ }
|
||||
|
||||
#endregion
|
||||
|
||||
#region public SoundReader(Stream s)
|
||||
|
||||
/// <summary>Creates a new SoundReader that can read the specified soundstream.</summary>
|
||||
/// <param name="s">The System.IO.Stream to read from.</param>
|
||||
/// <returns>A new OpenTK.Audio.SoundReader, which can be used to read from the specified sound stream.</returns>
|
||||
public SoundReader(Stream s)
|
||||
{
|
||||
try
|
||||
{
|
||||
lock (reader_lock)
|
||||
{
|
||||
foreach (SoundReader reader in readers)
|
||||
{
|
||||
long pos = s.Position;
|
||||
if (reader.Supports(s))
|
||||
{
|
||||
s.Position = pos;
|
||||
implementation = (SoundReader)
|
||||
reader.GetType().GetConstructor(
|
||||
System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public |
|
||||
System.Reflection.BindingFlags.Instance,
|
||||
null,
|
||||
new Type[] { typeof(Stream) },
|
||||
null)
|
||||
.Invoke(new object[] { s });
|
||||
return;
|
||||
}
|
||||
s.Position = pos;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
s.Close();
|
||||
throw;
|
||||
}
|
||||
throw new NotSupportedException("Could not find a decoder for the specified sound stream.");
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Public Members ---
|
||||
|
||||
#region public virtual bool Supports(Stream s)
|
||||
|
||||
/// <summary>When overriden in a derived class, checks if the decoder supports the specified sound stream.</summary>
|
||||
/// <param name="s">The System.IO.Stream to check.</param>
|
||||
/// <returns>True if the sound stream is supported; false otherwise.</returns>
|
||||
public virtual bool Supports(Stream s)
|
||||
{
|
||||
if (implementation != null)
|
||||
return implementation.Supports(s);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public virtual SoundData<SampleType> ReadSamples(long count)
|
||||
|
||||
/// <summary>
|
||||
/// When overriden in a derived class, reads and decodes the specified number of samples from the sound stream.
|
||||
/// </summary>
|
||||
/// <param name="samples">The number of samples to read and decode.</param>
|
||||
/// <returns>An OpenTK.Audio.SoundData object that contains the decoded buffer.</returns>
|
||||
public virtual SoundData ReadSamples(long count)
|
||||
{
|
||||
if (implementation != null)
|
||||
return implementation.ReadSamples(count);
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public virtual SoundData<SampleType> ReadToEnd()
|
||||
|
||||
/// <summary>
|
||||
/// When overriden in a derived class, reads and decodes the sound stream.
|
||||
/// </summary>
|
||||
/// <returns>An OpenTK.Audio.SoundData object that contains the decoded buffer.</returns>
|
||||
public virtual SoundData ReadToEnd()
|
||||
{
|
||||
if (implementation != null)
|
||||
return implementation.ReadToEnd();
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public virtual int Frequency
|
||||
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public virtual int Frequency
|
||||
{
|
||||
get
|
||||
{
|
||||
if (implementation != null)
|
||||
return implementation.Frequency;
|
||||
else
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
protected set
|
||||
{
|
||||
if (implementation != null)
|
||||
implementation.Frequency = value;
|
||||
else
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public bool EndOfFile
|
||||
|
||||
public bool EndOfFile
|
||||
{
|
||||
get { return stream.Position >= stream.Length; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Protected Members ---
|
||||
|
||||
protected virtual Stream Stream
|
||||
{
|
||||
get { return stream; }
|
||||
set { stream = value; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region IDisposable Members
|
||||
|
||||
/// <summary>Closes the underlying Stream and disposes of the SoundReader resources.</summary>
|
||||
public virtual void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
void Dispose(bool manual)
|
||||
{
|
||||
if (!disposed)
|
||||
{
|
||||
if (manual)
|
||||
if (this.Stream != null)
|
||||
this.Stream.Close();
|
||||
|
||||
disposed = true;
|
||||
}
|
||||
}
|
||||
|
||||
~SoundReader()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
16
Source/Utilities/Audio/SoundReaderException.cs
Normal file
16
Source/Utilities/Audio/SoundReaderException.cs
Normal file
|
@ -0,0 +1,16 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
/// <summary>Represents exceptions related to OpenTK.Audio.SoundReader objects.</summary>
|
||||
public class SoundReaderException : AudioException
|
||||
{
|
||||
/// <summary>Constructs a new SoundReaderException.</summary>
|
||||
public SoundReaderException() : base() { }
|
||||
/// <summary>Constructs a new SoundReaderException with the specified error message.</summary>
|
||||
/// <param name="message">The error message of the SoundReaderException.</param>
|
||||
public SoundReaderException(string message) : base(message) { }
|
||||
}
|
||||
}
|
257
Source/Utilities/Audio/WaveReader.cs
Normal file
257
Source/Utilities/Audio/WaveReader.cs
Normal file
|
@ -0,0 +1,257 @@
|
|||
// created on 2/12/2008 at 5:17 PM
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
using OpenTK.Audio;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace OpenTK.Audio
|
||||
{
|
||||
internal sealed class WaveReader : SoundReader
|
||||
{
|
||||
SoundData decoded_data;
|
||||
|
||||
//RIFF header
|
||||
string signature;
|
||||
int riff_chunck_size;
|
||||
string format;
|
||||
|
||||
//WAVE header
|
||||
string format_signature;
|
||||
int format_chunk_size;
|
||||
short audio_format;
|
||||
short channels;
|
||||
int sample_rate;
|
||||
int byte_rate;
|
||||
short block_align;
|
||||
short bits_per_sample;
|
||||
|
||||
//DATA header
|
||||
string data_signature;
|
||||
int data_chunk_size;
|
||||
|
||||
BinaryReader reader;
|
||||
|
||||
internal WaveReader() { }
|
||||
|
||||
internal WaveReader(Stream s)
|
||||
{
|
||||
reader = new BinaryReader(s);
|
||||
if (!ReadHeaders(reader))
|
||||
throw new NotSupportedException("The specified stream is not supported by this decoder.");
|
||||
}
|
||||
|
||||
#if false
|
||||
/// <summary>
|
||||
/// Writes the WaveSound's data to the specified OpenAL buffer in the correct format.
|
||||
/// </summary>
|
||||
/// <param name="bid">
|
||||
/// A <see cref="System.UInt32"/>
|
||||
/// </param>
|
||||
public void WriteToBuffer(uint bid)
|
||||
{
|
||||
unsafe
|
||||
{
|
||||
//fix the array as a byte
|
||||
fixed (byte* p_Data = _Data)
|
||||
{
|
||||
if (Channels == 1)
|
||||
{
|
||||
if (BitsPerSample == 16)
|
||||
{
|
||||
Console.Write("Uploading 16 bit mono data to OpenAL...");
|
||||
AL.BufferData(bid, ALFormat.Mono16, (IntPtr)p_Data, _Data.Length, SampleRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BitsPerSample == 8)
|
||||
{
|
||||
Console.Write("Uploading 8 bit mono data to OpenAL...");
|
||||
AL.BufferData(bid, ALFormat.Mono8, (IntPtr)p_Data, _Data.Length, SampleRate);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Channels == 2)
|
||||
{
|
||||
if (BitsPerSample == 16)
|
||||
{
|
||||
Console.Write("Uploading 16 bit stereo data to OpenAL...");
|
||||
AL.BufferData(bid, ALFormat.Stereo16, (IntPtr)p_Data, _Data.Length, SampleRate);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (BitsPerSample == 8)
|
||||
{
|
||||
Console.Write("Uploading 8 bit stereo data to OpenAL...");
|
||||
AL.BufferData(bid, ALFormat.Stereo8, (IntPtr)p_Data, _Data.Length, SampleRate);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Writes all relevent information about the WaveSound to the console window.
|
||||
/// </summary>
|
||||
public void DumpParamsToConsole()
|
||||
{
|
||||
Console.WriteLine("AudioFormat:" + AudioFormat);
|
||||
Console.WriteLine("Channels:" + Channels);
|
||||
Console.WriteLine("SampleRate:" + SampleRate);
|
||||
Console.WriteLine("ByteRate:" + ByteRate);
|
||||
Console.WriteLine("BlockAlign:" + BlockAlign);
|
||||
Console.WriteLine("BitsPerSample:" + BitsPerSample);
|
||||
}
|
||||
|
||||
/// <value>
|
||||
/// Returns the WaveSound's raw sound data as an array of bytes.
|
||||
/// </value>
|
||||
public byte[] Data
|
||||
{
|
||||
get
|
||||
{
|
||||
return _Data;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#region --- Public Members ---
|
||||
|
||||
#region public override bool Supports(Stream s)
|
||||
|
||||
/// <summary>
|
||||
/// Checks whether the specified stream contains valid WAVE/RIFF buffer.
|
||||
/// </summary>
|
||||
/// <param name="s">The System.IO.Stream to check.</param>
|
||||
/// <returns>True if the stream is a valid WAVE/RIFF file; false otherwise.</returns>
|
||||
public override bool Supports(Stream s)
|
||||
{
|
||||
BinaryReader reader = new BinaryReader(s);
|
||||
return this.ReadHeaders(reader);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public override SoundData ReadSamples(int samples)
|
||||
|
||||
/// <summary>
|
||||
/// Reads and decodes the specified number of samples from the sound stream.
|
||||
/// </summary>
|
||||
/// <param name="samples">The number of samples to read and decode.</param>
|
||||
/// <returns>An OpenTK.Audio.SoundData object that contains the decoded buffer.</returns>
|
||||
public override SoundData ReadSamples(long samples)
|
||||
{
|
||||
if (samples > reader.BaseStream.Length - reader.BaseStream.Position)
|
||||
samples = reader.BaseStream.Length - reader.BaseStream.Position;
|
||||
|
||||
//while (samples > decoded_data.Data.Length * (bits_per_sample / 8))
|
||||
// Array.Resize<byte>(ref decoded_data.Data, decoded_data.Data.Length * 2);
|
||||
|
||||
decoded_data = new SoundData(new SoundFormat(channels, bits_per_sample, sample_rate),
|
||||
reader.ReadBytes((int)samples));
|
||||
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region public override SoundData ReadToEnd()
|
||||
|
||||
/// <summary>
|
||||
/// Reads and decodes the sound stream.
|
||||
/// </summary>
|
||||
/// <returns>An OpenTK.Audio.SoundData object that contains the decoded buffer.</returns>
|
||||
public override SoundData ReadToEnd()
|
||||
{
|
||||
try
|
||||
{
|
||||
//read the buffer into a byte array, even if the format is 16 bit
|
||||
//decoded_data = new byte[data_chunk_size];
|
||||
|
||||
decoded_data = new SoundData(new SoundFormat(channels, bits_per_sample, sample_rate),
|
||||
reader.ReadBytes((int)reader.BaseStream.Length));
|
||||
|
||||
Debug.WriteLine("decoded!");
|
||||
|
||||
//return new SoundData(decoded_data, new SoundFormat(channels, bits_per_sample, sample_rate));
|
||||
return decoded_data;
|
||||
}
|
||||
catch (SoundReaderException e)
|
||||
{
|
||||
reader.Close();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Protected Members ---
|
||||
|
||||
protected override Stream Stream
|
||||
{
|
||||
get { return base.Stream; }
|
||||
set
|
||||
{
|
||||
base.Stream = value;
|
||||
if (!ReadHeaders(reader))
|
||||
throw new SoundReaderException("Invalid WAVE/RIFF file: invalid or corrupt signature.");
|
||||
|
||||
Debug.Write(String.Format("Opened WAVE/RIFF file: ({0}, {1}, {2}, {3}) ", sample_rate.ToString(), bits_per_sample.ToString(),
|
||||
channels.ToString(), audio_format.ToString()));
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region --- Private Members ---
|
||||
|
||||
// Tries to read the WAVE/RIFF headers, and returns true if they are valid.
|
||||
bool ReadHeaders(BinaryReader reader)
|
||||
{
|
||||
// Don't explicitly call reader.Close()/.Dispose(), as that will close the inner stream.
|
||||
// There's no such danger if the BinaryReader isn't explicitly destroyed.
|
||||
|
||||
// RIFF header
|
||||
signature = new string(reader.ReadChars(4));
|
||||
if (signature != "RIFF")
|
||||
return false;
|
||||
|
||||
riff_chunck_size = reader.ReadInt32();
|
||||
|
||||
format = new string(reader.ReadChars(4));
|
||||
if (format != "WAVE")
|
||||
return false;
|
||||
|
||||
// WAVE header
|
||||
format_signature = new string(reader.ReadChars(4));
|
||||
if (format_signature != "fmt ")
|
||||
return false;
|
||||
|
||||
format_chunk_size = reader.ReadInt32();
|
||||
audio_format = reader.ReadInt16();
|
||||
channels = reader.ReadInt16();
|
||||
sample_rate = reader.ReadInt32();
|
||||
byte_rate = reader.ReadInt32();
|
||||
block_align = reader.ReadInt16();
|
||||
bits_per_sample = reader.ReadInt16();
|
||||
|
||||
data_signature = new string(reader.ReadChars(4));
|
||||
if (data_signature != "data")
|
||||
return false;
|
||||
|
||||
data_chunk_size = reader.ReadInt32();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
|
@ -35,7 +35,7 @@ namespace OpenTK.Graphics
|
|||
static TexturePacker<Glyph> pack;
|
||||
static int texture_width, texture_height;
|
||||
|
||||
int[] data = new int[256]; // Used to upload glyph data to the OpenGL texture.
|
||||
int[] data = new int[256]; // Used to upload glyph buffer to the OpenGL texture.
|
||||
|
||||
object upload_lock = new object();
|
||||
|
||||
|
@ -141,7 +141,7 @@ namespace OpenTK.Graphics
|
|||
/// Adds a glyph to the texture packer.
|
||||
/// </summary>
|
||||
/// <param name="c">The character of the glyph.</param>
|
||||
/// <param name="rectangle">An OpenTK.Math.Box2 that will hold the data for this glyph.</param>
|
||||
/// <param name="rectangle">An OpenTK.Math.Box2 that will hold the buffer for this glyph.</param>
|
||||
private void LoadGlyph(char c, out Box2 rectangle)
|
||||
{
|
||||
if (pack == null)
|
||||
|
@ -215,7 +215,7 @@ namespace OpenTK.Graphics
|
|||
/// <param name="glyph">The character corresponding to this glyph.</param>
|
||||
/// <param name="width">The width of this glyph.</param>
|
||||
/// <param name="height">The height of this glyph (line spacing).</param>
|
||||
/// <param name="textureRectangle">The bounding box of the texture data of this glyph.</param>
|
||||
/// <param name="textureRectangle">The bounding box of the texture buffer of this glyph.</param>
|
||||
/// <param name="texture">The handle to the texture that contains this glyph.</param>
|
||||
/// <returns>True if the glyph has been loaded, false otherwise.</returns>
|
||||
/// <seealso cref="LoadGlyphs"/>
|
||||
|
|
Loading…
Reference in a new issue