/// <summary> /// This function is called from the Irrklang Engine if the Playback of an Sound is finished or the SoundSource is deleted from the Engine /// </summary> /// <param name="sound"></param> /// <param name="reason"></param> /// <param name="userData"></param> public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { int Index = FPlayedSounds.IndexOf(sound); FCurrentPos[Index] = (double)0.0; FFinishedSounds.Add(Index); }
void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _soundPlaying = null; if (PlayFinished != null) { PlayFinished(_audioClip); _audioClip = null; } }
void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _soundPlaying = null; if (PlayFinished != null) { PlayFinished(_audioClip); _audioClip = null; } }
/// <summary> /// This function is called from the Irrklang Engine if the Playback of an Sound is finished or the SoundSource is deleted from the Engine /// </summary> /// <param name="sound"></param> /// <param name="reason"></param> /// <param name="userData"></param> public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { Monitor.TryEnter(thisLock); try { FFinishedSounds.Add(sound); } finally { Monitor.Exit(thisLock); } }
/// <summary> /// 再生が停止した時に呼ばれます。 /// </summary> void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause cause, object userData) { var handler = Interlocked.Exchange(ref Stopped, null); if (handler != null) { var reason = ConvertReason(cause); handler(null, new SoundStopEventArgs(reason)); } }
/// <summary> /// 再生が停止した時に呼ばれます。 /// </summary> void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause cause, object userData) { var handler = Interlocked.Exchange(ref Stopped, null); if (handler != null) { var reason = ConvertReason(cause); handler(null, new SoundStopEventArgs(reason)); } }
private SoundStopReason ConvertReason(StopEventCause cause) { switch (cause) { case StopEventCause.SoundFinishedPlaying: return SoundStopReason.FinishedPlaying; case StopEventCause.SoundStoppedByUser: return SoundStopReason.StoppedByUser; case StopEventCause.SoundStoppedBySourceRemoval: return SoundStopReason.StoppedBySourceRemoval; } throw new ArgumentException("cause"); }
public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { if (PlaybackComplete != null && reason.HasFlag(StopEventCause.SoundFinishedPlaying)) { if (_synchronizeInvoke.InvokeRequired) { _synchronizeInvoke.BeginInvoke(new Action(() => PlaybackComplete()), null); } else { PlaybackComplete(); } } }
private SoundStopReason ConvertReason(StopEventCause cause) { switch (cause) { case StopEventCause.SoundFinishedPlaying: return(SoundStopReason.FinishedPlaying); case StopEventCause.SoundStoppedByUser: return(SoundStopReason.StoppedByUser); case StopEventCause.SoundStoppedBySourceRemoval: return(SoundStopReason.StoppedBySourceRemoval); } throw new ArgumentException("cause"); }
/// <summary> /// The event handler for when the music engine stops playing a sound /// </summary> /// <param name="sound">the sound that was stopped</param> /// <param name="cause">the reason why the sound was stopped</param> /// <param name="userData">extra data (unused)</param> public void OnSoundStopped(ISound sound, StopEventCause cause, object userData) { //play the next song if song finished naturally if (cause == StopEventCause.SoundFinishedPlaying) { window.playNextSong(); } //the stop button has pressed, so stop playing permanently else if (cause == StopEventCause.SoundStoppedByUser) { return; } else { return; } }
public void HandleStop(StopEventCause stopEventCause) { if (stopEventCause != StopEventCause.SoundFinishedPlaying) { return; } if (TracksList.InvokeRequired) { SetCallback d = HandleStop; BeginInvoke(d, stopEventCause); } else { // We continue to the next track SetTrackToPlay(CurrentTrack.NextTrack); } }
public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { lock (this) { if (Finished) { return; } Finished = true; } //this throws an error //TODO make sure the sound is disposed eventually //sound.Dispose(); PlaybackFinished?.Invoke(this, new ISoundPlaybackService.PlaybackEventArgs( sound: this.Sound, fromStop: false )); }
private void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { if (_soundSource != null) { _soundSource.Dispose(); } _soundSource = null; //this dispose is here because sometimes sounds (over 4 seconds) were getting left in a locked state //but this didn't actually help. ((IrrKlang.ISoundEngine)userData).Dispose(); var handler = PlaybackStopped; if (handler != null) { handler(this, EventArgs.Empty); } }
public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _session.OnSoundStopped(sound, reason, userData); }
public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _session.OnSoundStopped(sound,reason,userData); }
private void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { if (_soundSource != null) _soundSource.Dispose(); _soundSource = null; //this dispose is here because sometimes sounds (over 4 seconds) were getting left in a locked state //but this didn't actually help. ((IrrKlang.ISoundEngine)userData).Dispose(); var handler = PlaybackStopped; if (handler != null) handler(this, EventArgs.Empty); }
void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _soundPlaying = null; PlayFinished?.Invoke(_audioClip); }
/// <summary> /// Plays the next song. /// </summary> /// <param Name="sound">The ISound which has been stopped.</param> /// <param Name="reason">The reason why the sound stop event was fired.</param> /// <param Name="userData">UserData pointer sets by the user when registering the interface.</param> public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { PlayMusic(); }
/// <summary> /// Plays the next song. /// </summary> /// <param Name="sound">The ISound which has been stopped.</param> /// <param Name="reason">The reason why the sound stop event was fired.</param> /// <param Name="userData">UserData pointer sets by the user when registering the interface.</param> public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { PlayMusic(); }
void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _hasStopped = true; Stopped?.Invoke(this); }
public void OnSoundStopped(ISound sound, StopEventCause reason, object userData) { _form.HandleStop(reason); }