PLAYING SOUNDS IN XACT SAMPLE CODE: // Audio objects AudioEngine engine; SoundBank soundBank; WaveBank waveBank; // Initialize audio objects. engine = new AudioEngine("Content\\PlaySound.xgs"); soundBank = new SoundBank(engine, "Content\\Sound Bank.xsb"); waveBank = new WaveBank(engine, "Content\\Wave Bank.xwb"); // Play the sound. Cue cue = soundBank.GetCue("usecuenamehere"); cue.Play(); // note each cue instance is unique including cues w same name - allows play of multiple cues simultaneously // to pause call Cue.Pause // to stop call Cue.Stop // complete code namespace StopOrPauseSoundXACT { public class Game1 : Microsoft.Xna.Framework.Game { GraphicsDeviceManager graphics; // Audio objects AudioEngine engine; SoundBank soundBank; WaveBank waveBank; Cue cue; GamePadState oldState; public Game1() { graphics = new GraphicsDeviceManager(this); } protected override void Initialize() { base.Initialize(); // Initialize audio objects. engine = new AudioEngine("Content\\StopOrPauseSound.xgs"); soundBank = new SoundBank(engine, "Content\\Sound Bank.xsb"); waveBank = new WaveBank(engine, "Content\\Wave Bank.xwb"); // Get the cue and play it. cue = soundBank.GetCue("music"); cue.Play(); } protected override void LoadContent() { } protected override void UnloadContent() { } protected void UpdateInput() { // Get the current gamepad state. GamePadState currentState = GamePad.GetState(PlayerIndex.One); if (currentState.DPad == oldState.DPad) { return; } // DPad right is 'play/pause'. if (currentState.DPad.Right == ButtonState.Pressed) { if (cue.IsPaused) { cue.Resume(); } else if (cue.IsPlaying) { cue.Pause(); } else { // If stopped, create a new cue. cue = soundBank.GetCue(cue.Name); cue.Play(); } } // DPad left is 'stop'. if (currentState.DPad.Left == ButtonState.Pressed) { cue.Stop(AudioStopOptions.AsAuthored); } oldState = currentState; } protected override void Update(GameTime gameTime) { // Allow the game to exit. if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) this.Exit(); // Check input. UpdateInput(); // Update the audio engine. engine.Update(); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { graphics.GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); } } }