Exemplo n.º 1
0
 void ISoundStopEventReceiver.OnSoundStopped(ISound sound, StopEventCause reason, object userData)
 {
     _soundPlaying = null;
     if (PlayFinished != null)
     {
         PlayFinished(_audioClip);
         _audioClip = null;
     }
 }
Exemplo n.º 2
0
 public bool Play(AudioClip clip)
 {
     if (!File.Exists(clip.CacheFileName))
     {
         return false;
     }
     StringBuilder sb = new StringBuilder(100);
     uint lRet = mciSendString(string.Format("open \"{0}\" alias track", clip.CacheFileName), sb, 0, IntPtr.Zero);
     mciSendString("set track time format ms", sb, 0, IntPtr.Zero);
     mciSendString("play track", sb, 0, IntPtr.Zero);
     _playingClip = clip;
     _sentStopEvent = false;
     return true;
 }
Exemplo n.º 3
0
 public bool Play(AudioClip clip)
 {
     if (!File.Exists(clip.CacheFileName))
     {
         return false;
     }
     // we have to read it into memory and then play from memory,
     // because the built-in Irrklang play from file function keeps
     // the file open and locked
     byte[] audioData = File.ReadAllBytes(clip.CacheFileName);
     ISoundSource source = _soundEngine.AddSoundSourceFromMemory(audioData, clip.CacheFileName);
     _soundPlaying = _soundEngine.Play2D(source, false, false, false);
     if (_soundPlaying == null)
     {
         return false;
     }
     _audioClip = clip;
     _soundPlaying.setSoundStopEventReceiver(this);
     return true;
 }
Exemplo n.º 4
0
 private void _previewer_PlayFinished(AudioClip clip)
 {
     btnPlay.Invoke(new NoParametersDelegate(ResetControlsForSoundFinished));
 }