Example #1
0
 /// <summary>
 ///     Creates a new stream instance using the provided stream as a source.
 ///     Will also read the first frame of the MP3 into the internal buffer.
 ///     TODO: allow selecting stereo or mono in the constructor (note that this also requires "implementing" the stereo format).
 /// </summary>
 public MP3Stream(Stream sourceStream, int chunkSize)
 {
     IsEOF = false;
     FormatRep = SoundFormat.Pcm16BitStereo;
     m_SourceStream = sourceStream;
     m_BitStream = new Bitstream(new PushbackStream(m_SourceStream, chunkSize));
     m_Buffer = new Buffer16BitStereo();
     m_Decoder.OutputBuffer = m_Buffer;
     // read the first frame. This will fill the initial buffer with data, and get our frequency!
     if (!ReadFrame())
         IsEOF = true;
 }
Example #2
0
 /// <summary>
 ///     Creates a new stream instance using the provided stream as a source.
 ///     Will also read the first frame of the MP3 into the internal buffer.
 ///     TODO: allow selecting stereo or mono in the constructor (note that this also requires "implementing" the stereo format).
 /// </summary>
 public MP3Stream(Stream sourceStream, int chunkSize)
 {
     IsEOF                  = false;
     FormatRep              = SoundFormat.Pcm16BitStereo;
     m_SourceStream         = sourceStream;
     m_BitStream            = new Bitstream(new PushbackStream(m_SourceStream, chunkSize));
     m_Buffer               = new Buffer16BitStereo();
     m_Decoder.OutputBuffer = m_Buffer;
     // read the first frame. This will fill the initial buffer with data, and get our frequency!
     if (!ReadFrame())
     {
         IsEOF = true;
     }
 }