Skip to content

Instantly share code, notes, and snippets.

@chrisforbes
Created January 20, 2010 05:50
Show Gist options
  • Save chrisforbes/281641 to your computer and use it in GitHub Desktop.
Save chrisforbes/281641 to your computer and use it in GitHub Desktop.
static class OpenAL
{
public const int ALC_DEFAULT_DEVICE_SPECIFIER = 4100;
public const int AL_FORMAT_MONO16 = 4353;
public const int AL_FORMAT_MONO8 = 4352;
public const int AL_FORMAT_STEREO16 = 4355;
public const int AL_FORMAT_STEREO8 = 4354;
public const int AL_PITCH = 4099;
public const int AL_GAIN = 4106;
public const int AL_POSITION = 4100;
public const int AL_VELOCITY = 4102;
public const int AL_BUFFER = 4105;
public const int AL_LOOPING = 4103;
public const int AL_TRUE = 1;
public const int AL_FALSE = 0;
//[DllImport("openal32", CharSet=CharSet.Ansi)]
//[return: MarshalAs(UnmanagedType.)]
//public static extern string alcGetString(IntPtr device, int attribute);
[DllImport("openal32")]
public static extern IntPtr alcOpenDevice(string dev);
[DllImport("openal32")]
public static extern IntPtr alcCreateContext(IntPtr dev, IntPtr reserved);
[DllImport("openal32")]
public static extern int alcMakeContextCurrent(IntPtr ctx);
[DllImport("openal32")]
public static extern void alListenerf(int attribute, float value);
[DllImport("openal32")]
public static extern void alGenBuffers(int numBuffers, out int buffer);
[DllImport("openal32")]
public static extern void alBufferData(int buffer, int format, byte[] data, int size, int frequency);
[DllImport("openal32")]
public static extern void alGenSources(int numSources, out int source);
[DllImport("openal32")]
public static extern void alSourcef(int source, int attribute, float value);
[DllImport("openal32")]
public static extern void alSource3f(int source, int attribute, float v1, float v2, float v3);
[DllImport("openal32")]
public static extern void alSourcei(int source, int attribute, int value);
[DllImport("openal32")]
public static extern void alSourcePlay(int source);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment