public void Play() { if (this._player == null) { return; } Sound.Enqueue(_player.Start); }
public static Sound Create(string assetPath, float volume, bool looping) { MediaPlayer player = new MediaPlayer(); Sound sound = new Sound(player); player.SetDataSource(Game.contextInstance.Assets.OpenFd(assetPath).FileDescriptor); player.Prepared += sound.OnPrepared; sound.Looping = looping; sound.Volume = volume; Sound.Enqueue(player.Prepare); return(sound); }
public static Sound Create(string assetPath, float volume, bool looping) { MediaPlayer player = new MediaPlayer(); Sound sound = new Sound(player); //This breaks the platformer sample. Not sure if it works anywhere else //player.SetDataSource(Game.contextInstance.Assets.OpenFd(assetPath).FileDescriptor); player.SetDataSource(assetPath); player.Prepared += sound.OnPrepared; sound.Looping = looping; sound.Volume = volume; Sound.Enqueue(player.Prepare); return(sound); }
public void Play() { Sound.Enqueue(() => { lock (Sound.Map) { if (this.Stream == null) { return; } AudioStream.Play(this.Stream); } } ); }
public static Sound Create(string url, float volume, bool looping) { Sound sound = null; AudioStream *pStream; lock (Sound.Map) { pStream = AudioStream.AllocateStream(); sound = new Sound(pStream); Sound.Map[(IntPtr)pStream] = sound; } sound.Looping = looping; Sound.Enqueue(() => AudioStream.Create(pStream, url)); sound.Volume = volume; return(sound); }