public void StopSourceVoice(StopReason stopReason) { JMOD.Sound.DebugOutput("{0} - StopSourceVoice called in SourceVoiceSlot {1}", DateTime.Now.TimeOfDay, ID); if (CurrentSourceVoice != null && !CurrentSourceVoice.Done) { var result = CurrentSourceVoice.Stop(); if (result.IsFailure) // to be removed later { throw new Exception(result.Code + " - " + result.Description); } } if (stopReason == StopReason.Ended) { CurrentChannel.HandleFinishedSlot(true); } else if (stopReason == StopReason.Stopped) { CurrentChannel.HandleFinishedSlot(false); } else if (stopReason == StopReason.Stolen) { CurrentChannel.HandleStolenSlot(); } if (CurrentSourceVoice != null) { JMOD.Sound.DebugOutput("Flushing buffers"); var result = CurrentSourceVoice.FlushSourceBuffers(); if (result.IsFailure) // to be removed later { throw new Exception(result.Code + " - " + result.Description); } } system.ReleaseSourceVoiceSlot(this); CurrentChannel = null; CurrentSourceVoice = null; }
public void StopSourceVoice(StopReason stopReason) { JMOD.Sound.DebugOutput("{0} - StopSourceVoice called in Stream SourceVoiceSlot", DateTime.Now.TimeOfDay); if (CurrentSourceVoice != null) { Result result; if (!CurrentSourceVoice.Done) { result = CurrentSourceVoice.Stop(); if (result.IsFailure) // to be removed later { throw new Exception(result.Code + " - " + result.Description); } } result = CurrentSourceVoice.FlushSourceBuffers(); if (result.IsFailure) { throw new Exception(result.Code + " - " + result.Description); } } if (stopReason == StopReason.Ended) { CurrentChannel.HandleFinishedSlot(true); } else if (stopReason == StopReason.Stopped) { CurrentChannel.HandleFinishedSlot(false); } else { throw new NotImplementedException(); } CurrentChannel = null; }