/// <summary>
 /// To be called each time the streaming process is stopped or suspended.
 /// </summary>
 public void NotifyStreamingStoppedSuspended(SoundStreamingStatus streamingStatus)
 {
     foreach (SoundFilter filter in filters)
     {
         filter.OnStreamingStoppedSuspended(streamingStatus);
     }
 }
Esempio n. 2
0
 protected override void OnStreamingStoppedSuspended(SoundStreamingStatus streamingStatus)
 {
     base.OnStreamingStoppedSuspended(streamingStatus);
     if (mp3Writer != null)
     {
         mp3Writer.Close();
         mp3Writer = null;
     }
 }
Esempio n. 3
0
 protected internal override void OnStreamingStoppedSuspended(SoundStreamingStatus streamingStatus)
 {
     try
     {
         base.OnStreamingStoppedSuspended(streamingStatus);
     }
     finally
     {
         DestroyBuffer();
     }
 }
Esempio n. 4
0
        protected internal override void OnStreamingStoppedSuspended(SoundStreamingStatus streamingStatus)
        {
            try
            {
                base.OnStreamingStoppedSuspended(streamingStatus);
                BufferStream.Position = 0; //Rewind to the beginning.

                BinaryWriter output = new BinaryWriter(Output);
                BinaryReader input  = new BinaryReader(BufferStream);
                RewriteData(input, output);

                output.Flush();
            }
            finally
            {
                DestroyBuffer();
            }
        }
Esempio n. 5
0
        protected internal override void OnStreamingStoppedSuspended(SoundStreamingStatus streamingStatus)
        {
            base.OnStreamingStoppedSuspended(streamingStatus);

            if (Output != null && writer != null)
            {
                Output.Flush();
                //Set the sample lenght. It may be later overriden if the streaming is again resumed.

                long curPos = Output.Position;

                writer.Seek(4, SeekOrigin.Begin);                      // Seek to the length descriptor of the RIFF file.
                writer.Write((int)(streamingStatus.BytesPassed + 36)); // Write the file length, minus first 8 bytes of RIFF description.
                writer.Seek(40, SeekOrigin.Begin);                     // Seek to the data length descriptor of the RIFF file.
                writer.Write(streamingStatus.BytesPassed);             // Write the length of the sample data in bytes.

                //Return to the oryginal position (we're assuming that more data can be appended).
                //But if not, if the stream is closed then the above assures correct header values.
                Output.Position = curPos;

                Output.Flush();
            }
        }
Esempio n. 6
0
 /// <summary>
 /// Called each time the streaming process is stopped or suspended.
 /// </summary>
 /// <param name="streamingStatus">Current status of streaming process (summary of all
 /// stop-resume sessions).</param>
 internal protected virtual void OnStreamingStoppedSuspended(SoundStreamingStatus streamingStatus)
 {
 }