/// <summary>
 ///     Plays the raw loop track at the start of the raw-loop section.
 /// </summary>
 public void StopRawLoop()
 {
     if (RawLoopTrack == null)
     {
         return;
     }
     // DebugHelper.WriteLine("Pausing raw-loop");
     AudioStreamHelper.Pause(RawLoopTrack);
 }
        public void Pause()
        {
            var streamKeys = GetStreamKeys();

            foreach (var streamKey in streamKeys)
            {
                var audioStream = GetAudioStream(streamKey);
                AudioStreamHelper.Pause(audioStream);
            }
        }
        /// <summary>
        ///     Starts playing the raw loop track at the offset of the raw-loop section.
        /// </summary>
        public void PlayRawLoop()
        {
            if (RawLoopTrack == null)
            {
                return;
            }

            // DebugHelper.WriteLine("Playing in raw-loop mode");

            AudioStreamHelper.Pause(RawLoopTrack);
            AudioStreamHelper.SetPosition(RawLoopTrack, RawLoopTrack.RawLoopOffset);
            AudioStreamHelper.Play(RawLoopTrack);
        }
        public void Unload(string streamKey)
        {
            var streamSection = GetStreamSection(streamKey);

            if (streamSection == null)
            {
                return;
            }

            AudioStreamHelper.Pause(streamSection.AudioStream);

            lock (_audioStreamEvents)
            {
                _audioStreamEvents.RemoveAll(x => x.StreamKey == streamKey);
            }

            lock (streamSection)
            {
                foreach (var sync in streamSection.AudioSections.SelectMany(section => section.AudioSyncs))
                {
                    RemoveSyncFromStream(streamSection.AudioStream, sync);
                }
            }

            lock (streamSection.AudioStream)
            {
                foreach (var sync in streamSection.AudioStream.AudioSyncs)
                {
                    RemoveSyncFromStream(streamSection.AudioStream, sync);
                }
                streamSection.AudioStream.AudioSyncs.Clear();
            }

            AudioStreamHelper.RemoveFromMixer(streamSection.AudioStream, Output);
            AudioStreamHelper.UnloadAudio(streamSection.AudioStream);

            streamSection.AudioStream.SyncProc = null;

            lock (_streamSections)
            {
                _streamSections.Remove(streamSection);
            }
        }
 private void PlayNextSection(AudioSection audioSection, AudioStreamSection streamSection)
 {
     if (!audioSection.AutoPlayNextSection)
     {
         // DebugHelper.WriteLine("Pause " + streamSection.AudioStream.Description);
         AudioStreamHelper.Pause(streamSection.AudioStream);
     }
     else
     {
         var nextSection = GetNextSection(audioSection, streamSection);
         if (nextSection != null)
         {
             QueueSection(streamSection.Key, nextSection.Key);
         }
         else
         {
             // DebugHelper.WriteLine("Pause " + streamSection.AudioStream.Description);
             AudioStreamHelper.Pause(streamSection.AudioStream);
         }
     }
 }
        public void Pause(string streamKey)
        {
            var audioStream = GetAudioStream(streamKey);

            AudioStreamHelper.Pause(audioStream);
        }