OpenAL でのサウンドの読み込みに問題があります。
// in SoundManager.cs
public void LoadSound(string soundId, string path)
{
// Generate a buffer.
int buffer = -1;
Al.alGenBuffers(1, out buffer);
int errorCode = Al.alGetError();
System.Diagnostics.Debug.Assert(errorCode == Al.AL_NO_ERROR);
int format;
float frequency;
int size;
System.Diagnostics.Debug.Assert(File.Exists(path));
IntPtr data = Alut.alutLoadMemoryFromFile(path, out format, out size,
out frequency);
System.Diagnostics.Debug.Assert(data != IntPtr.Zero, "Problem");
// Load wav data into the generated buffer.
Al.alBufferData(buffer, format, data, size, (int)frequency);
// Everything seems ok, add it to the library.
_soundIdentifier.Add(soundId, new SoundSource(buffer, path));
}
// Form.cs
private void InitializeSounds()
{
_soundManager.LoadSound("effect", "soundA.wav");
}
soundIdentifier はディクショナリで、SoundSource にはサウンドの情報が保持されます。最初の文字列は、「牛」、「馬」などの通常のサウンド名です。
Form.cs から InitializeSounds を呼び出し、LoadSound はサウンド マネージャーのメソッドです。
Alut.alutLoadMemoryFromFile はエラーを引き起こし、何らかの理由で null ポインターを返します。
残りは簡単なコードですが、ご理解いただければ幸いです。
私は Tao.OpenAL を使用して c# で作業しています。