Esempio n. 1
0
 public OggSong(Stream stream, bool seekable)
 {
     decoder = new OggDecoder();
     decoder.Initialize(stream, seekable);
     effect = new DynamicSoundEffectInstance(decoder.SampleRate, (decoder.Stereo ? AudioChannels.Stereo : AudioChannels.Mono));
     effect.BufferNeeded += BufferNeeded;
     bufferCount          = -1;
 }
Esempio n. 2
0
    public CSVOggPlayer(System.IO.Stream s, bool seek = false)
    {
        decoder.Initialize(s, seek);
        it = decoder.GetEnumerator();


        Debug.Log(now);
        isPlaying = true;
        Debug.Log("OggPlayer");
    }
Esempio n. 3
0
        /// <summary>
        /// Decodes an ogg stream into a full PCM chunk (useful for sound effects)
        /// </summary>
        /// <param name="input">Input ogg data</param>
        /// <returns>Fully decoded PCM data</returns>
        public static PCMChunk Decode(Stream input)
        {
            OggDecoder decoder = new OggDecoder();

            decoder.Initialize(input);
            MemoryStream ms = new MemoryStream(4096);

            foreach (PCMChunk chunk in decoder)
            {
                ms.Write(chunk.Bytes, 0, chunk.Length);
            }
            return(new PCMChunk {
                Bytes = ms.ToArray(), Channels = decoder.Channels, Length = (int)ms.Length, Rate = decoder.SampleRate
            });
        }