Inheritance: IDisposable
 private AudioManager(Microsoft.Xna.Framework.Game game, string settingsFile, string waveBankFile, string soundBankFile)
     : base(game)
 {
     this.SoundEffectInstances = new List<SoundEffectInstance>();
     try
     {
         this.audioEngine = new AudioEngine(settingsFile);
         this.waveBank = new WaveBank(this.audioEngine, waveBankFile, 0, 16);
         this.soundBank = new SoundBank(this.audioEngine, soundBankFile);
     }
     catch (NoAudioHardwareException)
     {
         this.audioEngine = null;
         this.waveBank = null;
         this.soundBank = null;
     }
     catch (InvalidOperationException)
     {
         this.audioEngine = null;
         this.waveBank = null;
         this.soundBank = null;
     }
     while (!this.waveBank.IsPrepared)
     {
         this.audioEngine.Update();
     }
 }
Exemple #2
0
        public GameRoot()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            Instance = this;
            //http://msdn.microsoft.com/en-us/library/dd231915%28v=xnagamestudio.31%29.aspx nores on how to load audio engine. had to add xact.dll reference located in programfiles/microsoftxna/.../win/xact.dll
            //http://xboxforums.create.msdn.com/forums/p/102228/608489.aspx how to find other audio devices.

            // Initialize audio objects.
            engine = new AudioEngine(@"Content\Audio\Xact.xgs",TimeSpan.Zero,"{0.0.0.00000000}.{a26fe1c0-9b55-4670-a6fd-76d91685f704}");
            soundBank = new SoundBank(engine, @"Content\Audio\Sound Bank.xsb");
            waveBank = new WaveBank(engine, @"Content\Audio\Wave Bank.xwb");

            //Console.WriteLine("SOUND ENGINE: " + engine.RendererDetails.ToString()); used to determine the redndererID
            //foreach (var r in engine.RendererDetails)
            //{
            //    Console.WriteLine(r.FriendlyName +","+ r.RendererId);
            //}

            graphics.PreferredBackBufferWidth = 1680;//(int)DisplaySize.X-150;
            graphics.PreferredBackBufferHeight = 1050;//(int)DisplaySize.Y -350;

            bloom = new BloomComponent(this);
            Components.Add(bloom);
            bloom.Settings = new BloomSettings(null, .25f, 4, 2, 1, 1.5f, 1);

            IsFixedTimeStep = true;
            //TargetElapsedTime = TimeSpan.FromSeconds(1.0 / 120);
        }
Exemple #3
0
 public MoteurAudio()
 {
     engine = new AudioEngine(@"Content\Sons\Ambiance sonore.xgs");
     waveBank = new WaveBank(engine, @"Content\Sons\Wave Bank.xwb");
     soundBank = new SoundBank(engine, @"Content\Sons\Sound Bank.xsb");
     musiques = new Song[2];
 }
Exemple #4
0
        public FieldPong()
        {
            graphics = new GraphicsDeviceManager(this);
            content = new ContentManager(Services);

            graphics.PreferredBackBufferWidth = 1024;
            graphics.PreferredBackBufferHeight = 768;
            graphics.MinimumPixelShaderProfile = ShaderProfile.PS_2_0;
            graphics.SynchronizeWithVerticalRetrace = true;

            physicsSimulator = new PhysicsSimulator(new Vector2(0));
            physicsSimulator.AllowedPenetration = 0.3f;
            physicsSimulator.BiasFactor = 1.0f;
            Services.AddService(typeof(PhysicsSimulator), physicsSimulator);

            screenManager = new ScreenManager(this);
            Components.Add(screenManager);

            bloomProcessor = new BloomPostProcessor(this);
            Components.Add(bloomProcessor);

            // Uncomment this to monitor the FPS:

            //fpsCounter = new FrameRateCounter(this);
            //Components.Add(fpsCounter);

            audioEngine = new AudioEngine("Content\\Audio\\FieldPongAudio.xgs");
            waveBank = new WaveBank(audioEngine, "Content\\Audio\\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, "Content\\Audio\\Sound Bank.xsb");

            backgroundMusic = soundBank.GetCue("GameSong0010 16 Bit");
            backgroundMusic.Play();
        }
Exemple #5
0
 public static void Initialize()
 {
     audioEngine = new AudioEngine("Content/Sounds.xgs");
     soundBank = new SoundBank(audioEngine, "Content/Sound Bank.xsb");
     waveBank = new WaveBank(audioEngine, "Content/Wave Bank.xwb");
     soundsPlaying = new List<Cue>();
 }
Exemple #6
0
 public cAudio()
 {
     _instance = this;
     _engine = new AudioEngine("Resources/Audio/Portal2DSounds.xgs");
     _waveBank = new WaveBank(_engine, "Resources/Audio/Wave Bank.xwb");
     _soundBank = new SoundBank(_engine, "Resources/Audio/Sound Bank.xsb");
 }
        public GameplayScreen(GraphicsDevice g, byte _gameType)
        {
            audioEngine = new AudioEngine(@"Content\Audio\Sounds.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
            BGM = new Cue[9];
            graphicsDevice = g;
            graphicsDevice.RenderState.DepthBufferEnable = true;
            spriteBatch = new SpriteBatch(g);
            GameOverScreen = new MessageBoxScreen(" " + Score, false);
            CongratulationsScreen = new MessageBoxScreen(" ", false);
            PauseMenu = new PauseMenuScreen();
            WorldMatrix = Matrix.Identity;
            SwitchCue = false; PauseCue = false; GameOverState = false;

            tmrVibrate = new TimeSpan();
            tmrVibrate = TimeSpan.Zero;
            sourceRect = new Rectangle(0, 0, 64, 16);
            GameType = _gameType;
            currentcue = 0;
            if (GameType > 0)
            {
                timespan = 10;
                Randomizer = new Random();
                tmrTimer = new TimeSpan();
                tmrTimer = TimeSpan.Zero;
            }
        }
Exemple #8
0
        /// <summary>
        /// Create sound
        /// </summary>
        static Sound()
        {
            try
            {
                string dir = Directories.SoundsDirectory;
                audioEngine = new AudioEngine(
                    Path.Combine(dir, "XnaShooter.xgs"));
                waveBank = new WaveBank(audioEngine,
                    Path.Combine(dir, "Wave Bank.xwb"));

                // Dummy wavebank call to get rid of the warning that waveBank is
                // never used (well it is used, but only inside of XNA).
                if (waveBank != null)
                    soundBank = new SoundBank(audioEngine,
                        Path.Combine(dir, "Sound Bank.xsb"));

                // Get the music category to change the music volume and stop music
                musicCategory = audioEngine.GetCategory("Music");
            } // try
            catch (Exception ex)
            {
                // Audio creation crashes in early xna versions, log it and ignore it!
                Log.Write("Failed to create sound class: " + ex.ToString());
            } // catch
        }
 private AudioEngineManager()
 {
     //create and use appropriate XACT objects
     audioEngine = new AudioEngine("Content\\Audio\\datx02.xgs");
     soundBank = new SoundBank(audioEngine, "Content\\Audio\\SoundEffects.xsb");
     waveBank = new WaveBank(audioEngine, "Content\\Audio\\SoundEffectWaves.xwb");
 }
        public override void Load()
        {
            try
            {
                m_AudioEngine = new AudioEngine(m_RootDirectory + "sounds.xgs");

                if (m_AudioEngine != null)
                {
                    m_WaveBank = new WaveBank(m_AudioEngine, (m_RootDirectory + "Wave Bank.xwb"));
                    m_SoundBank = new SoundBank(m_AudioEngine, (m_RootDirectory + "Sound Bank.xsb"));

                    // Get sound categories
                    AudioCategory soundCategory = m_AudioEngine.GetCategory("Sounds");
                    AudioCategory musicCategory = m_AudioEngine.GetCategory("Music");

                    // Set into the custom categories
                    m_SoundCategory = new CustomAudioCategory(soundCategory);
                    m_MusicCategory = new CustomAudioCategory(musicCategory);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
        }
        public NunChuckEnemy(Random rand, AudioEngine engine, SoundBank soundBank, WaveBank waveBank)
        {
            this.engine = engine;
            this.soundBank = soundBank;
            this.waveBank = waveBank;

            int side = rand.Next(5);
            if (side == 1)
            {
                position = new Vector2(rand.Next(GraphicsViewport.Width), 0f);
            }
            if (side == 2)
            {
                position = new Vector2(0f, rand.Next(GraphicsViewport.Height));
            }
            if (side == 3)
            {
                position = new Vector2(rand.Next(GraphicsViewport.Width), GraphicsViewport.Height);
            }
            if (side == 4)
            {
                position = new Vector2(GraphicsViewport.Width, rand.Next(GraphicsViewport.Height));
            }

            origin = new Vector2(0f, 0f);
            rotation = 0;
            velocity = 10;
            boxSize = 25;
            tint = new Color(255, 255, 255, 255);
            collided = false;
            fired = false;
        }
Exemple #12
0
 public AudioManager(AudioEngine e, WaveBank wb, SoundBank sb)
 {
     Engine = e;
     WaveBank = wb;
     SoundBank = sb;
     singleton = this;
 }
        /// <summary>
        /// Create an empty world.
        /// </summary>
        /// <param name="parentScreen">The screen this world will be updated in.</param>
        public World(Screen parentScreen, Player player)
            : base(parentScreen)
        {
            this.worldObjects = new List<WorldObject>();
            this.player = player;
            ParentScreen.Components.Add(player);
            this.interactiveLayers = new Dictionary<int, TileMapLayer>();
            this.parallaxLayers = new Dictionary<int, TileMapLayer>();
            batchService = (ISpriteBatchService)this.Game.Services.GetService(typeof(ISpriteBatchService));
            otherMaps = new List<TileMap>();

            //Set up Sound systems
            audioEngine = new AudioEngine("Content\\System\\Sounds\\Win\\SoundFX.xgs");
            soundBank = new SoundBank(audioEngine, "Content\\System\\Sounds\\Win\\GameSoundBank.xsb");
            waveBank = new WaveBank(audioEngine, "Content\\System\\Sounds\\Win\\GameWavs.xwb");

            // Set up our collision systems:
            spriteCollisionManager = new SpriteSpriteCollisionManager(this.Game, batchService, 40, 40);
            ParentScreen.Components.Add(spriteCollisionManager);

            bgm = this.Game.Content.Load<Song>("System\\Music\\DesertBGM");
            MediaPlayer.IsRepeating = true;
            MediaPlayer.Play(bgm);

            LoadCtorInfos();
        }
Exemple #14
0
 private SoundEngine()
 {
     return;
     _engine = new AudioEngine("Content\\Sounds\\Sounds.xgs");
     _wavebank = new WaveBank(_engine, "Content\\Sounds\\Wave Bank.xwb");
     _soundbank = new SoundBank(_engine, "Content\\Sounds\\Sound Bank.xsb");
 }
        public static void InitializeAudioManager(ContentManager cm)
        {
            audioEngine = new AudioEngine("Content//Music//music.xgs");
            waveBank = new WaveBank(audioEngine, "Content//Music//Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, "Content//Music//Sound Bank.xsb");

            //TODO: initialize SoundEffects
            worldShatter = cm.Load<SoundEffect>("SFX/DimensionShatter");
            doorClose = cm.Load<SoundEffect>("SFX/DoorClose");
            doorOpen = cm.Load<SoundEffect>("SFX/DoorOpen");
            portal = cm.Load<SoundEffect>("SFX/EnterPortal");
            bridgeBarrier = cm.Load<SoundEffect>("SFX/HitBarrier");
            objectDestroyed = cm.Load<SoundEffect>("SFX/ObjectDestroyed");
            playerDie = cm.Load<SoundEffect>("SFX/PlayerDie");
            playerRevive = cm.Load<SoundEffect>("SFX/PlayerRevive");
            portalItem = cm.Load<SoundEffect>("SFX/PortalItemGet");
            switchActivate = cm.Load<SoundEffect>("SFX/SwitchActivate");
            switchDeactivate = cm.Load<SoundEffect>("SFX/SwitchDeactivate");
            bridgeBreaking = cm.Load<SoundEffect>("SFX/ObjectDestroyed");       //Change
            playerJump = cm.Load<SoundEffect>("SFX/PlayerJump");
            playerLand = cm.Load<SoundEffect>("SFX/PlayerLand");
            playerPsyActivate = cm.Load<SoundEffect>("SFX/PsyActivate");
            playerPsyDeactivate = cm.Load<SoundEffect>("SFX/PsyDeactivate");
            checkpoint = worldShatter;                                          //Change?
            signal = bridgeBarrier;                                             //Do  -> Change?

            pause = cm.Load<SoundEffect>("SFX/pause");                          //Change
            //menuMove = cm.Load<SoundEffect>("SFX/menuBlip");
            menuMove = bridgeBarrier;
            //menuSelect = cm.Load<SoundEffect>("SFX/menuSelect");
            menuSelect = worldShatter;
        }
Exemple #16
0
        public Ship(GameObjType _type, Sprite_Proxy _spriteRef)
        {
            type = _type;
            spriteRef = _spriteRef;

            waveBank = WaveBankManager.WaveBank();
            soundBank = SoundBankManager.SoundBank();
        }
 public Audio(Game game)
     : base(game)
 {
     // Load all the audio data
     audioEngine = new AudioEngine(@"Content\Audio\FinalProject.xgs");
     waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
     soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
 }
Exemple #18
0
 public Audio(string clip, string settings, string waveBank, string soundBank, Game game)
     : base(game)
 {
     this.audioEngine = new AudioEngine(this.Game.Content.RootDirectory + @"\" + settings);
     this.waveBank = new WaveBank(this.audioEngine, this.Game.Content.RootDirectory + @"\" + waveBank);
     this.soundBank = new SoundBank(this.audioEngine, this.Game.Content.RootDirectory + @"\" + soundBank);
     this.sound = this.soundBank.GetCue(clip);
 }
Exemple #19
0
        public override void Initialize()
        {
            engine = new AudioEngine("Content\\audio\\siegeAudio.xgs");
            waveBank = new WaveBank(engine, "Content\\audio\\Wave Bank.xwb");
            soundBank = new SoundBank(engine, "Content\\audio\\Sound Bank.xsb");

            base.Initialize();
        }
 /// <summary>
 /// Constructs the manager for audio playback of all cues.
 /// </summary>
 /// <param name="game">The game that this component will be attached to.</param>
 /// <param name="settingsFile">The filename of the XACT settings file.</param>
 /// <param name="waveBankFile">The filename of the XACT wavebank file.</param>
 /// <param name="soundBankFile">The filename of the XACT soundbank file.</param>
 public AudioManager(Game game, string settingsFile, string waveBankFile,
     string soundBankFile)
     : base(game)
 {
     engine = new AudioEngine(settingsFile);
     waves = new WaveBank(engine, waveBankFile);
     sounds = new SoundBank(engine, soundBankFile);
 }
Exemple #21
0
 protected override void LoadGraphicsContent(bool loadAllContent)
 {
     audio = new AudioEngine("Content/Audio/TOBam.xgs");
     waveBank = new WaveBank(audio, "Content/Audio/Wave Bank.xwb");
     soundBank = new SoundBank(audio, "Content/Audio/Sound Bank.xsb");
     TOBamGame.soundBank.PlayCue("required_ttc");
     base.LoadGraphicsContent(loadAllContent);
 }
Exemple #22
0
        public SoundManager()
        {
            audioEngine = new AudioEngine(@"Content/Sounds/GameSounds.xgs");
            waveBank = new WaveBank(audioEngine, @"Content/Sounds/Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content/Sounds/Sound Bank.xsb");

            Songs = new Dictionary<string, SoundEffectInstance>();
        }
Exemple #23
0
 public Audio(string ae, string wb, string sb, string cn)
 {
     this.audioEngine = new AudioEngine(ae);
     this.waveBank = new WaveBank(audioEngine, wb);
     this.soundBank = new SoundBank(audioEngine, sb);
     this.cueName = cn;
     playStat = false;
 }
Exemple #24
0
 public AudioManager(Game game, string settingsFile, string soundbankFile, string soundEffectsWaveBankFile, string musicWaveBankFile)
     : base(game)
 {
     _audioEngine = new AudioEngine(settingsFile);
     _soundBank = new SoundBank(_audioEngine, soundbankFile);
     _soundEffectsBank = new WaveBank(_audioEngine, soundEffectsWaveBankFile);
     _musicBank = new WaveBank(_audioEngine, musicWaveBankFile, 0, 16);
 }
Exemple #25
0
        public AudioEM(Microsoft.Xna.Framework.Game game)
        {
            content = new ContentManager(game.Services, "main");

            audioEngine = new AudioEngine(@"main\audio\soundEngine.xgs");
            musicWaves = new WaveBank(audioEngine, @"main\audio\musicWaves.xwb");
            musicSounds = new SoundBank(audioEngine, @"main\audio\musicSounds.xsb");
        }
Exemple #26
0
        public Game()
        {
            new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            _engine = new AudioEngine("Content\\Sounds.xgs");
            _soundBank = new SoundBank(_engine, "Content\\Sound Bank.xsb");
            _waveBank = new WaveBank(_engine, "Content\\Wave Bank.xwb");
        }
Exemple #27
0
        public Music()
        {
            String path = System.Environment.CurrentDirectory;
            path = path.Replace(@"\bin\Debug", @"\Resources");

            audioEngine = new AudioEngine(path + @"\sound.xgs");
            waveBank = new WaveBank(audioEngine, path + @"\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, path + @"\Sound Bank.xsb");
        }
Exemple #28
0
 public void LoadContent(string path)
 {
     engine = new AudioEngine(path + "sounds.xgs");
     sounds = new SoundBank(engine, path + "Sound Bank.xsb");
     waves = new WaveBank(engine, path + "Wave Bank.xwb");
     categories = new Dictionary<string, AudioCategory>();
     categories.Add("Music", engine.GetCategory("Music"));
     categories.Add("Default", engine.GetCategory("Default"));
 }
Exemple #29
0
        public XactBgm(SoundBank soundBank, WaveBank waveBank, string cueName)
        {
            sb = soundBank;
            wb = waveBank ;

            this.cueName = cueName;

            cue = sb.GetCue(cueName);
        }
Exemple #30
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="directoryToXwb"></param>
        /// <param name="pathToWaveBank"></param>
        /// <param name="pathToSoundBank"></param>
        public XACTMusicPack(string directoryToXwb, string pathToWaveBank, string pathToSoundBank)
        {
            this.directory     = directoryToXwb;
            this.WaveBankPath  = pathToWaveBank;
            this.SoundBankPath = pathToSoundBank;
            this.setModDirectoryFromFullDirectory();
            this.songInformation      = new SongSpecifics();
            this.currentCue           = null;
            this.musicPackInformation = MusicPackMetaData.readFromJson(Path.Combine(directoryToXwb, "MusicPackInformation.json"));
            if (this.musicPackInformation == null)
            {
                StardewSymphony.ModMonitor.Log("Error: MusicPackInformation.json not found at: " + directoryToXwb + ". Blank information will be put in place.", StardewModdingAPI.LogLevel.Warn);
                this.musicPackInformation = new MusicPackMetaData("???", "???", "", "0.0.0", "");
            }

            this.WaveBank  = new WaveBank(Game1.audioEngine, this.WaveBankPath);
            this.SoundBank = new SoundBank(Game1.audioEngine, this.SoundBankPath);
            this.loadMusicFiles();
        }
Exemple #31
0
 internal void INTERNAL_addWaveBank(string name, WaveBank waveBank)
 {
     INTERNAL_waveBanks.Add(name, waveBank);
 }
 public static void Initialize()
 {
     // Initialize audio objects.
     engine = new AudioEngine(@"Content/sound/tglrf.xgs");
     soundBank = new SoundBank(engine, @"Content/sound/Sound Bank.xsb");
     waveBank = new WaveBank(engine, @"Content/sound/Wave Bank.xwb");
 }