Example #1
0
        /// <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);
        }
Example #2
0
 void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData)
 {
     _soundPlaying = null;
     if (PlayFinished != null)
     {
         PlayFinished(_audioClip);
         _audioClip = null;
     }
 }
Example #3
0
 void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData)
 {
     _soundPlaying = null;
     if (PlayFinished != null)
     {
         PlayFinished(_audioClip);
         _audioClip = null;
     }
 }
Example #4
0
 /// <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");
        }
Example #8
0
 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");
        }
Example #10
0
 /// <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;
     }
 }
Example #11
0
        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);
            }
        }
Example #12
0
        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
                                         ));
        }
Example #13
0
        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);
            }
        }
Example #14
0
 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);
        }
Example #17
0
 void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData)
 {
     _soundPlaying = null;
     PlayFinished?.Invoke(_audioClip);
 }
Example #18
0
 /// <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();
 }
Example #19
0
 /// <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);
 }
Example #21
0
 public void OnSoundStopped(ISound sound, StopEventCause reason, object userData)
 {
     _form.HandleStop(reason);
 }