Пример #1
0
 public RMusic(FileStream fileStream, string name)
 {
     stream = new RAudioStream(fileStream, name);
     stream.Open();
     stream.Finished = new EventHandler((o, e) =>
     {
         if (Finished != null)
         {
             Finished.Invoke(o, e);
         }
     });
 }
Пример #2
0
        public bool FillBuffer(RAudioStream stream, int bufferId)
        {
            int readSamples;

            lock (readMutex)
            {
                readSamples = stream.Reader.ReadSamples(readSampleBuffer, 0, BufferSize);
                CastBuffer(readSampleBuffer, castBuffer, readSamples);
            }
            AL.BufferData(bufferId, stream.Reader.Channels == 1 ? ALFormat.Mono16 : ALFormat.Stereo16, castBuffer,
                          readSamples * sizeof(short), stream.Reader.SampleRate);
            ALHelper.Check();



            return(readSamples != BufferSize);
        }
Пример #3
0
 internal bool RemoveStream(RAudioStream stream)
 {
     lock (iterationMutex)
         return(streams.Remove(stream));
 }
Пример #4
0
 internal bool AddStream(RAudioStream stream)
 {
     lock (iterationMutex)
         return(streams.Add(stream));
 }