public void StopSound()
 {
     if (Sound == null || Sound.Finished)
     {
         return;
     }
     Sound.Stop();
 }
示例#2
0
        /// <summary>
        /// Turn on the music box and play randomized
        /// background music.
        /// </summary>
        /// <param name="status">The new music box status</param>
        public void MusicBox(MusicBoxStatus status)
        {
            currentStatus = status;
            int i = 0;

            switch (currentStatus)
            {
            case MusicBoxStatus.Play:
                // Statemachine PLAY
                if (currentTrack != null && currentTrack.Playing() == true)
                {
                    currentTrack.Stop();
                }
                // if no music is playing, create random and play
                if (currentTrack == null || currentTrack.Playing() == false)
                {
                    // New index not the same
                    int t;
                    while ((t = rnd.Next(0, mtracks)) == midx)
                    {
                    }
                    midx = t;
                    // Load new track
                    foreach (KeyValuePair <string, SoundType> s in lib)
                    {
                        if (s.Value == SoundType.Music)
                        {
                            if (midx == i)
                            {
                                currentTrack = CreateSound(s.Key);
                                break;
                            }
                            i++;
                        }
                    }
                }
                if (!currentTrack.Playing())
                {
                    currentTrack.Play();
                    DisplayArtistName();
                }
                break;

            case MusicBoxStatus.Stop:
                // Statemachine STOP
                currentTrack.Stop();
                break;

            case MusicBoxStatus.Pause:
                // Statemachine PAUSE
                currentTrack.Pause();
                break;
            }
        }
示例#3
0
 public void SetMusic(ISound source)
 {
     try
     {
         if (currentMusic != null)
         {
             currentMusic.Stop();
         }
     }
     catch (UnityEngine.MissingReferenceException)
     {
     }
     currentMusic = source;
 }
示例#4
0
        public void Stop()
        {
            _timer.Stop();
            if (_currentPlayback != null)
            {
                _currentPlayback.Stop();
                _currentPlayback.Dispose();
                _currentPlayback = null;
            }

            TrackDuration  = TimeSpan.FromSeconds(0);
            SampleRate     = 0;
            BytesPerSecond = 0;
            Channels       = 0;
            NotifyPlayBackStateChanged();
        }
示例#5
0
 public void stop()
 {
     if (_audio != null)
     {
         _audio.Stop();
     }
 }
 public void StopPlaying()
 {
     if (_sound != null && !_sound.Finished)
     {
         _sound.Stop();
     }
     if (IsPlaying)
     {
         _player.Stop();
     }
     try
     {
         _engine.RemoveAllSoundSources();
     }
     catch (Exception)
     {
         // We'll just ignore any errors on stopping the sounds (they probably aren't playing).
     }
     _engine.StopAllSounds();
     if (_sound != null)
     {
         _sound.Dispose();
     }
     _sound = null;
 }
示例#7
0
 private void btnStop_Click(object sender, EventArgs e)
 {
     musica.Stop();
     btnPlay.Enabled  = true;
     btnStop.Enabled  = false;
     btnPause.Enabled = false;
 }
示例#8
0
 private void UpdateSlider()
 {
     if (MediaPosition != null && mediaType == MediaType.Video)
     {
         trackBar1.Maximum = (int)MediaPosition.Duration;
         trackBar1.Value   = (int)MediaPosition.CurrentPosition;
         if (MediaPosition.Duration == MediaPosition.CurrentPosition)
         {
             //Video fertig
             MediaControl.Stop();
             MediaPosition.CurrentPosition = 0;
             SetPictureBoxPause(false);
         }
     }
     else if (mediaType == MediaType.Audio)
     {
         trackBar1.Maximum = (int)(currentSound.PlayLength / 1000);
         trackBar1.Value   = (int)(currentSound.PlayPosition / 1000);
         if (currentSound.Finished)
         {
             //sollte eig. nicht in UpdateSlider sein, aber ist so einfacher
             currentSound.Stop();
             currentSound.PlayPosition = 0;
             trackBar1.Value           = 0;
             timer1.Stop();
             SetPictureBoxPause(false);
         }
     }
     else
     {
         trackBar1.Maximum = 1;
         trackBar1.Value   = 0;
     }
 }
示例#9
0
 public void Stop()
 {
     if (_soundPlaying != null)
     {
         _soundPlaying.Stop();
     }
 }
示例#10
0
        /// <summary>
        /// Executes if the player has finished the level
        /// </summary>
        public void Finish()
        {
            isFinish = true;

            // Stop weapon fireing
            Weapons.PrimaryWeapon.EndFire();
            // Weapons.SecondaryWeapon.EndFire();

            if (game.World.Finish == null)
            {
                // Create finish object
                game.World.Finish = new Finish(game);
                game.World.AddObject(game.World.Finish);
                //game.GameStates.Gameplayed = true;
                // Set the flag position
                Vector3 v = Velocity;
                if (Velocity.Length() != 0)
                {
                    v.Normalize();
                }
                game.World.Finish.LocalPosition = Vector3.Add(LocalPosition, v * 160);
                game.World.Finish.LocalRotation = Quaternion.CreateFromAxisAngle(v, 45);

                // Slow down the speed of the player
                this.Velocity = Vector3.Zero;
            }
            if (hurryUpEfx != null)
            {
                hurryUpEfx.Loop = false;
                hurryUpEfx.Stop();
                hurryUpEfx.Dispose();
            }
            if (meshSoundEfx != null)
            {
                meshSoundEfx.Loop = false;
                meshSoundEfx.Stop();
                meshSoundEfx.Dispose();
            }
            Enabled = false;
            game.GameStates.Gameplayed = true;
            //if (Helper.Lock("DIEorDIE", TimeSpan.FromSeconds(7)))
            //{
            // game.GameStates.Reset();
            //game.GameStates.Gameplayed = true;
            // game.GameStates.SetStateMenu();
            //}
        }
示例#11
0
 public void StopPlaying()
 {
     if (_sound != null && !_sound.Finished)
     {
         _sound.Stop();
     }
     _engine.StopAllSounds();
 }
示例#12
0
 public bool ExStop(int num)
 {
     if (num < count)
     {
         sound.Stop(num.ToString());
         return(true);
     }
     return(false);
 }
示例#13
0
        public void StopSound(string soundName)
        {
            ISound sound = FindSound(soundName);

            if (sound != null)
            {
                sound.Stop();
            }
        }
示例#14
0
 public void Stop()
 {
     if (_soundPlaying != null)
     {
         _soundPlaying.Stop();
         _soundPlaying = null;
         _soundEngine.RemoveAllSoundSources();
         _soundEngine.StopAllSounds();
     }
 }
示例#15
0
        /// <summary>
        /// Called when enemy dies.
        /// </summary>
        private void OnDeath()
        {
            // Hier stirbt der Enemy
            dying = true;
            //Explosions-Effekt
            IEffect fx;
            Random  rnd = new Random((int)GlobalPosition.Z);
            int     w   = rnd.Next(0, 100);

            if (w <= 10)
            {
                fx = game.Effects.CreateEffect("ExplosionBig"); // BIG 10%
            }
            else if (w <= 40)
            {
                fx = game.Effects.CreateEffect("ExplosionMiddle"); // MIDDLE 30%
            }
            else
            {
                fx = game.Effects.CreateEffect("Explosion"); // NORMAL 60%
            }
            fx.Parent = this;
            game.World.AddEffect(fx);
            fx.Play(TimeSpan.FromSeconds(1.5f), true);
            // stop rotor if avaible;
            if (modelAnimationPart != null)
            {
                modelAnimationPart.StopRotationAnimation();
            }
            if (FxSound != null)
            {
                FxSound.Stop();
            }
            FxSound = null;
            // Score aktualisieren
            game.GameStates.Score.KilledEnemy++;
            game.GameStates.Score.AddPoints(typeDesc.ScorePoints);
            Explode();

            //TODO: Implement Item-List

            Item.CreateItem(game, Item.RandomItemName(itemList, itemChance), this);
        }
示例#16
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);

            //Yse.Yse.System().init();
            //Global = new YSE.Global(Yse.Yse.System());
            Y = new YSE.YseInterface(OnMessage);
            Y.System.Init();

            FileManager = Y.BufferIO as YSE.BufferIO;

            byte[] fileBuffer = default(byte[]);
            using (StreamReader sr = new StreamReader(Assets.Open("countdown.ogg")))
            {
                using (var memstream = new MemoryStream())
                {
                    sr.BaseStream.CopyTo(memstream);
                    fileBuffer = memstream.ToArray();
                }
            }

            FileManager.AddBuffer("file1", fileBuffer, fileBuffer.Length);
            FileManager.Active = true;

            sound = new YSE.Sound();
            sound.Create("file1");

            TimerCallback callback = new TimerCallback(Update);

            timer = new Timer(callback, null, 50, 50);

            // Get our button from the layout resource,
            // and attach an event to it
            Button startbutton = FindViewById <Button>(Resource.Id.startButton);

            startbutton.Click += delegate {
                sound.Play();
                Y.System.AudioTest = true;
                startbutton.Text   = "" + sound.Length;
            };

            Button pausebutton = FindViewById <Button>(Resource.Id.pauseButton);

            pausebutton.Click += delegate { sound.Pause(); };

            Button stopbutton = FindViewById <Button>(Resource.Id.stopButton);

            stopbutton.Click += delegate {
                sound.Stop();
                Y.System.AudioTest = false;
            };
        }
示例#17
0
        private void btnStop_Click_1(object sender, EventArgs e)
        {
            pnlFrases.Controls.Clear();
            timer1.Stop();
            musica.Stop();
            lblNomeMusica.Text = "Nenhuma música selecionada";

            btnPause.Enabled = false;
            btnPlay.Enabled  = true;
            btnStop.Enabled  = false;
        }
示例#18
0
 public static void StopSong()
 {
     if (SongSound != null)
     {
         if (!SongSound.Finished)
         {
             SongSound.Stop();
         }
         SongSound = null;
     }
 }
示例#19
0
 public override void Explode()
 {
     base.Explode();
     // For audio and mesh animation by M.R.
     if (modelAnimationPart != null)
     {
         meshSoundEfx.Stop();
         meshSoundEfx.Dispose();
     }
     // ------------------------------------
     Visible = false;
 }
            public void Dispose()
            {
                var room = Room;

                if (room == null)
                {
                    return;
                }
                _music?.Stop();
                room.Events.OnBeforeFadeOut.Unsubscribe(onBeforeFadeOut);
                room.Events.OnBeforeFadeIn.Unsubscribe(onBeforeFadeIn);
            }
示例#21
0
 public bool stopAnnouncer()
 {
     if (null != Announcer)
     {
         fadeOut(Announcer);
         Announcer.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#22
0
 public bool stopPitLane()
 {
     if (null != PitLane)
     {
         fadeOut(PitLane);
         PitLane.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#23
0
 public bool stopEnvironment()
 {
     if (null != EnvAmbience)
     {
         fadeOut(EnvAmbience);
         EnvAmbience.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#24
0
 public bool stopRepair()
 {
     if (null != Repair)
     {
         fadeOut(Repair);
         Repair.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#25
0
 public bool stopCrowd()
 {
     if (null != Crowd)
     {
         fadeOut(Crowd);
         Crowd.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#26
0
 public bool stopMusic()
 {
     if (null != Music)
     {
         fadeOut(Music);
         Music.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#27
0
 public bool stopGarage()
 {
     if ((null != Garage) && (isGaragePlaying()))
     {
         fadeOut(Garage);
         Garage.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#28
0
 public bool stopSiren()
 {
     if ((null != Siren) && (isSirenPlaying()))
     {
         fadeOut(Siren);
         Siren.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#29
0
 public bool stopFueling()
 {
     if ((null != Fueling) && (isFuelingPlaying()))
     {
         fadeOut(Fueling);
         Fueling.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }
示例#30
0
 public bool stopGuns()
 {
     if ((null != Guns) && (areGunsPlaying()))
     {
         fadeOut(Guns);
         Guns.Stop();
         return(true);
     }
     else
     {
         return(false);
     }
 }