/// <summary> /// Initialises the Audio engine /// </summary> /// <param name="audioFilePath">A string containing the file path to your Xact file ( make sure to put ".xgs" at the end of the string i.e - "Content\\example.xgs"</param> public Audio(string audioFilePath) { // Initialize audio objects. engine = new AudioEngine(audioFilePath); //"Content\\Audio\\PlaySound.xgs"); soundBank = new SoundBank(engine, "Content\\Sound Bank.xsb"); // Create streaming wave bank. waveBank = new WaveBank(engine, "Content\\Wave Bank.xwb"); // must call update engine.Update(); }
/// <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) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } //Блок управления проигрыванием по нажатию клавиш //При нажатии клавиши A приостанавливаем проигрывание KeyboardState kbState = Keyboard.GetState(); if (kbState.IsKeyDown(Keys.A)) { musicCue.Pause(); } //При нажатии клавиши S продолжаем проигрывание музыки if (kbState.IsKeyDown(Keys.S)) { musicCue.Resume(); } //При нажатии клавиши D переходим на следующую песню if (kbState.IsKeyDown(Keys.D)) { countDPress++; if (countDPress == 1) //Для того, чтобы переключение происходило только 1 раз при нажатии { if (curSong < numberOfSongs) { curSong++; } else { curSong = 1; } musicCue.Stop(AudioStopOptions.Immediate); musicCue = soundBank.GetCue(curSong.ToString()); musicCue.Play(); } } if (kbState.IsKeyUp(Keys.D)) { countDPress = 0; } if (!isGameRun) { musicCue.Stop(AudioStopOptions.Immediate); } audioEngine.Update(); base.Update(gameTime); }
/// <summary> /// Initialize the audio manager. /// </summary> public AudioManager() { engine = new AudioEngine("Resources/Audio/Equinox.xgs"); sfxWaveBank = new WaveBank(engine, "Resources/Audio/Sound.xwb"); sfxSoundBank = new SoundBank(engine, "Resources/Audio/Sound.xsb"); musicWaveBank = new WaveBank(engine, "Resources/Audio/Music.xwb", 0, (short) 16); musicSoundBank = new SoundBank(engine, "Resources/Audio/Music.xsb"); engine.Update(); }
private SoundManager() { _audioEngine = new AudioEngine("Content/Sounds/TetrisGame.xgs"); _waveBank = new WaveBank(_audioEngine, "Content/Sounds/WaveBank.xwb"); _soundBank = new SoundBank(_audioEngine, "Content/Sounds/SoundBank.xsb"); _audioEngine.Update(); _currentMusic = _soundBank.GetCue("m_Silence"); _currentMusic.Stop(AudioStopOptions.Immediate); _currentSounds = new Cue[20]; SetMusicVolume(100); SetSoundVolume(100); }
public static void LoadSoundContent(string basePath) { basePath += "/"; audio = new AudioEngine(basePath + "sound/music/AnimoNex.xgs"); waves = new WaveBank(audio, basePath + "sound/music/Wave Bank.xwb"); soundBank = new SoundBank(audio, basePath + "sound/music/Sound Bank.xsb"); musicAudio = new AudioEngine(basePath + "sound/music/AnimoNexMusic.xgs"); music = new WaveBank(musicAudio,basePath + "sound/music/musicWaves.xwb",0,8); musicSoundBank = new SoundBank(musicAudio, basePath + "sound/music/musicSoundBank.xsb"); musicAudio.Update(); mainMenuFunc.mm_introMusic = sounds.musicSoundBank.GetCue("mm_intro"); mainMenuFunc.mm_LoopingMusic = sounds.musicSoundBank.GetCue("mm_loop"); }
public override bool Init() { clavier = new KeyboardState(); clavier_prec = Keyboard.GetState(); spriteBatch = new SpriteBatch(graphics.GraphicsDevice); texte = Content.Load<SpriteFont>("Polices/menu"); image_fail = Content.Load<Texture2D>("Images/BackGround_PERDU"); metal_tex = Content.Load<Texture2D>("Images/blanc"); // Sons et musiques Audio = new AudioEngine("Content/Musiques/ambiance.xgs"); // Chargement des banques BanqueSon = new SoundBank(Audio, "Content/Musiques/Sound Bank.xsb"); BanqueWave = new WaveBank(Audio, "Content/Musiques/Wave Bank.xwb"); son_menu_validation = "menu_validation"; Audio.Update(); return base.Init(); }
public TowerAudioEngine(BaseModel baseModel) { try { this.baseModel = baseModel; audioEngine = new AudioEngine("Content/8bit.xgs"); audioEngine.Update(); //setting the values in App.Instance.Music App.Instance.Model.Music.TimeSignature = new TimeSignature(4, 4); App.Instance.Model.Music.Tempo = 60; App.Instance.Model.Music.ClicksPerBeat = 4; //this is needed as the constructor does something magical which allows the sounds to play waveBanks = new LinkedList<WaveBank>(); waveBanks.Add(new WaveBank(audioEngine, "Content/Drum Bank.xwb")); waveBanks.Add(new WaveBank(audioEngine, "Content/Effect Bank.xwb")); waveBanks.Add(new WaveBank(audioEngine, "Content/Eva Bank.xwb")); waveBanks.Add(new WaveBank(audioEngine, "Content/Simpleb Bank.xwb")); waveBanks.Add(new WaveBank(audioEngine, "Content/Spaceb Bank.xwb")); waveBanks.Add(new WaveBank(audioEngine, "Content/Weeping Bank.xwb")); drumPlayer = new DrumPlayer(audioEngine); melodyPlayer = new MelodyPlayer(audioEngine); effectPlayer = new EffectPlayer(audioEngine, this); App.Instance.Model.Music.Click += new EventHandler(OnClick); App.Instance.Model.Music.Beat += new EventHandler(OnBeat); App.Instance.Model.Music.Bar += new EventHandler(OnBar); App.Instance.Model.Update += new EventHandler<SurfaceTower.Model.EventArguments.UpdateArgs>(OnUpdate); } catch (InvalidOperationException) { Console.WriteLine("There is no audio device plugged in. AudioEngine will not be used."); } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); Root.DisplayManager.WindowTitle = "Audio Test"; sceneGraph = new gxtSceneGraph(); Content.RootDirectory = "Content"; audioEngine = new AudioEngine("Content\\Audio\\gxt_test_sounds.xgs"); soundBank = new SoundBank(audioEngine, "Content\\Audio\\gxt_test_sound_bank.xsb"); waveBank = new WaveBank(audioEngine, "Content\\Audio\\gxt_test_wave_bank.xwb"); audioEngine.Update(); Cue cue = soundBank.GetCue("park_1"); cue.Play(); if (gxtDebugDrawer.SingletonIsInitialized) { debugDrawerId = gxtDebugDrawer.Singleton.GetNewId(); gxtDebugDrawer.Singleton.AddSceneGraph(debugDrawerId, sceneGraph); gxtDebugDrawer.Singleton.CurrentSceneId = debugDrawerId; //gxtDebugDrawer.Singleton.SetTargetDrawManager(world.DrawManager); gxtDebugDrawer.Singleton.DebugFont = Content.Load<SpriteFont>("Fonts\\debug_font"); //gxtDebugDrawer.Singleton.SetDebugFont(Root); } }
/// <summary> /// Loads graphics content for this screen. The background texture is quite /// big, so we use our own local ContentManager to load it. This allows us /// to unload before going from the menus into the game itself, wheras if we /// used the shared ContentManager provided by the Game class, the content /// would remain loaded forever. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); backgroundTexture = content.Load<Texture2D>("SpaceBackground"); audioEngine = new AudioEngine("Content\\soundProject.xgs"); waveBankSFX = new WaveBank(audioEngine, "Content\\SFX.xwb"); waveBankBGM = new WaveBank(audioEngine, "Content\\BGM.xwb", 0, 4); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); audioEngine.Update(); musicCategory = audioEngine.GetCategory("Music"); musicCategory.SetVolume(OptionsMenuScreen.bgmVolume / 10); soundBank.GetCue("menubgm").Play(); }
/// <summary> /// Load graphics content for the game. /// </summary> public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); gameFont = content.Load<SpriteFont>("gamefont"); #region Effects ToonEffect = content.Load<Effect>("Toon"); ToonTexture = content.Load<Texture2D>("SketchTexture"); bloomEffects = new BloomComponent(ScreenManager.Game); ScreenManager.Game.Components.Add(bloomEffects); bloomEffects.Settings = BloomSettings.PresetSettings[bloomSettingsIndex]; bloomEffects.Visible = OptionsMenuScreen.BloomOn; #endregion Player1Texture = content.Load<Texture2D>("Player1"); BulletTexture = content.Load<Texture2D>("Bullet"); ParticleTexture = content.Load<Texture2D>("Laser"); ShipParticleTexture = content.Load<Texture2D>("Glow"); enemyTexture01 = content.Load<Texture2D>("Enemy_01"); enemyTexture02 = content.Load<Texture2D>("Enemy_02"); enemyTexture03 = content.Load<Texture2D>("Enemy_03"); asteroidsModel = content.Load<Model>("Asteroids"); audioEngine = new AudioEngine("Content\\soundProject.xgs"); waveBankSFX = new WaveBank(audioEngine, "Content\\SFX.xwb"); waveBankBGM = new WaveBank(audioEngine, "Content\\BGM.xwb", 0, 4); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); emitter = new AudioEmitter(); listener = new AudioListener(); audioEngine.Update(); defaultCategory = audioEngine.GetCategory("Default"); defaultCategory.SetVolume(OptionsMenuScreen.sfxVolume / 10); musicCategory = audioEngine.GetCategory("Music"); musicCategory.SetVolume(OptionsMenuScreen.bgmVolume / 10); cue = soundBank.GetCue("gamebgm"); cue.Play(); GameStart(); // A real game would probably have more content than this sample, so // it would take longer to load. We simulate that by delaying for a // while, giving you a chance to admire the beautiful loading screen. Thread.Sleep(1000); // once the load has finished, we use ResetElapsedTime to tell the game's // timing mechanism that we have just finished a very long frame, and that // it should not try to catch up. ScreenManager.Game.ResetElapsedTime(); }
public static void Initialize(Game game) { SoundManager.content = game.Content; soundEffects = new List<SoundEffectInstance>(); effectsLib = new Dictionary<SoundEffects, string>(); audioEngine = new AudioEngine(settingsFile); musicWaveB = new WaveBank(audioEngine, musicWaveBank); waveBank = new WaveBank(audioEngine, waveBankName); soundBank = new SoundBank(audioEngine, soundbankName); //effectsLib.Add(SoundEffects.SHIFT_1, "ferrarif355 1"); //effectsLib.Add(SoundEffects.SHIFT_2, "ferrarif355 2"); //effectsLib.Add(SoundEffects.SHIFT_3, "ferrarif355 3"); //effectsLib.Add(SoundEffects.SHIFT_4, "ferrarif355 4"); effectsLib.Add(SoundEffects.SHIFT_1, "evo7 1"); effectsLib.Add(SoundEffects.SHIFT_2, "evo7 2"); effectsLib.Add(SoundEffects.SHIFT_3, "evo7 3"); effectsLib.Add(SoundEffects.SHIFT_4, "evo7 4"); effectsLib.Add(SoundEffects.CHECKPOINT_1, "checkpoint"); effectsLib.Add(SoundEffects.CROWDSOUND, "CrowdCheering"); effectsLib.Add(SoundEffects.SONG, "LevelSong"); effectsLib.Add(SoundEffects.CRASH_1, "crash1"); effectsLib.Add(SoundEffects.CRASH_2, "crash2"); effectsLib.Add(SoundEffects.CRASH_3, "crash3"); effectsLib.Add(SoundEffects.ROAD_RIDE, "road-ride"); effectsLib.Add(SoundEffects.OUTOFROAD, "outOfRoad"); effectsLib.Add(SoundEffects.OUTOFTIME, "TimeUp"); audioEngine.Update(); }
private void SetSoundMain() { audioEngine = new AudioEngine("Music\\MySound.xgs"); waveBank = new WaveBank(audioEngine, "Music\\Wave Bank.xwb", 0, 1024); soundBank = new SoundBank(audioEngine, "Music\\Sound Bank.xsb"); soundCategory = audioEngine.GetCategory("Music"); audioEngine.Update(); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Set Some Variables float padX = 24; // Paddle Width float padY = 64; // Paddle Height float ballD = 32; // Ball Diameter Random rnd = new Random(); // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(GraphicsDevice); // Load the SoundEffect resource walls = Content.Load<SoundEffect>("VOLTAGE"); miss = Content.Load<SoundEffect>("neat"); win = Content.Load<SoundEffect>("score"); lose = Content.Load<SoundEffect>("miss"); killshot = Content.Load<SoundEffect>("killshot"); // Load files built from XACT project audioEngine = new AudioEngine("Content\\Lab3Sounds.xgs"); waveBank = new WaveBank(audioEngine, "Content\\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); // Load streaming wave bank streamingWaveBank = new WaveBank(audioEngine, "Content\\Music.xwb", 0, 4); // The audio engine must be updated before the streaming cue is ready audioEngine.Update(); // Get cue for streaming music musicCue = soundBank.GetCue("EricJordan_2012_30sec"); // Start the background music musicCue.Play(); // Load Font Font1 = Content.Load<SpriteFont>("Courier New"); // Load a 2D texture sprite ball = new clsSprite(Content.Load<Texture2D>("volt-ball-final"), new Vector2(winX/2, winY/2), new Vector2(ballD, ballD), winX, winY); opponent = new clsSprite(Content.Load<Texture2D>("vt_left_paddle"), new Vector2(10, winY/2 - padY), new Vector2(padX, padY), winX, winY); player = new clsSprite(Content.Load<Texture2D>("vt_right_paddle"), new Vector2(winX - (10+padX), winY / 2 - padY), new Vector2(padX, padY), winX, winY); // Create a SpriteBatch to render the sprite spriteBatch = new SpriteBatch(graphics.GraphicsDevice); // Set the velocity of the ball sprites will move ball.velocity = new Vector2(rnd.Next(3,6), rnd.Next(-5, 6)); }
public override void LoadContent() { if (content == null) content = new ContentManager(ScreenManager.Game.Services, "Content"); audioEngine = new AudioEngine("Content\\soundProject.xgs"); waveBankSFX = new WaveBank(audioEngine, "Content\\SFX.xwb"); waveBankBGM = new WaveBank(audioEngine, "Content\\BGM.xwb", 0, 4); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); audioEngine.Update(); defaultCategory = audioEngine.GetCategory("Default"); defaultCategory.SetVolume(OptionsMenuScreen.sfxVolume / 10); }
private void SetSoundMainSE() { audioEngine = new AudioEngine("Music\\MySound.xgs"); waveBank2 = new WaveBank(audioEngine, "Music\\Wave Bank 2.xwb"); soundBank2 = new SoundBank(audioEngine, "Music\\Sound Bank 2.xsb"); soundCategory2 = audioEngine.GetCategory("Default"); audioEngine.Update(); }
public override bool Init() { menu = new string[] { "Nouvelle Partie", "Reprendre", "Options", "Crédits", "Quitter" }; curseur = 0; clavier = new KeyboardState(); clavier_prec = Keyboard.GetState(); spriteBatch = new SpriteBatch(graphics.GraphicsDevice); texte = Content.Load<SpriteFont>("Polices/menu"); banniere = Content.Load<Texture2D>("Images/banniere"); // Sons et musiques Audio = new AudioEngine("Content/Musiques/ambiance.xgs"); // Chargement des banques BanqueSon = new SoundBank(Audio, "Content/Musiques/Sound Bank.xsb"); BanqueWave = new WaveBank(Audio, "Content/Musiques/Wave Bank.xwb"); Config.musique_menu = BanqueSon.GetCue("menu"); son_menu_curseur = "menu_curseur"; son_menu_validation = "menu_validation"; son_menu_retour = "menu_retour"; Config.musique_menu.Play(); Audio.Update(); compteur_decalage = 0; return base.Init(); }
public override bool Init() { credits_animation = 150; fond_credits = Content.Load<Texture2D>("Images/fond_credits"); pause = false; rotation = 0f; vitesse = 0.85f; credits = TableauCredits("Content/Crédits/credits.42"); clavier = new KeyboardState(); clavier_prec = Keyboard.GetState(); spriteBatch = new SpriteBatch(graphics.GraphicsDevice); texte = Content.Load<SpriteFont>("Polices/menu"); noir = Content.Load<Texture2D>("Images/black"); photos = new Texture2D[4]; photos[0] = Content.Load<Texture2D>("Photos/jarri_j"); photos[1] = Content.Load<Texture2D>("Photos/chevri_t"); photos[2] = Content.Load<Texture2D>("Photos/decast_k"); photos[3] = Content.Load<Texture2D>("Photos/chigue_w"); // Sons et musiques Audio = new AudioEngine("Content/Musiques/ambiance.xgs"); // Chargement des banques BanqueSon = new SoundBank(Audio, "Content/Musiques/Sound Bank.xsb"); BanqueWave = new WaveBank(Audio, "Content/Musiques/Wave Bank.xwb"); musique = BanqueSon.GetCue("credits"); Config.musique_menu.Stop(AudioStopOptions.Immediate); Config.musique_menu.Dispose(); musique.Play(); son_menu_retour = "menu_retour"; Audio.Update(); return base.Init(); }
public override bool Init() { curseur = 0; clavier = new KeyboardState(); clavier_prec = Keyboard.GetState(); spriteBatch = new SpriteBatch(graphics.GraphicsDevice); texte = Content.Load<SpriteFont>("Polices/menu"); image_objets = Content.Load<Texture2D>("Images/bonus"); if (!Config.active_bonus && Config.nb_bonus_index != 3) Config.active_bonus = true; if (!Config.modedejeu) Config.boussole_sortie = false; // Sons et musiques Audio = new AudioEngine("Content/Musiques/ambiance.xgs"); // Chargement des banques BanqueSon = new SoundBank(Audio, "Content/Musiques/Sound Bank.xsb"); BanqueWave = new WaveBank(Audio, "Content/Musiques/Wave Bank.xwb"); son_menu_curseur = "menu_curseur"; son_menu_validation = "menu_validation"; son_menu_retour = "menu_retour"; Audio.Update(); Afficher_Ecran(); return base.Init(); }
public override bool Init() { if (!Config.active_mort_subite) mort_subite = "Aucune"; else if (Config.sec_mort_subite == 0 && Config.min_mort_subite == 0) mort_subite = "Immédiate"; else mort_subite = (Config.min_mort_subite) + " min " + (Config.sec_mort_subite) + " s"; Afficher_Ecran(); compteur_touche = 0; curseur = 0; clavier = new KeyboardState(); clavier_prec = Keyboard.GetState(); spriteBatch = new SpriteBatch(graphics.GraphicsDevice); texte = Content.Load<SpriteFont>("Polices/menu"); drstrangelove = Content.Load<Texture2D>("Images/Dr Strangelove"); monstre = Content.Load<Texture2D>("Images/monstre"); cerveau = Content.Load<Texture2D>("Images/cerveau"); // Sons et musiques Audio = new AudioEngine("Content/Musiques/ambiance.xgs"); // Chargement des banques BanqueSon = new SoundBank(Audio, "Content/Musiques/Sound Bank.xsb"); BanqueWave = new WaveBank(Audio, "Content/Musiques/Wave Bank.xwb"); son_menu_curseur = "menu_curseur"; son_menu_validation = "menu_validation"; son_menu_retour = "menu_retour"; Audio.Update(); return base.Init(); }
internal static void Initialize() { m_audioEngine = new AudioEngine(@"Content\gameplay.xgs"); // Load up the banks m_soundBank = new SoundBank(m_audioEngine, @"Content\Sound Bank.xsb"); m_waveBank.Add(new WaveBank(m_audioEngine, @"Content\Music.xwb", 0, 16)); m_waveBank.Add(new WaveBank(m_audioEngine, @"Content\SFX.xwb")); m_waveBank.Add(new WaveBank(m_audioEngine, @"Content\Looping SFX.xwb")); // Prime the audio engine for use m_audioEngine.Update(); Listener.Forward = new Vector3(0.0f, 0.0f, -1.0f); Listener.Up = new Vector3(0.0f, 0.0f, 1.0f); }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { // Load files built from XACT project audioEngine = new AudioEngine("Content\\Lab3Sounds.xgs"); waveBank = new WaveBank(audioEngine, "Content\\Wave Bank.xwb"); soundBank = new SoundBank(audioEngine, "Content\\Sound Bank.xsb"); // Load streaming wave bank streamingWaveBank = new WaveBank(audioEngine, "Content\\Music.xwb", 0, 4); // The audio engine must be updated before the streaming cue is ready audioEngine.Update(); // Get cue for streaming music musicCue = soundBank.GetCue("Music"); // Start the background music musicCue.Play(); // Load a 2D texture sprite mySprite1 = new clsSprite(Content.Load<Texture2D>("ball"), new Vector2(0f, 0f), new Vector2(64f, 64f), graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); mySprite2 = new clsSprite(Content.Load<Texture2D>("ball"), new Vector2(218f, 118f), new Vector2(64f, 64f), graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); // Create a SpriteBatch to render the sprite spriteBatch = new SpriteBatch(graphics.GraphicsDevice); //load the SoundEffect resource soundEffect = Content.Load<SoundEffect>("chord"); // set the velocity of the two sprites will move mySprite1.velocity = new Vector2(5, 5); }