Exemplo n.º 1
0
        public void Play()
        {
            if (this._player == null)
            {
                return;
            }

            Sound.Enqueue(_player.Start);
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        public void Play()
        {
            Sound.Enqueue(() =>
            {
                lock (Sound.Map)
                {
                    if (this.Stream == null)
                    {
                        return;
                    }

                    AudioStream.Play(this.Stream);
                }
            }
                          );
        }
Exemplo n.º 5
0
        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);
        }