/// <summary> /// /// </summary> /// <param name="loaders"></param> /// <param name="fileSystem"></param> public void Initialize(ISoundLoader[] loaders, IReadOnlyFileSystem fileSystem) { StopMusic(); soundEngine.StopAllSounds(); if (sounds != null) { foreach (var soundSource in sounds.Values) { if (soundSource != null) { soundSource.Dispose(); } } } this.loaders = loaders; this.fileSystem = fileSystem; Func <ISoundFormat, ISoundSource> loadIntoMemory = soundFormat => soundEngine.AddSoundSourceFromMemory( soundFormat.GetPCMInputStream().ReadAllBytes(), soundFormat.Channels, soundFormat.SampleBits, soundFormat.SampleRate); sounds = new Cache <string, ISoundSource>(filename => LoadSound(filename, loadIntoMemory)); currentSounds = new Dictionary <uint, ISound>(); video = null; }
public void Dispose() { if (FEngine != null) { FEngine.StopAllSounds(); FEngine.RemoveAllSoundSources(); FEngine = null; } }
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; }
private void tTimer_Tick(object sender, EventArgs e) { if (iCounter > iBeatsPerSequence) { iCounter = 1; } if (iPlayedBeats[iCounter - 1] != 0) { if (!Rested) { sePlayer.StopAllSounds(); sePlayer.Play2D(strSoundslot); } } iCounter++; }
// Window.Closing event handler for this application // Writing back to registr & stoping all sound... void MainWindow_Closing(object sender, System.ComponentModel.CancelEventArgs e) { WriteRegistrys(); if (sound_player != null) { soundEngine.StopAllSounds(); } }
public void Stop() { if (_soundPlaying != null) { _soundPlaying.Stop(); _soundPlaying = null; _soundEngine.RemoveAllSoundSources(); _soundEngine.StopAllSounds(); } }
private void Disable(bool value) { if (enabled == value) { return; } enabled = value; if (!value) { soundEngine.StopAllSounds(); musicEngine.StopAllSounds(); } else { SetMusicVolume(float.Parse(GameProperties.Props.Get(PropertyKey.MUSIC_VOLUME), CultureInfo.InvariantCulture)); music.ForEach(sound => StartPlayingInfinite(sound)); } }
public static void Stop() { if (CurrentSong != null) { CurrentSong.IsPlaying = false; CurrentSong.Style = Text.Styles.Regular; } IsPlaying = false; Engine.StopAllSounds(); }
private void StopAllSounds() { fadeOut(PitLane); fadeOut(Crowd); fadeOut(EnvAmbience); fadeOut(Announcer); fadeOut(Guns); fadeOut(Siren); fadeOut(Repair); fadeOut(Music); fadeOut(Fueling); Engine.StopAllSounds(); Engine.Dispose(); }
public void Play() { if (IsRecording) { throw new ApplicationException("Can't play while recording."); } if (_sound != null) { _engine.StopAllSounds(); } if (!File.Exists(_path)) { throw new FileNotFoundException("Could not find sound file", _path); } //turns out, the silly engine will keep playing the same recording, even //after we've chaned the contents of the file or even delete it. //so, we need to make a new engine. // NO _sound = _engine.Play2D(path, false); var engine = new IrrKlang.ISoundEngine(); // 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(_path); //REVIEW: will this leak? _soundSource = engine.AddSoundSourceFromMemory(audioData, _path); if (_sound != null) { _sound.Dispose(); } _sound = engine.Play2D(_soundSource, false, false, false); _sound.setSoundStopEventReceiver(_irrklangEventProxy, engine); }
public void Play(string filename = null) { if (filename == null) { playerStopWatch.Start(); engine.SetAllSoundsPaused(false); } else { playerStopWatch.Restart(); engine.StopAllSounds(); currentSound = engine.Play2D(filename); } IsPlaying = true; }
private void btnChooseFile_Click(object sender, EventArgs e) { eng.StopAllSounds(); OpenFileDialog ofd = new OpenFileDialog(); if (ofd.ShowDialog() == System.Windows.Forms.DialogResult.OK) { path = ofd.FileName; name = ofd.SafeFileName; tbFileName.Text = name; S = eng.Play2D(path, false, false, StreamMode.AutoDetect, true); int length = Convert.ToInt32(S.PlayLength / 1000); tbarProgress.Maximum = length; superflag = 1; } }
public void DisposeHandle() { if (MediaControl != null) { MediaControl.Stop(); } timer1.Stop(); soundengine.StopAllSounds(); if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } CleanUp(); if (currentSound != null) { currentSound.Dispose(); } tlp.Visible = false; }
public override void Update(GameTime gameTime) { base.Update(gameTime); if (BGM.Count > 0) { bgmEngine.SoundVolume -= ((float)gameTime.ElapsedGameTime.TotalSeconds / 2); if (bgmEngine.SoundVolume <= 0) { string song = BGM.Dequeue(); bgmEngine.StopAllSounds(); bgmEngine.Play2D($"content/audio/{song}.ogg", true); } } else { if (bgmEngine.SoundVolume < 1) { bgmEngine.SoundVolume += (float)gameTime.ElapsedGameTime.TotalSeconds; } } }
public static void StopBGM() { IBGM.StopAllSounds(); }
public override void Dispose() { soundEngine.StopAllSounds(); soundEngine.RemoveAllSoundSources(); soundEngine = null; }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) { Exit(); } // TODO: Add your update logic here if (Keyboard.GetState().IsKeyDown(Keys.D1)) { previousLevel = currentLevel; currentLevel = 1; SetupLevel(); } if (Keyboard.GetState().IsKeyDown(Keys.D2)) { previousLevel = currentLevel; currentLevel = 2; SetupLevel(); } if (Keyboard.GetState().IsKeyDown(Keys.D3)) { previousLevel = currentLevel; currentLevel = 3; SetupLevel(); } if (Keyboard.GetState().IsKeyDown(Keys.M)) { playSound = !playSound; soundMode = playSound ? "on" : "off"; if (!playSound) { engine.StopAllSounds(); } else if (playGame && !firstStart) { engine.Play2D("Content/iceMove.wav", true); } } DeltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; if (playGame && !firstStart) { batSpownTimer += DeltaTime; UpdateTimer(); if (batSpownTimer >= 8) { director = new Director(new BatBuilder()); GameObject bat = director.Construct(new Vector2(rnd.Next(450, 750), rnd.Next(50, 500))); bat.LoadContent(Content); gameObjects.Add(bat); batSpownTimer = 0; if (playSound) { engine.Play2D("Content/bat1.wav", false); } } ClearLists(); foreach (GameObject go in gameObjects) { go.Update(); } if (restartGame == true) { restartGame = false; } } base.Update(gameTime); }
public void StopAudio() { soundEngine.StopAllSounds(); }
protected override void DisposeInternal() { engine.StopAllSounds(); engine.RemoveAllSoundSources(); }
public static void DisposeSoundEngine() { SoundEngine.StopAllSounds(); SoundEngine.Dispose(); }
static public void stop() { bgm.StopAllSounds(); bgm.Dispose(); bgm = new ISoundEngine(); }
public static void StopBackgroundMusic() { backgroundEngine.StopAllSounds(); }
private void button2_Click(object sender, EventArgs e) { //player.Stop(); // mciSendString("close MediaFile", null, 0, IntPtr.Zero); soundPlayer.StopAllSounds(); }
public void stopPlaying() { engine.StopAllSounds(); }
public static void StopAll( ) { SE.StopAllSounds( ); }
public void StopSound() { engine.StopAllSounds(); }
} // end DoSoundEffects //============================================================================= public void StopSoundEffects() { effectsEngine.StopAllSounds(); }
/// <summary> /// Stops currently playing song and ISoundStopEventReceiver plays the next one. /// </summary> public void PlayNextSong() { engine.StopAllSounds(); }