public WaveSoundPlayer(WaveFile w, bool loop) { ac = new AudioContext (); bufferlist = new List<int> (NUM_BUFFERS); bufferlist.AddRange (AL.GenBuffers (NUM_BUFFERS)); source = AL.GenSource (); this._PlayState = PlayState.NotLoaded; wfile = w; bufferlist.ForEach (x => { byte[] buf = new byte[BUFFER_SIZE]; buf = wfile.DataBinary.ReadBytes(BUFFER_SIZE); AL.BufferData(x,wfile.SoundFormat,buf,buf.Length,wfile.SampleRate); }); AL.SourceQueueBuffers (source, NUM_BUFFERS, bufferlist.ToArray ()); if (loop) AL.Source (source, ALSourceb.Looping, true); System.Diagnostics.Debug.WriteLine (AL.GetSourceState(source).ToString()); this._PlayState = PlayState.Stopped; }
public WaveSoundPlayer(WaveFile w) : this(w,false) { }