Inheritance: MonoBehaviour
Exemplo n.º 1
0
        public OurGame()
        {
            graphics = new GraphicsDeviceManager(this);
            content  = new ContentManager(Services);
            graphics.PreferredBackBufferHeight = 385;
            graphics.PreferredBackBufferWidth  = 400;
            prop    = new Number[3];
            lei     = new Lei[MyHelp.maxLei];
            map     = new Map[MyHelp.LENGTH];
            acticle = new Article[MyHelp.maxActicle];
            Enemy   = new Person[MyHelp.maxEnemy];

            _pos = new Vector2(0, 0);

            _mapDataRect = new Rectangle(0, 0, 40, 80);
            _leiRect     = new Rectangle(0, 0, 50, 50);
            _leiPos      = new Vector2();
            spaceUP      = true;

            _audioEngine = new AudioEngine(string.Format("{0}music.xgs", _soundFolderPath));
            _waveBankBG  = new WaveBank(_audioEngine, string.Format("{0}bg.xwb", _soundFolderPath));
            _soundBankBG = new SoundBank(_audioEngine, string.Format("{0}bg.xsb", _soundFolderPath));

            _title = new Title(graphics, content);
        }
Exemplo n.º 2
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            //this.GraphicsDevice.SamplerStates[0] = SamplerState.PointClamp;

            string[] creatureFolderItems = Directory.GetFiles(ContentDir + "Creatures\\");
            CreatureTextures = new Texture2D[creatureFolderItems.Length];
            for (int c = 0; c < creatureFolderItems.Length; c++)
            {
                CreatureTextures[c]      = Content.Load <Texture2D>("Creatures\\" + Path.GetFileNameWithoutExtension(creatureFolderItems[c]));
                CreatureTextures[c].Name = Path.GetFileNameWithoutExtension(creatureFolderItems[c]);
            }

            pixel     = Content.Load <Texture2D>("pixel");
            smallBall = Content.Load <Texture2D>("ball-3x3");
            ball      = Content.Load <Texture2D>("ball-5x5");
            dashLine  = Content.Load <Texture2D>("dashLine");
            font      = Content.Load <SpriteFont>("Fonts\\minifont");
            mainMenu  = new MainMenu(this);
            HUD       = new HUD(this);
            //brightnessFX = Content.Load<Effect>("brightnessFX");
            //brightnessFX.Parameters["value"].SetValue(brightnessValue);
            audioEngine = new AudioEngine(ContentDir + "Sound\\soundSet.xgs");
            waveBank    = new WaveBank(audioEngine, ContentDir + "Sound\\Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, ContentDir + "Sound\\Sound Bank.xsb");
        }
Exemplo n.º 3
0
        protected override void Initialize()
        {
            this.Speed = 1;

            this.musicPlayer = WaveServices.MusicPlayer;

            this.soundsBank = new SoundBank();
            this.soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.runningSoundInstances = new List <SoundInstance>();

            var soundCount = Enum.GetValues(typeof(Sounds)).Length;

            this.sounds = new SoundInfo[soundCount];
            this.LoadSound(Sounds.Button, WaveContent.Assets.Audio.Button_wav);
            this.LoadSound(Sounds.ComboAppear, WaveContent.Assets.Audio.ComboAppear_wav);
            this.LoadSound(Sounds.ComboAppear2, WaveContent.Assets.Audio.ComboAppear2_wav);
            this.LoadSound(Sounds.CountDown, WaveContent.Assets.Audio.Countdown_wav);
            this.LoadSound(Sounds.InvalidMovement, WaveContent.Assets.Audio.InvalidMovement_wav);
            this.LoadSound(Sounds.ValidMovement, WaveContent.Assets.Audio.ValidMovement_wav);
            this.LoadSound(Sounds.CandyBoom, WaveContent.Assets.Audio.CandyBoom_wav);

            var songCount = Enum.GetValues(typeof(Songs)).Length;

            this.songs = new Dictionary <Songs, MusicInfo>(songCount);
            this.songs.Add(Songs.Menu, new MusicInfo(WaveContent.Assets.Audio.bgMusic_mp3));
        }
Exemplo n.º 4
0
        private void FixCues(SoundBank newSoundBank)
        {
            typeof(AmbientLocationSounds).GetField("babblingBrook", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, null);
            typeof(AmbientLocationSounds).GetField("cracklingFire", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, null);
            typeof(AmbientLocationSounds).GetField("engine", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, null);
            typeof(AmbientLocationSounds).GetField("cricket", BindingFlags.NonPublic | BindingFlags.Static).SetValue(null, null);

            Game1.currentSong   = FixCue(newSoundBank, Game1.currentSong);
            Game1.chargeUpSound = FixCue(newSoundBank, Game1.chargeUpSound);
            Game1.wind          = FixCue(newSoundBank, Game1.wind);

            Intro.roadNoise        = FixCue(newSoundBank, Intro.roadNoise);
            Fly.buzz               = FixCue(newSoundBank, Fly.buzz);
            MineShaft.bugLevelLoop = FixCue(newSoundBank, MineShaft.bugLevelLoop);
            Railroad.trainLoop     = FixCue(newSoundBank, Railroad.trainLoop);
            BobberBar.reelSound    = FixCue(newSoundBank, BobberBar.reelSound);
            BobberBar.unReelSound  = FixCue(newSoundBank, BobberBar.unReelSound);
            FishingRod.reelSound   = FixCue(newSoundBank, FishingRod.reelSound);
            FishingRod.chargeSound = FixCue(newSoundBank, FishingRod.chargeSound);
            Grass.grassSound       = FixCue(newSoundBank, Grass.grassSound);

            Game1.locationCues.StopAll();

            // AbigailGame.overworldSong = FixCue(AbigailGame.overworldSong);
            // AbigailGame.outlawSong = FixCue(AbigailGame.outlawSong);
        }
Exemplo n.º 5
0
        public AudioInstance GetAudioInstance(SoundBank forSoundBank)
        {
            AudioInstance audioInstance = null;

            _instanceMap.TryGetValue(forSoundBank, out audioInstance);
            return(audioInstance);
        }
        /// <summary>
        /// Entry point for the mod.
        /// </summary>
        /// <param name="helper"></param>
        public override void Entry(IModHelper helper)
        {
            DefaultSoundBank = Game1.soundBank;
            DefaultWaveBank  = Game1.waveBank;
            ModHelper        = helper;
            ModMonitor       = Monitor;

            StardewModdingAPI.Events.SaveEvents.AfterLoad += SaveEvents_AfterLoad;
            StardewModdingAPI.Events.LocationEvents.CurrentLocationChanged += LocationEvents_CurrentLocationChanged;
            StardewModdingAPI.Events.GameEvents.UpdateTick    += GameEvents_UpdateTick;
            StardewModdingAPI.Events.ControlEvents.KeyPressed += ControlEvents_KeyPressed;
            StardewModdingAPI.Events.SaveEvents.BeforeSave    += SaveEvents_BeforeSave;
            musicManager = new MusicManager();

            MusicPath              = Path.Combine(ModHelper.DirectoryPath, "Content", "Music");
            WavMusicDirectory      = Path.Combine(MusicPath, "Wav");
            XACTMusicDirectory     = Path.Combine(MusicPath, "XACT");
            TemplateMusicDirectory = Path.Combine(MusicPath, "Templates");

            this.createDirectories();
            this.createBlankXACTTemplate();
            this.createBlankWAVTemplate();

            musicPacksInitialized = false;
        }
Exemplo n.º 7
0
 void Destroy()
 {
     if (SoundBank.instance == this)
     {
         SoundBank.instance = null;
     }
 }
Exemplo n.º 8
0
        /// <summary>
        /// Creates the scene.
        /// </summary>
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            // Adds record button.
            this.recordButton = new Button("recordButton")
            {
                Text   = STARTTEXT,
                Margin = new WaveEngine.Framework.UI.Thickness(100),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Left,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Top
            };

            this.recordButton.Click += OnRecordButtonClicked;
            this.EntityManager.Add(this.recordButton);

            // Adds play button
            this.playButton = new Button("playButton")
            {
                Text   = PLAYTEXT,
                Margin = new WaveEngine.Framework.UI.Thickness(100),
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Right,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Top,
                IsVisible           = false
            };
            this.playButton.Click += OnPlayButtonClicked;
            this.EntityManager.Add(this.playButton);

            // Shows error label if microphone is not available
            if (!WaveServices.Microphone.IsConnected)
            {
                TextBlock errorText = new TextBlock()
                {
                    Text = ERROREXT,
                    HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                    VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Bottom,
                    Margin = new WaveEngine.Framework.UI.Thickness(50)
                };

                this.EntityManager.Add(errorText);
            }

            this.progressBar = new ProgressBar()
            {
                Maximum             = 255,
                Minimum             = 0,
                Value               = 0,
                Width               = 400,
                Height              = 10,
                VerticalAlignment   = WaveEngine.Framework.UI.VerticalAlignment.Center,
                HorizontalAlignment = WaveEngine.Framework.UI.HorizontalAlignment.Center,
                IsVisible           = false
            };

            this.EntityManager.Add(this.progressBar);

            //Register bank
            this.bank = new SoundBank(this.Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(this.bank);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Create sound.
        /// </summary>
        public static void Initialize()
        {
            try
            {
                string dir = Directories.SoundsDirectory;
                audioEngine = new AudioEngine(Path.Combine(dir, "RacingGameManager.xgs"));
                waveBank    = new WaveBank(audioEngine, Path.Combine(dir, "Wave Bank.xwb"));

                if (waveBank != null)
                {
                    soundBank = new SoundBank(audioEngine,
                                              Path.Combine(dir, "Sound Bank.xsb"));
                }

                // Get the categories needed to change volume and pitching
                defaultCategory = audioEngine.GetCategory("Default");
                gearsCategory   = audioEngine.GetCategory("Gears");
                musicCategory   = audioEngine.GetCategory("Music");

                SetVolumes(GameSettings.Default.SoundVolume,
                           GameSettings.Default.MusicVolume);
            }
            catch (NoAudioHardwareException ex)
            {
                // Is they have no Audio hardware, note it and move on. Surface any
                // other exception that occurs since something is actually wrong!
                Log.Write("Failed to create sound class: " + ex.ToString());
            }
        }
Exemplo n.º 10
0
 /// <summary>
 ///     Allows the game component to perform any initialization it needs to before starting
 ///     to run.  This is where it can query for any required services and load content.
 /// </summary>
 public override void Initialize()
 {
     spriteBatch_ = (SpriteBatch)Game.Services.GetService(typeof(SpriteBatch));
     graphics_    = (GraphicsDeviceManager)Game.Services.GetService(typeof(GraphicsDeviceManager));
     soundBank_   = (SoundBank)Game.Services.GetService(typeof(SoundBank));
     selection_   = 0;
     if (gameLoop_ == null)
     {
         items_ = new[] { "New Game", "High Scores", "Quit" };
     }
     else if (!_question)
     {
         items_ = new[] { "Resume", "Quit Game" };
     }
     else
     {
         question = Question.GetQuestion(_ghost);
         items_   = question.GetItems();
     }
     menuItem_       = Game.Content.Load <SpriteFont>("MenuItem");
     title_          = Game.Content.Load <Texture2D>("sprites/Title");
     selectionArrow_ = Game.Content.Load <Texture2D>("sprites/Selection");
     oldState_       = Keyboard.GetState();
     base.Initialize();
 }
Exemplo n.º 11
0
        /**
         * <summary>
         * Adds a new sound to the bank and returns the assigned id for that song
         * </summary>
         */
        private int AddSoundToBank(SoundBank soundBank, string s)
        {
            var sound = new SoundInfo(s);

            soundBank.Add(sound);
            return(sound.SoundId);
        }
Exemplo n.º 12
0
        public static void PlayAmbience(string sound)
        {
            if (!HasAudioDevice)
            {
                return;
            }
            Cue cue;

            if (!ActiveCues.TryGetValue(sound, out cue))
            {
                cue = SoundBank.GetCue(sound);
                ActiveCues[sound] = cue;
            }
            try
            {
                if (!cue.IsPlaying && !cue.IsStopped && !cue.IsStopping)
                {
                    cue.Play();
                }
                else if (cue.IsStopped)
                {
                    Cue newCue = SoundBank.GetCue(sound);
                    newCue.Play();
                    ActiveCues[sound] = newCue;
                }
            }
            catch (InvalidOperationException exception)
            {
                Cue newCue = SoundBank.GetCue(sound);
                newCue.Play();
                ActiveCues[sound] = newCue;
            }
        }
Exemplo n.º 13
0
        /// <summary>
        /// Load all graphic and audio content.
        /// </summary>
        protected override void LoadContent()
        {
            gameView.LoadContent(content);

            for (int i = 0; i < NUM_LEVELS; i++)
            {
                gameLevelControllers[i].LoadContent(content, levelLoadLocations[i]);
            }

            //gameLevelController.LoadContent(content, "..\\..\\..\\..\\WindowsGame1Content\\alphaLevel.xml");
            //gameLevelController.LoadContent(content, "..\\..\\..\\..\\WindowsGame1Content\\betaLevel.xml");
            //gameView.LevelWidth = (int) (gameLevelController.Width / WorldController.DEFAULT_SCALE);
            //gameView.LevelHeight = (int)(gameLevelController.Height / WorldController.DEFAULT_SCALE);

            victory            = content.Load <Texture2D>("victory");
            failure            = content.Load <Texture2D>("failure");
            menuBackground     = content.Load <Texture2D>("badStartScreen");
            levelSelect        = content.Load <Texture2D>("roughLevelSelect");
            pause              = content.Load <Texture2D>("paused");
            countdown3         = content.Load <Texture2D>("countdown3");
            countdown2         = content.Load <Texture2D>("countdown2");
            countdown1         = content.Load <Texture2D>("countdown1");
            countdownFilmstrip = content.Load <Texture2D>("Countdown");
            firstplace         = content.Load <Texture2D>("1st");
            secondplace        = content.Load <Texture2D>("2nd");
            thirdplace         = content.Load <Texture2D>("3rd");
            fourthplace        = content.Load <Texture2D>("4th");

            pauseMenuResume      = content.Load <Texture2D>("MidGameMenuResume");
            pauseMenuRestart     = content.Load <Texture2D>("MidGameMenuRestart");
            pauseMenuLevelSelect = content.Load <Texture2D>("MidGameMenuSelectLevel");

            level1Unlocked   = content.Load <Texture2D>("Level1Unlocked");
            level2Unlocked   = content.Load <Texture2D>("Level2Unlocked");
            level3Unlocked   = content.Load <Texture2D>("Level3Unlocked");
            level4Unlocked   = content.Load <Texture2D>("Level4Unlocked");
            level5Unlocked   = content.Load <Texture2D>("Level5Unlocked");
            level6Unlocked   = content.Load <Texture2D>("Level6Unlocked");
            level7Unlocked   = content.Load <Texture2D>("Level7Unlocked");
            level8Unlocked   = content.Load <Texture2D>("Level8Unlocked");
            tutorialUnlocked = content.Load <Texture2D>("TutorialUnlocked");

            selectionSparkleFilmstrip = content.Load <Texture2D>("SelectionSparkle");
            //currentWorld = new WorldController(new Vector2(0, 0), gameLevelControllers[0],content,playerInput);

            //Umf umf umf umf
            audioEngine = new AudioEngine("Content/DracoMusic.xgs");
            waveBank    = new WaveBank(audioEngine, "Content/Waves.xwb");
            soundBank   = new SoundBank(audioEngine, "Content/Sounds.xsb");
            menuCue     = soundBank.GetCue("menu_music");

            gasPlanetSound = content.Load <SoundEffect>("gas_planet_sound");
            gasSound       = gasPlanetSound.CreateInstance();
            gasSound.Dispose();
            dragonFireSound = content.Load <SoundEffect>("fire_breath_sound");
            onFireSound     = content.Load <SoundEffect>("on_fire_sound");
            gateSound       = content.Load <SoundEffect>("gate_sound");
            shortFireSound  = content.Load <SoundEffect>("short_breath_sound");
            dragonSound     = null;
        }
Exemplo n.º 14
0
        /// <summary>
        /// Disposes of all of the music.
        /// </summary>
        public void Dispose(bool finalize)
        {
            if (PlayingAnything())
            {
                StopAll();
            }

            if (audioEngine != null)
            {
                audioEngine.Dispose();
                audioEngine = null;
            }

            if (soundBank != null)
            {
                soundBank.Dispose();
                soundBank = null;
            }

            if (waveBank != null)
            {
                waveBank.Dispose();
                waveBank = null;
            }
        }
Exemplo n.º 15
0
        /*
         * private void ExtractFiles(BinaryReader br)
         * {
         *  foreach(soundBank bank in soundBankList)
         *  {
         *      string bankExtractionPath = _extractionPath + "\\" + bank.relativePath + bank.idString + ".bnk";
         *      Directory.CreateDirectory(Path.GetDirectoryName(bankExtractionPath));
         *      using (FileStream writeStream = File.Create(bankExtractionPath))
         *      {
         *          br.BaseStream.Seek(bank.headerOffset, 0);
         *          byte[] headerBytes = new byte[bank.headerSize];
         *          headerBytes = br.ReadBytes((int)bank.headerSize);
         *
         *          br.BaseStream.Seek(bank.hircOffset, 0);
         *          byte[] hircBytes = new byte[bank.hircSize];
         *          hircBytes = br.ReadBytes((int)bank.hircSize);
         *
         *          writeStream.Write(headerBytes, 0, headerBytes.Length);
         *          writeStream.Write(hircBytes, 0, hircBytes.Length);
         *
         *          writeStream.Close();
         *      }
         *  }
         *
         *  foreach(soundFile file in soundFileList)
         *  {
         *      string fileExtractionPath = _extractionPath + "\\" + file.relativePath + file.idString + ".wem";
         *      Directory.CreateDirectory(Path.GetDirectoryName(fileExtractionPath));
         *      using (FileStream writeStream = File.Create(fileExtractionPath))
         *      {
         *          br.BaseStream.Seek(file.fileOffset, 0);
         *          byte[] fileBytes = new byte[file.fileSize];
         *          fileBytes = br.ReadBytes((int)file.fileSize);
         *
         *          writeStream.Write(fileBytes, 0, fileBytes.Length);
         *          writeStream.Close();
         *      }
         *  }
         * }*/

        private void AsyncExtractFiles()
        {
            BinaryReader asyncBinaryReader = new BinaryReader(File.Open(_packPath, FileMode.Open, FileAccess.Read, FileShare.Read));
            BinaryReader br = asyncBinaryReader;

            while ((soundBankList.Count + soundFileList.Count) > 0)
            {
                if (soundBankList.Count > 0)
                {
                    SoundBank bank = soundBankList.First();
                    string    bankExtractionPath = _extractionPath + "\\" + bank.relativePath + bank.idString + ".bnk";
                    Directory.CreateDirectory(Path.GetDirectoryName(bankExtractionPath));
                    using (FileStream writeStream = File.Create(bankExtractionPath))
                    {
                        br.BaseStream.Seek(bank.headerOffset, 0);
                        byte[] headerBytes = new byte[bank.headerSize];
                        headerBytes = br.ReadBytes((int)bank.headerSize);

                        br.BaseStream.Seek(bank.hircOffset, 0);
                        byte[] hircBytes = new byte[bank.hircSize];
                        hircBytes = br.ReadBytes((int)bank.hircSize);

                        writeStream.Write(headerBytes, 0, headerBytes.Length);
                        writeStream.Write(hircBytes, 0, hircBytes.Length);

                        writeStream.Close();
                    }
                    // Do the Json conversion
                    BankReader bankReader = new BankReader(bankExtractionPath, isBigEndian);

                    Trace.WriteLine("Extracted SoundBank " + bankExtractionPath.Replace(".bnk", ".(bnk+json)"));
                    soundBankList.Remove(bank);
                }

                if (soundFileList.Count > 0)
                {
                    SoundFile file = soundFileList.First();
                    string    fileExtractionPath = _extractionPath + "\\" + file.relativePath + "SoundFiles\\" + file.idString + ".wem";
                    Directory.CreateDirectory(Path.GetDirectoryName(fileExtractionPath));
                    using (FileStream writeStream = File.Create(fileExtractionPath))
                    {
                        br.BaseStream.Seek(file.fileOffset, 0);
                        byte[] fileBytes = new byte[file.fileSize];
                        fileBytes = br.ReadBytes((int)file.fileSize);

                        writeStream.Write(fileBytes, 0, fileBytes.Length);
                        writeStream.Close();
                    }

                    if (convertAfterExtraction && !isBigEndian) // H4 uses other codecs
                    {
                        conversionList.Add(fileExtractionPath);
                    }

                    Trace.WriteLine("Extracted SoundFile " + fileExtractionPath);

                    soundFileList.Remove(file);
                }
            }
        }
Exemplo n.º 16
0
 /// <summary>
 /// Clean up the component when it is disposing.
 /// </summary>
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             StopMusic();
             if (sounds != null)
             {
                 sounds.Dispose();
                 sounds = null;
             }
             if (waves != null)
             {
                 waves.Dispose();
                 waves = null;
             }
             if (engine != null)
             {
                 engine.Dispose();
                 engine = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Exemplo n.º 17
0
        public AudioManager(string settingsFile, string soundbankFile, string waveBankFile, string streamingBankFile)
        {
            if (_instance != null)
            {
                throw new Exception("Audio Manager already created");
            }

            try
            {
                _audioEngine   = new AudioEngine(settingsFile);
                _soundBank     = new SoundBank(_audioEngine, soundbankFile);
                _waveBank      = new WaveBank(_audioEngine, waveBankFile);
                _streamingBank = new WaveBank(_audioEngine, streamingBankFile, 0, 16);
            }
            catch
            {
            }

            _sounds         = new List <ISound>(100);
            _soundsToRemove = new List <ISound>(10);

            _channelVolume       = new float[(int)AudioChannel.Count];
            _channelMuted        = new bool[(int)AudioChannel.Count];
            _channelGoalVolume   = new float[(int)AudioChannel.Count];
            _channelFadeElapsed  = new float[(int)AudioChannel.Count];
            _channelFadeDuration = new float[(int)AudioChannel.Count];
            _channelFading       = new bool[(int)AudioChannel.Count];

            _instance = this;
        }
Exemplo n.º 18
0
        public void GetInstrumentInfo_DLS_SimOnly()
        {
            TestRuntime.AssertSystemVersion(PlatformName.iOS, 7, 0, throwIfOtherPlatform: false);
            if (Runtime.Arch == Arch.DEVICE)
            {
                Assert.Ignore("Use local file system (need a smaller sample)");
            }

            using (NSUrl url = new NSUrl(local_dls)) {
                var info = SoundBank.GetInstrumentInfo(url);
                Assert.That(info.Length, Is.EqualTo(235), "Length");

                var first = info [0];
                Assert.That(first.Dictionary.Count, Is.EqualTo((nuint)4), "first.Count");
                Assert.That(first.Name, Is.EqualTo("Piano 1     "), "first.name");
                Assert.That(first.MSB, Is.EqualTo(121), "first.MSB");
                Assert.That(first.LSB, Is.EqualTo(0), "first.LSB");
                Assert.That(first.Program, Is.EqualTo(0), "first.program");

                var last = info [234].Dictionary;
                Assert.That(last.Count, Is.EqualTo((nuint)4), "last.Count");
                Assert.That(last [InstrumentInfo.NameKey].ToString(), Is.EqualTo("SFX         "), "last.Name");
                Assert.That((last [InstrumentInfo.MSBKey] as NSNumber).Int32Value, Is.EqualTo(120), "last.MSB");
                Assert.That((last [InstrumentInfo.LSBKey] as NSNumber).Int32Value, Is.EqualTo(0), "last.LSB");
                Assert.That((last [InstrumentInfo.ProgramKey] as NSNumber).Int32Value, Is.EqualTo(56), "last.Program");
            }
        }
Exemplo n.º 19
0
        /// <summary>
        /// Load your graphics content.
        /// </summary>
        protected override void LoadContent()
        {
            // Load content belonging to the screen manager.
            ContentManager content = Game.Content;

            spriteBatch      = new SpriteBatch(GraphicsDevice);
            font             = content.Load <SpriteFont>("menufont");
            blankTexture     = content.Load <Texture2D>("blank");
            screenInCounter  = 0;
            originalViewport = GraphicsDevice.Viewport;
            audioEngine      = new AudioEngine("Content\\Sounds.xgs");
            soundBank        = new SoundBank(audioEngine, "Content\\SoundBank.xsb");
            waveBank         = new WaveBank(audioEngine, "Content\\WaveBank.xwb", 0, 64);
            while (!waveBank.IsPrepared)
            {
                audioEngine.Update();
            }
            musicCategory = audioEngine.GetCategory("Music");
            musicCategory.SetVolume(1);
            shipchosenBool1     = false;
            shipchosenBool2     = false;
            currentShipChoosing = 1;
            mainMenu            = soundBank.GetCue("MainMenu");
            mainMenu.Play();
            // Tell each of the screens to load their content.
            foreach (GameScreen screen in screens)
            {
                screen.Activate(false);
            }
        }
Exemplo n.º 20
0
        /// <summary>
        /// Initializes the audio system with the given XACT project file (.xap) compiled using
        /// Microsoft Cross-Platform Audio Creation Tool that comes with XNA Game Studio 2.0
        /// </summary>
        /// <param name="xapAssetName">The asset name of the XACT project file file</param>
        public void Initialize(String xapAssetName)
        {
            try
            {
                String name = Path.GetFileNameWithoutExtension(xapAssetName);
                audioEngine = new AudioEngine(Path.Combine(State.Content.RootDirectory + "/" +
                                                           State.GetSettingVariable("AudioDirectory"), name + ".xgs"));
                waveBank = new WaveBank(audioEngine, Path.Combine(State.Content.RootDirectory +
                                                                  "/" + State.GetSettingVariable("AudioDirectory"), "Wave Bank.xwb"));

                if (waveBank != null)
                {
                    soundBank = new SoundBank(audioEngine,
                                              Path.Combine(State.Content.RootDirectory + "/" +
                                                           State.GetSettingVariable("AudioDirectory"), "Sound Bank.xsb"));
                }

                activeCues = new List <Cue3D>();
                cuePool    = new Stack <Cue3D>();

                initialized = true;
            }
            catch (NoAudioHardwareException nahe)
            {
                Log.Write(nahe.Message);
            }
        }
Exemplo n.º 21
0
        protected override void LoadContent()
        {
            AudioEngine = new AudioEngine(@"Content\audio\GameAudio.xgs");
            WaveBank    = new WaveBank(AudioEngine, @"Content\audio\Wave Bank.xwb");
            SoundBank   = new SoundBank(AudioEngine, @"Content\audio\Sound Bank.xsb");

            var w = new WorldGrid();

            BasicManager.AddBasic(w);

            var p = new PlayerModel {
                Position = new Vector3(0, 0, 0)
            };

            BasicManager.AddBasic(p);

            var e = new SimpleEnemy {
                Position = new Vector3(-10, 2, 10)
            };

            BasicManager.AddBasic(e);

            Camera.Following = p;

            TrackCue = SoundBank.GetCue("music");
            TrackCue.Play();
            StateManager.StupidLoadContent();
        }
Exemplo n.º 22
0
        /// <summary>
        /// Version of GetCue spatialized with a fixed position.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="position"></param>
        /// <returns></returns>
        public AudioCue GetCue(string name, Vector3 position)
        {
            AudioCue audioCue = null;

            if (spareCues.Count > 0)
            {
                // Reuse a spare AudioCue instance
                audioCue = spareCues[0];
                spareCues.RemoveAt(0);
            }
            else
            {
                // No spare AudioCue instances available, so create a new one
                audioCue = new AudioCue();
            }

            // Initialize the sound cue
            if (Enabled)
            {
                Cue cue = SoundBank.GetCue(name);
                audioCue.Set(cue, position);

                // Apply initial 3D audio values
                audioCue.Apply3D(listener);
            }
            else
            {
                audioCue.Set(null, position);
            }
            // Cue is not added to activeCues list until played.

            return(audioCue);
        }
Exemplo n.º 23
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            // TODO: use this.Content to load your game content here

            #region SOUND
            audioEngine = new AudioEngine("Content/atlas_sound.xgs");
            waveBank    = new WaveBank(audioEngine, "Content/atlas.xwb");
            soundBank   = new SoundBank(audioEngine, "Content/atlas_soundbank.xsb");
            #endregion

            _levelList[0].AddIntro("tutorial/1");
            _levelList[0].AddIntro("tutorial/2");
            _levelList[0].AddIntro("tutorial/3");
            _levelList[0].AddIntro("tutorial/4");
            _levelList[0].AddIntro("tutorial/5");
            _levelList[0].AddIntro("tutorial/6");
            _levelList[0].AddIntro("tutorial/7");
            _levelList[0].AddIntro("tutorial/8");
            _levelList[0].AddIntro("level0");

            _levelList[_activeLevel].LoadContent();
            _hiscoreScreen.LoadContent();
            Menu.Instance.LoadContent();

            _Text3DFont = Content.Load <SpriteFont>("gameFont");
            _safeArea.LoadGraphicsContent(GraphicsDevice);
        }
Exemplo n.º 24
0
        //* ────────────-_______________________*
        //* constructor & destructor ───────────────────────*

        //* -----------------------------------------------------------------------*
        /// <summary>コンストラクタ。</summary>
        ///
        /// <param name="index2assert">インデックスをアセット名に変換するためのコールバック用デリゲート。</param>
        /// <param name="loopSEInterval">効果音を繰り返し再生する際の間隔。</param>
        /// <param name="fileXGS">XACTサウンドエンジン ファイル名。</param>
        /// <param name="fileXSB">XACT再生キュー ファイル名。</param>
        /// <param name="fileXWBSE">XACT波形バンク(効果音) ファイル名。</param>
        /// <param name="fileXWBBGM">XACT波形バンク(BGM) ファイル名。</param>
        public CAudio(
            Converter <ushort, string> index2assert, ushort loopSEInterval,
            string fileXGS, string fileXSB, string fileXWBSE, string fileXWBBGM
            )
        {
            CLogger.add("音響処理の初期化をしています...");
            LOOPSE_INTERVAL = loopSEInterval;
            try
            {
                INDEX2ASERT = index2assert;
                engine      = new AudioEngine(fileXGS);
                waveBankSE  = new WaveBank(engine, fileXWBSE);
                waveBankBGM = new WaveBank(engine, fileXWBBGM, 0, 32767);
                soundBank   = new SoundBank(engine, fileXSB);
                MICROTHREAD_MANAGER.Add(threadPlaySE());
                MICROTHREAD_MANAGER.Add(threadGC());
            }
            catch (Exception e)
            {
                Dispose();
                CLogger.add(
                    "音響処理の初期化に失敗しましたので、サウンドを切り離します。" + Environment.NewLine +
                    e.ToString());
                CLogger.add(
                    "Microsoft .NET Framework 1.1 がインストールされていない可能性があります。" + Environment.NewLine +
                    "このゲームを実行するためにはMicrosoft .NET Framework 2.0 SP1または" + Environment.NewLine +
                    "3.5 以降が必要ですが、音響処理の実行には 1.1 も別途必要となります。" + Environment.NewLine +
                    "このランタイムは、下記のWebサイトで入手することが出来ます。" + Environment.NewLine + Environment.NewLine +
                    "(日本語) http://www.microsoft.com/japan/msdn/netframework/" + Environment.NewLine + Environment.NewLine +
                    "あるいは、最新のDirectXをインストールされていない可能性があります。" + Environment.NewLine +
                    "このランタイムは、下記のWebサイトで入手することが出来ます。" + Environment.NewLine + Environment.NewLine +
                    "(日本語) http://www.microsoft.com/japan/windows/DirectX/");
            }
            CLogger.add("音響処理の初期化完了。");
        }
Exemplo n.º 25
0
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            //background load
            background = new Sprite(Content.Load <Texture2D>("pac_back"), new Vector2(150, 60), new Vector2(0, 0), 800, 600);

            //pad load
            pad = new Paddle(Content.Load <Texture2D>("pad"), new Vector2(50, 250), new Vector2(13, 50), 800, 600, new BoundingBox(new Vector3(0, 0, 0), new Vector3(13, 50, 0)));

            //ball load/set
            ball          = new Sprite(Content.Load <Texture2D>("ball"), new Vector2(600, 250), new Vector2(20, 21), 800, 600, new BoundingSphere(new Vector3(0, 0, 0), 0));
            ball.velocity = new Vector2(ballSpeed, 1);

            //xap loads
            audioEngine = new AudioEngine(@"Content\pong.xgs");
            waveBank    = new WaveBank(audioEngine, @"Content\Wave Bank.xwb");
            soundBank   = new SoundBank(audioEngine, @"Content \Sound Bank.xsb");

            //track load/play
            bTrack = Content.Load <Song>("rap_chop");
            MediaPlayer.Play(bTrack);

            //font load
            font = Content.Load <SpriteFont>("SpriteFont1");
        }
Exemplo n.º 26
0
 // Instance Disposal Methods
 /// Clean up the component when it is disposing.
 protected override void Dispose(bool disposing)
 {
     try
     {
         if (disposing)
         {
             StopMusic();
             if (soundBank != null)
             {
                 soundBank.Dispose();
                 soundBank = null;
             }
             if (waveBank != null)
             {
                 waveBank.Dispose();
                 waveBank = null;
             }
             if (audioEngine != null)
             {
                 audioEngine.Dispose();
                 audioEngine = null;
             }
         }
     }
     finally
     {
         base.Dispose(disposing);
     }
 }
Exemplo n.º 27
0
 void Start()
 {
     furnace = furnaceObject.GetComponent<Furnace> ();
     game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
     fireSounds.clip = sounds.firebreathing;
 }
Exemplo n.º 28
0
        private void LoadObjects(SoundPack pack, EndianReader reader, SoundScanner scanner)
        {
            foreach (SoundPackFolder folder in pack.Folders)
            {
                foreach (SoundPackFile file in folder.Files)
                {
                    reader.SeekTo(file.Offset);
                    int magic = reader.ReadInt32();

                    switch (magic)
                    {
                    case 0x52494658:     // RIFX - Embedded sound file
                        scanner.RegisterGlobalObject(file);
                        break;

                    case 0x424B4844:     // BKHD - Sound bank
                        reader.SeekTo(file.Offset);
                        SoundBank bank = new SoundBank(reader, file.Size);
                        scanner.RegisterSoundBank(bank);
                        _soundbanks.Add(bank);
                        break;
                    }
                }
            }
        }
Exemplo n.º 29
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);


            flag  = 1;
            flag1 = 1;
            flag2 = 1;
            flag3 = 1;//用于选择的标记

            playy = false;
            icc   = false;
            icd   = false;

            mCar[0]     = Content.Load <Texture2D>("Images/Car");
            mCar[1]     = Content.Load <Texture2D>("Images/Car3");
            mCar[2]     = Content.Load <Texture2D>("Images/Car1");
            mBackground = Content.Load <Texture2D>("Images/Background");
            mRoad       = Content.Load <Texture2D>("Images/Road");
            mHazard     = Content.Load <Texture2D>("Images/Hazard");
            mCar2       = Content.Load <Texture2D>("Images/Car2");
            // 定义字体
            mFont = Content.Load <SpriteFont>("MyFont");


            audioengine2 = new AudioEngine("content/Audio/Looplay.xgs");
            sound2       = new SoundBank(audioengine2, "content/Audio/sound2.xsb");
            bank2        = new WaveBank(audioengine2, "content/Audio/bank2.xwb");
            audioengine  = new AudioEngine("content/Audio/Audio.xgs");
            wavebank     = new WaveBank(audioengine, "content/Audio/mWave.xwb");
            soundbank    = new SoundBank(audioengine, "content/Audio/mSound.xsb");
        }
Exemplo n.º 30
0
 void Awake()
 {
     wheelSounds      = gameObject.AddComponent <AudioSource> ();
     wheelSounds.loop = true;
     sounds           = GameObject.FindGameObjectWithTag("SoundBank").GetComponent <SoundBank> ();
     wheelSounds.clip = sounds.wheel;
 }
Exemplo n.º 31
0
 public SoundFX()
 //track names go here. The Cue and the SOUND must be called the same name
 {
     engine = new AudioEngine("content//Sounds\\sound effects.xgs");
     SB     = new SoundBank(engine, "content//Sounds\\EffectsSB.xsb");
     WB     = new WaveBank(engine, "content//Sounds\\EffectsWB.xwb");
 }
Exemplo n.º 32
0
Arquivo: Pump.cs Projeto: zillix/LD33
 // Use this for initialization
 void Start()
 {
     triggerable = (ITriggerable)triggerObject.GetComponent (typeof(ITriggerable));
     anim = gameObject.GetComponent<Animator> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
 }
Exemplo n.º 33
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();
            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);
        }
Exemplo n.º 34
0
 void Start()
 {
     jawTriggerable = (ITriggerable)jawTriggerObject.GetComponent (typeof(ITriggerable));
     emitterTriggerable = (ITriggerable)emitterTriggerObject.GetComponent (typeof(ITriggerable));
     furnace = furnaceObject.GetComponent<Furnace> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     anim = buttonObject.GetComponent<Animator> ();
     game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
 }
Exemplo n.º 35
0
        /// <summary>
        /// Initialize sound manager
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            this.random = WaveServices.Random;
            this.soundPlayer = WaveServices.SoundPlayer;

            this.bank = new SoundBank(this.Assets) { MaxConcurrentSounds = 40 };
            this.soundPlayer.RegisterSoundBank(this.bank);

            this.LoadSounds();
        }
Exemplo n.º 36
0
Arquivo: Lever.cs Projeto: zillix/LD33
    // Use this for initialization
    void Start()
    {
        tailTriggerable = (ITriggerable)tailTriggerObject.GetComponent (typeof(ITriggerable));
        wingsTriggerable = (ITriggerable)wingsTriggerObject.GetComponent (typeof(ITriggerable));
        anim = gameObject.GetComponent<Animator> ();
        dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
        game = GameObject.FindGameObjectWithTag ("GameController").GetComponent<GameController> ();

        sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
        wingSounds.clip = sounds.adjustTail;
        wingSounds.loop = true;
    }
Exemplo n.º 37
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        protected override void Initialize()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Chop1, Sounds.CHOP1);
            this.LoadSound(SOUNDS.Chop2, Sounds.CHOP2);
            this.LoadSound(SOUNDS.Crash, Sounds.CRASH);
            this.LoadSound(SOUNDS.Coin, Sounds.COIN);
        }
  void Awake()
  {
    __sndbnk = this.gameObject.GetComponent<SoundBank>();

    if (desiredSoundBank == string.Empty)
    {
      Debug.LogError("Soundbank's empty, yo. Ya mean to do that?");
    }
    else
    {
      __sndbnk.LoadUp(desiredSoundBank);
    }
  }
Exemplo n.º 39
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        protected override void Initialize()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.SquidSwim1, WaveContent.Assets.Sounds.squid_swim1_wav);
            this.LoadSound(SOUNDS.SquidSwim2, WaveContent.Assets.Sounds.squid_swim2_wav);
            this.LoadSound(SOUNDS.JellyCrash, WaveContent.Assets.Sounds.jellyCrash_wav);
            this.LoadSound(SOUNDS.RockCrash, WaveContent.Assets.Sounds.rockCrash_wav);
            this.LoadSound(SOUNDS.Star, WaveContent.Assets.Sounds.star_wav);
        }
Exemplo n.º 40
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        protected override void Initialize()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.SquidSwim1, Directories.SoundsPath + "squid_swim1.wpk");
            this.LoadSound(SOUNDS.SquidSwim2, Directories.SoundsPath + "squid_swim2.wpk");
            this.LoadSound(SOUNDS.JellyCrash, Directories.SoundsPath + "jellyCrash.wpk");
            this.LoadSound(SOUNDS.RockCrash, Directories.SoundsPath + "rockCrash.wpk");
            this.LoadSound(SOUNDS.Star, Directories.SoundsPath + "star.wpk");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        private SoundsManager()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Shoot, WaveContent.Assets.Sounds.shoot_wav);
            this.LoadSound(SOUNDS.Impact, WaveContent.Assets.Sounds.impact_wav);
            this.LoadSound(SOUNDS.EnemyDead, WaveContent.Assets.Sounds.enemyDead_wav);
            this.LoadSound(SOUNDS.playerHurt, WaveContent.Assets.Sounds.playerHurt_wav);
            this.LoadSound(SOUNDS.Ready, WaveContent.Assets.Sounds.ready_wav);
            this.LoadSound(SOUNDS.GameOver, WaveContent.Assets.Sounds.gameOver_wav);
        }
Exemplo n.º 42
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        private SoundsManager()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Shoot, Directories.Sounds + "shoot.wpk");
            this.LoadSound(SOUNDS.Impact, Directories.Sounds + "impact.wpk");
            this.LoadSound(SOUNDS.EnemyDead, Directories.Sounds + "enemyDead.wpk");
            this.LoadSound(SOUNDS.playerHurt, Directories.Sounds + "playerHurt.wpk");
            this.LoadSound(SOUNDS.Ready, Directories.Sounds + "ready.wpk");
            this.LoadSound(SOUNDS.GameOver, Directories.Sounds + "gameOver.wpk");
        }
Exemplo n.º 43
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        private SoundsManager()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Impulse, Directories.SoundsPath + "impulse.wpk");
            this.LoadSound(SOUNDS.Explosion, Directories.SoundsPath + "explosion.wpk");
            this.LoadSound(SOUNDS.Click, Directories.SoundsPath + "click.wpk");
            this.LoadSound(SOUNDS.Start, Directories.SoundsPath + "start.wpk");
            this.LoadSound(SOUNDS.Fall, Directories.SoundsPath + "fall.wpk");
            this.LoadSound(SOUNDS.brokenGlass, Directories.SoundsPath + "brokenGlass.wpk");
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        private SoundsManager()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Impulse, WaveContent.Assets.Sounds.impulse_wav);
            this.LoadSound(SOUNDS.Explosion, WaveContent.Assets.Sounds.explosion_wav);
            this.LoadSound(SOUNDS.Click, WaveContent.Assets.Sounds.click_wav);
            this.LoadSound(SOUNDS.Start, WaveContent.Assets.Sounds.start_wav);
            this.LoadSound(SOUNDS.Fall, WaveContent.Assets.Sounds.fall_wav);
            this.LoadSound(SOUNDS.brokenGlass, WaveContent.Assets.Sounds.brokenGlass_wav);
        }
Exemplo n.º 45
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        protected override void Initialize()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Blast0, Sounds.BLAST0);
            this.LoadSound(SOUNDS.Blast1, Sounds.BLAST1);
            this.LoadSound(SOUNDS.Blast2, Sounds.BLAST2);

            this.LoadSound(SOUNDS.Explode0, Sounds.EXPLODE0);
            this.LoadSound(SOUNDS.Explode1, Sounds.EXPLODE1);
            this.LoadSound(SOUNDS.Explode2, Sounds.EXPLODE2);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        private SoundsManager()
        {
            soundsBank = new SoundBank();
            soundsBank.MaxConcurrentSounds = 10;
            WaveServices.SoundPlayer.RegisterSoundBank(soundsBank);

            this.sounds = new SoundInfo[(int)SOUNDS.Last];

            this.LoadSound(SOUNDS.Hoop, WaveContent.Assets.Sounds.hoop_wav);
            this.LoadSound(SOUNDS.Net, WaveContent.Assets.Sounds.net_wav);
            this.LoadSound(SOUNDS.Tablet, WaveContent.Assets.Sounds.tablet_wav);
            this.LoadSound(SOUNDS.Ready, WaveContent.Assets.Sounds.ready_wav);
            this.LoadSound(SOUNDS.HurryUp, WaveContent.Assets.Sounds.hurryUp_wav);
            this.LoadSound(SOUNDS.Go, WaveContent.Assets.Sounds.go_wav);
            this.LoadSound(SOUNDS.TimeOver, WaveContent.Assets.Sounds.timeOver_wav);
            this.LoadSound(SOUNDS.Button, WaveContent.Assets.Sounds.button_wav);
            this.LoadSound(SOUNDS.Combo, WaveContent.Assets.Sounds.yeah_wav);
            this.LoadSound(SOUNDS.Record, WaveContent.Assets.Sounds.record_wav);
            this.LoadSound(SOUNDS.Digit, WaveContent.Assets.Sounds.digit_wav);
        }
Exemplo n.º 47
0
        protected override void CreateScene()
        {
            RenderManager.BackgroundColor = Color.Black;

            //Register bank
            SoundBank bank = new SoundBank(Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            sound1 = new SoundInfo("Content/Menu.wpk");
            bank.Add(sound1);

            sound2 = new SoundInfo("Content/Pistol.wpk");
            bank.Add(sound2);

            sound3 = new SoundInfo("Content/Upgrade.wpk");
            bank.Add(sound3);

            sound4 = new SoundInfo("Content/Sell.wpk");
            bank.Add(sound4);
        }
Exemplo n.º 48
0
        protected override void CreateScene()
        {
            this.Load(WaveContent.Scenes.MyScene);

            //Register bank
            SoundBank bank = new SoundBank(Assets);
            WaveServices.SoundPlayer.RegisterSoundBank(bank);

            //Register sounds
            MenuSound = new SoundInfo(WaveContent.Assets.Menu_wav);
            bank.Add(MenuSound);

            pistolSound = new SoundInfo(WaveContent.Assets.Pistol_wav);
            bank.Add(pistolSound);

            upgradeSound = new SoundInfo(WaveContent.Assets.Upgrade_wav);
            bank.Add(upgradeSound);

            sellSound = new SoundInfo(WaveContent.Assets.Sell_wav);
            bank.Add(sellSound);
        }
Exemplo n.º 49
0
        protected override void Initialize()
        {
            base.Initialize();
            this.soundPlayer = WaveServices.SoundPlayer;

            // fill sound info
            sounds = new Dictionary<SoundType, SoundInfo>();
            sounds[SoundType.Coin] = new SoundInfo(WaveContent.Assets.Sound.coin_wav);
            sounds[SoundType.Contact] = new SoundInfo(WaveContent.Assets.Sound.contact_wav);
            sounds[SoundType.CrateDrop] = new SoundInfo(WaveContent.Assets.Sound.crateDrop_wav);
            sounds[SoundType.Crash] = new SoundInfo(WaveContent.Assets.Sound.crash_wav);
            sounds[SoundType.Jump] = new SoundInfo(WaveContent.Assets.Sound.jump_wav);
            sounds[SoundType.Victory] = new SoundInfo(WaveContent.Assets.Sound.victory_wav);

            this.bank = new SoundBank(this.Assets);
            this.soundPlayer.RegisterSoundBank(bank);
            foreach (var item in this.sounds)
            {
                this.bank.Add(item.Value);
            }
        }
Exemplo n.º 50
0
        protected override void CreateScene()
        {
            #region Scene creation
            // Create the camera
            ViewCamera camera = new ViewCamera("MainCamera", new Vector3(2, 1, 2), new Vector3(0, 1, 0));
            EntityManager.Add(camera.Entity);

            RenderManager.SetActiveCamera(camera.Entity);

            // Create the model. Note of we add the Animation3D component.
            Entity animatedModel = new Entity("Isis")
                .AddComponent(new Transform3D())
                .AddComponent(new BoxCollider())
                .AddComponent(new SkinnedModel("Content/isis.wpk"))
                .AddComponent(new MaterialsMap(new BasicMaterial("Content/isis-difuse.wpk")))
                .AddComponent(new Animation3D("Content/isis-animations.wpk"))
                .AddComponent(new SkinnedModelRenderer())
                .AddComponent(new IsisBehavior());

            // Create the sound bank
            SoundBank spankerSlamSounds = new SoundBank();
            spankerSlamSounds.Add(SoundsManager.FootStep1);
            spankerSlamSounds.Add(SoundsManager.FootStep2);
            WaveServices.SoundPlayer.RegisterSoundBank(spankerSlamSounds);

            RenderManager.BackgroundColor = Color.CornflowerBlue;
            #endregion

            #region Key Events
            // Add the key frames. The first parameter is the name of the animation, the second the number of frames and the third the name of the event. As you can see, we raise two events when
            // the animation is "Attack" ( see the Animation3D example for further information ). The first event is raised on frame 10 and the second on frame 25. See the SpankerBehavior class
            animation = animatedModel.FindComponent<Animation3D>()
                .AddKeyFrameEvent("Jog", 1, "DoFootstep")
                .AddKeyFrameEvent("Jog", 14, "DoFootstep")
                .AddKeyFrameEvent("Jog", 26, "DoFootstep")
                .AddKeyFrameEvent("Jog", 39, "DoFootstep");
            EntityManager.Add(animatedModel);
            #endregion
        }
Exemplo n.º 51
0
 void Awake()
 {
   m_LastPos = transform.position;
   m_SoundBank = GetComponent<SoundBank>();
 }
Exemplo n.º 52
0
 void CheckPenalty(SoundBank otherSoundBank, Collider other) {
   if (!other.CompareTag("Penalty")) return;
   m_StateMachine.TransitionTo("penalty");
 }
Exemplo n.º 53
0
  void PlayMutter(SoundBank otherSoundBank, Collider other) {
    // Get a mutter if exists.
    var clip = otherSoundBank.Draw(SoundBank.MUTTERS);
    if (clip == null) return;

    // Get the child of this (which should be the hand) and add this audio clip to it, then play
    m_MutterAudioSource.clip = clip;
    m_MutterAudioSource.PlayDelayed(0.5f);

    if (m_StateMachine.GetState() == "penalty") {
      Debug.Log("delaying penalty to playing");
      StartCoroutine(m_StateMachine.DelayedTransitionTo("playing", clip.length + 0.5f));
    }
  }
Exemplo n.º 54
0
        /// <summary>
        /// Initializes a new instance of the <see cref="SoundsManager" /> class.
        /// </summary>
        protected override void Initialize()
        {
            this.musicPlayer = WaveServices.MusicPlayer;
            this.soundPlayer = WaveServices.SoundPlayer;

            this.soundsBank = new SoundBank();
            this.soundsBank.MaxConcurrentSounds = 5;
            this.soundPlayer.RegisterSoundBank(this.soundsBank);

            // Create SoundInfo array
            this.sounds = new SoundInfo[Enum.GetValues(typeof(Audio.Sfx)).Length];

            //this.uniqueLoopedSounds = new Dictionary<Audio.SfxLoop, SoundInstance>();
            //this.playLoopedSoundRequests = new Dictionary<Audio.SfxLoop, int>();

            this.LoadAllSounds();
        }
Exemplo n.º 55
0
 // Use this for initialization
 void Start()
 {
     anim = gameObject.GetComponent<Animator> ();
     dragon = GameObject.FindGameObjectWithTag ("Dragon").GetComponent<Dragon> ();
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
 }
Exemplo n.º 56
0
Arquivo: Wheel.cs Projeto: zillix/LD33
 void Awake()
 {
     wheelSounds = gameObject.AddComponent<AudioSource> ();
     wheelSounds.loop = true;
     sounds = GameObject.FindGameObjectWithTag ("SoundBank").GetComponent<SoundBank> ();
     wheelSounds.clip = sounds.wheel;
 }
    protected override void LoadContent()
    {
        audioEngine = new AudioEngine("Content\\Audio\\Audio.xgs");
        waveBank = new WaveBank(audioEngine, "Content\\Audio\\myWaveBank.xwb");
        soundBank = new SoundBank(audioEngine, "Content\\Audio\\mySoundBank.xsb");
        musicCategory = audioEngine.GetCategory("Music");
        defaultCategory = audioEngine.GetCategory("Default");

        for (int i = 0; i < cueArray.Length; i++)
        {
            cueArray[i] = soundBank.GetCue("engine");
            cueArray[i].Apply3D(listener_, CarSoundEmitters.AudioEmitters[i]);
            cueArray[i].Play();
        }

        base.LoadContent();
    }
Exemplo n.º 58
0
 /// <summary>
 /// Unloads the sound bank and the wave bank which are currently loaded
 /// to make room for a new one or just to shut down.
 /// </summary>
 protected void UnloadBank()
 {
     if (m_soundBank != null)
     {
         m_soundBank.Dispose();
         m_soundBank = null;
     }
     if (m_waveBank != null)
     {
         m_waveBank.Dispose();
         m_waveBank = null;
     }
 }
Exemplo n.º 59
0
 /// <summary>
 /// Load a new wave bank and sound bank.
 /// Only one of each bank can be loaded at a time.
 /// </summary>
 /// <param name="waveBankName">Name of the wave bank to load.</param>
 /// <param name="soundBankName">Name of the sound bank to load.</param>
 public void LoadBank(String waveBankName, String soundBankName)
 {
     UnloadBank();
     m_waveBank = new WaveBank(m_audioEngine, "Content/" + waveBankName + ".xwb");
     m_soundBank = new SoundBank(m_audioEngine, "Content/" + soundBankName + ".xsb");
 }
Exemplo n.º 60
0
 /// <summary>
 /// Set the AudioCue up to be ready to play the specified sound.
 /// </summary>
 /// <param name="soundBank">The SoundBank to find the sound in.</param>
 /// <param name="soundName">The name of the sound to play.</param>
 public void SetUp(SoundBank soundBank, String soundName)
 {
     Debug.Assert(m_state == State.AVAILABLE);
     m_cue = soundBank.GetCue(soundName);
     m_state = State.SETUP;
 }