internal SoundEffect(string fileName) { AudioEngine.EnsureInit(); buffer = AL.GenBuffer(); var error = AL.GetError(); if (error != ALError.NoError) { throw new OpenALException(error, "borked generation. ALError: " + error.ToString()); } XRamExtension XRam = new XRamExtension(); if (XRam.IsInitialized) { XRam.SetBufferMode(1, ref buffer, XRamExtension.XRamStorage.Hardware); } AudioReader sound = new AudioReader(fileName); var sounddata = sound.ReadToEnd(); AL.BufferData(buffer, sounddata.SoundFormat.SampleFormatAsOpenALFormat, sounddata.Data, sounddata.Data.Length, sounddata.SoundFormat.SampleRate); error = AL.GetError(); if (error != ALError.NoError) { throw new OpenALException(error, "unable to read " + fileName); } _name = Path.GetFileNameWithoutExtension(fileName); }