예제 #1
0
파일: Sound.cs 프로젝트: kiichi7/XnaShooter
        /// <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
        }
예제 #2
0
 public SoundPlayer(Game1 game, String settingsFile)
     : base(settingsFile + ".xgs")
 {
     this.game = game;
     waveBank = new WaveBank(this, settingsFile + ".xwb");
     soundBank = new SoundBank(this, settingsFile + ".xsb");
     musicCategory = base.GetCategory("Sound");
     initialize();
 }
예제 #3
0
 public AudioManager(Game1 currentGame)
 {
     game = currentGame;
     engine = new AudioEngine("Content\\SFX\\SFX.xgs");
     soundBank = new SoundBank(engine, "Content\\SFX\\Sound Bank.xsb");
     waveBank = new WaveBank(engine, "Content\\SFX\\Wave Bank.xwb");
     fxCat = engine.GetCategory("SFX");
     fxCat.SetVolume(10f);
 }
예제 #4
0
 public ScreenManager(Game game)
     : base(game)
 {
     // Start background music
     audioEngine = new AudioEngine(@"Content\Audio\boardClickSound.xgs");
     soundBank = new SoundBank(audioEngine, @"Content\Audio\Sound Bank.xsb");
     waveBank = new WaveBank(audioEngine, @"Content\Audio\Wave Bank.xwb");
     audioCategory = audioEngine.GetCategory("background");
 }
예제 #5
0
파일: Cue.cs 프로젝트: raizam/FNA
        internal Cue(
            AudioEngine audioEngine,
            List <string> waveBankNames,
            string name,
            CueData data,
            bool managed
            )
        {
            INTERNAL_baseEngine = audioEngine;

            Name = name;

            INTERNAL_data = data;
            IsPrepared    = false;
            IsPreparing   = true;
            foreach (XACTSound curSound in data.Sounds)
            {
                if (!curSound.HasLoadedTracks)
                {
                    curSound.LoadTracks(
                        INTERNAL_baseEngine,
                        waveBankNames
                        );
                }
            }
            IsPrepared  = true;
            IsPreparing = false;

            INTERNAL_isManaged = managed;

            INTERNAL_category = INTERNAL_baseEngine.INTERNAL_initCue(
                this,
                data.Category
                );

            eventVolume = 1.0f;
            eventPitch  = 0.0f;

            INTERNAL_userControlledPlaying = false;
            INTERNAL_isPositional          = false;

            INTERNAL_eventList       = new List <XACTEvent>();
            INTERNAL_eventPlayed     = new List <bool>();
            INTERNAL_eventLoops      = new Dictionary <XACTEvent, int>();
            INTERNAL_waveEventSounds = new Dictionary <SoundEffectInstance, XACTEvent>();

            INTERNAL_timer = new Stopwatch();

            INTERNAL_instancePool    = new List <SoundEffectInstance>();
            INTERNAL_instanceVolumes = new List <float>();
            INTERNAL_instancePitches = new List <float>();

            INTERNAL_rpcTrackVolumes = new List <float>();
            INTERNAL_rpcTrackPitches = new List <float>();
        }
예제 #6
0
        static Audio()
        {
            //Ladda in ljud-resurser
            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");

            //Kategori på ljud i xact-projektet
            music = audioEngine.GetCategory("Music");
            soundEffects = audioEngine.GetCategory("Sound Effects");
        }
예제 #7
0
        public MusicPlayer(Game1 game, String settingsFile, int totalTracks)
            : base(settingsFile+ ".xgs")
        {
            this.game = game;
            this.totalTracks = totalTracks;
            waveBank = new WaveBank(this, settingsFile+ ".xwb");
            soundBank = new SoundBank(this, settingsFile+ ".xsb");
            musicCategory = base.GetCategory("Music");

            initialize();
        }
        public static void Initialize()
        {
            audioEngine = new AudioEngine(@"Content\audio\AudioProject.xgs");
            soundBank = new SoundBank(audioEngine, @"Content\audio\SoundBank.xsb");
            waveBank = new WaveBank(audioEngine, @"Content\audio\WaveBank.xwb");

            soundCategory = audioEngine.GetCategory("Sound");

            moveLoop1 = soundBank.GetCue("move_loop_1");
            moveLoop2 = soundBank.GetCue("move_loop_2");
            moveLoop3 = soundBank.GetCue("move_loop_3");
        }
        public AudioPlayer(ContentManager content)
        {
            engine = new AudioEngine("Content/Sounds/RecellectionSounds.xgs");
            waves = new WaveBank(engine, "Content/Sounds/Wave Bank.xwb");
            sounds = new SoundBank(engine, "Content/Sounds/Sound Bank.xsb");
            soundCategory = engine.GetCategory("Default");

            soundVolume = 1.0f;
            songs = new Song[1];
            songs[0] = content.Load<Song>("Sounds/Songs/Castlevania");

            MediaPlayer.IsMuted = true;
        }
예제 #10
0
        /// <summary>
        /// AudioController Constructor.
        /// Initializes AudioEngine, SoundBank and WaveBank.
        /// </summary>
        private AudioController()
        {
            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");

            NoteCategory = audioEngine.GetCategory("Notes");
            NoteCategory.SetVolume(3.0f);
            AudioCategory BackgroundCategory = audioEngine.GetCategory("Background sound");
            BackgroundCategory.SetVolume(2.0f);
        }
예제 #11
0
        public SoundTrack(int bpm)
        {
            tick = new Stopwatch();
             mpb = 60000.0m/bpm;
             soundBank = new SoundBank(BeatShift.engine, "Content\\XACT\\MusicTracks.xsb");
             musicCategory = BeatShift.engine.GetCategory("Music");
             loadTrack("City");

             while (!track.IsPrepared)
             {
                 // System.Diagnostic.Debug.WriteLine("Not yet prepped");
             }
             SoundManager.Music += new VolumechangeHandler(setVolume);
        }
예제 #12
0
        public override void Initialize()
        {
            base.Initialize();

            m_AudioEngine = new AudioEngine(@"Content\Audio\GameSounds.xgs");
            m_WaveBank = new WaveBank(m_AudioEngine, @"Content\Audio\Wave Bank.xwb");
            m_SoundBank = new SoundBank(m_AudioEngine, @"Content\Audio\Sound Bank.xsb");
            m_MusicCategory = m_AudioEngine.GetCategory("Music");
            m_EffectsCategory = m_AudioEngine.GetCategory("Default");
            // r_Factory.SetSoundBank(m_SoundBank);

            m_Music = m_SoundBank.GetCue("BGMusic");

            m_Music.Play();
        }
예제 #13
0
        public OptionsScreen(ContentManager content, EventHandler theScreenEvent, Game1 game, GraphicsDeviceManager graphics)
            : base(theScreenEvent)
        {
            mOptionsScreenBackground = content.Load<Texture2D>("Images/Options");
            _game = game;
            bigText = content.Load<SpriteFont>("Fonts/General");
            backgroundMusic = Sounds.AudioEngine.GetCategory("Music");
            effects = Sounds.AudioEngine.GetCategory("Effects");
            volumeSlider = content.Load<Texture2D>(@"Images/VolumeBar");
            checkBox = content.Load<Texture2D>(@"Images/CheckBox");

            this.graphics = graphics;

            rowBar = new Texture2D(game.GraphicsDevice, 1, 1);
            rowBar.SetData<Color>(colorData);
        }
예제 #14
0
파일: SoundManager.cs 프로젝트: kozupi/--
        private SoundManager(Game game, Func<Vector3> getListenerPosition, Func<Vector3> getListenerForward, Func<Vector3> getListenerUp)
            : base(game)
        {
            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");
            musicCategory = audioEngine.GetCategory("Default");
            volume = 10;
            musicCategory.SetVolume(volume);

            cuelist = new List<Cue>();
            BGMCuelist = new List<Cue>();

            updateListenerForward = getListenerForward;
            updateListenerUp = getListenerUp;
            updateListenerPosition = getListenerPosition;
            listener = new AudioListener();
        }
예제 #15
0
        public SoundHelper(AudioEngine audioengine, System.IO.BinaryReader reader)
        {
            _priority = reader.ReadInt32();

            int    volume            = reader.ReadInt32();
            double attenuation_in_db = volume / 100.0f;

            GSGE.Debug.assert(attenuation_in_db <= 0);
            gain = (float)Math.Pow(10, attenuation_in_db / 20.0);
            GSGE.Debug.assert(gain <= 1.0f);

            _pitch = (float)(reader.ReadInt32() / 100.0f);

            int trackCount = reader.ReadInt32();

            _tracks = new TrackHelper[trackCount];
            for (int i = 0; i < trackCount; i++)
            {
                _tracks[i] = new TrackHelper(reader);
            }

            int strLen = reader.ReadInt16();

            byte[] bytes   = reader.ReadBytes((int)strLen);
            string catname = Encoding.ASCII.GetString(bytes);

            category = audioengine.GetCategory(catname);

            int rpcCount = reader.ReadInt32();

            rpcs = new RPCCurve[rpcCount];
            for (int i = 0; i < rpcCount; i++)
            {
                strLen = reader.ReadInt16();
                bytes  = reader.ReadBytes((int)strLen);
                string rpc = Encoding.ASCII.GetString(bytes);

                rpcs[i] = audioengine.GetRPC(rpc);
            }

            strLen = reader.ReadInt16();
            bytes  = reader.ReadBytes((int)strLen);
            effect = Encoding.ASCII.GetString(bytes);
        }
예제 #16
0
        public AudioManager()
        {
            engine = new AudioEngine("Content/Sound/XACT Sound File.xgs");
            waves = new WaveBank(engine, "Content/Sound/Wave Bank.xwb");
            sounds = new SoundBank(engine, "Content/Sound/Sound Bank.xsb");

            soundEffectCategory = engine.GetCategory("Sound Effect");
            soundEffectCategory.SetVolume(sfxVolume);

            backgroundMusicCategory = engine.GetCategory("Music");
            backgroundMusicCategory.SetVolume(backgroundVolume);

            //the default gun sound was much too loud, so I created its own category to set the
            //volume for only that sound
            gunshotCategory = engine.GetCategory("Gunshot");
            gunshotCategory.SetVolume(gunshotVolume);

            Cue startSplashMusic = sounds.GetCue("Drum n Bass D Coexistant");
            playFirstBackgroundMusic(startSplashMusic);
        }
        public MusicManager(float lightThreshold, float darkThreshold)
        {
            LightThreshold = lightThreshold;
              DarkThreshold = darkThreshold;

              audioEngine = new AudioEngine("Content/audio/test.xgs");
              waveBank = new WaveBank(audioEngine, "Content/audio/Wave Bank1.xwb");
              soundBank = new SoundBank(audioEngine, "Content/audio/Sound Bank.xsb");

              light = audioEngine.GetCategory("Light");
              dark = audioEngine.GetCategory("Dark");
              light2 = audioEngine.GetCategory("Light2");
              dark2 = audioEngine.GetCategory("Dark2");

              CurrentStage = 0;
              NextStage = 0;
              light.SetVolume(0.0f);
              dark.SetVolume(0.0f);
              light2.SetVolume(0.0f);
              dark2.SetVolume(0.0f);
        }
예제 #18
0
        } // enum Sounds
        #endregion

        #region Constructor
        /// <summary>
        /// Create sound
        /// </summary>
        static Sound()
        {
            try
            {
                audioEngine = new AudioEngine(@"Content\Sounds\GameSounds.xgs");
                
                waveBank = new WaveBank(audioEngine,
                    @"Content\Sounds\Wave Bank.xwb");
                
                if (waveBank != null)
                  soundBank = new SoundBank(audioEngine,
                      @"Content\Sounds\Sound Bank.xsb");

                // Get the music category to change the music volume and stop music
              musicCategory = audioEngine.GetCategory("Music");
            } // try
            catch (Exception ex)
            {
                Log.Instance.Write("Failed to create sound class: " + ex.ToString());
            } // catch
        } // Sound()
예제 #19
0
        internal Cue(
            AudioEngine audioEngine,
            List <string> waveBankNames,
            string name,
            CueData data,
            bool managed
            )
        {
            INTERNAL_baseEngine = audioEngine;

            Name = name;

            INTERNAL_data = data;
            foreach (XACTSound curSound in data.Sounds)
            {
                if (!curSound.HasLoadedTracks)
                {
                    curSound.LoadTracks(
                        INTERNAL_baseEngine,
                        waveBankNames
                        );
                }
            }

            INTERNAL_isManaged = managed;

            INTERNAL_category = INTERNAL_baseEngine.INTERNAL_initCue(
                this,
                data.Category
                );

            INTERNAL_userControlledPlaying = false;
            INTERNAL_isPositional          = false;
            INTERNAL_queuedPlayback        = false;
            INTERNAL_queuedPaused          = false;

            INTERNAL_instancePool    = new List <SoundEffectInstance>();
            INTERNAL_instanceVolumes = new List <float>();
            INTERNAL_instancePitches = new List <float>();
        }
예제 #20
0
파일: Cue.cs 프로젝트: khbecker/FNA
        internal Cue(
			AudioEngine audioEngine,
			List<string> waveBankNames,
			string name,
			CueData data,
			bool managed
		)
        {
            INTERNAL_baseEngine = audioEngine;

            Name = name;

            INTERNAL_data = data;
            foreach (XACTSound curSound in data.Sounds)
            {
                if (!curSound.HasLoadedTracks)
                {
                    curSound.LoadTracks(
                        INTERNAL_baseEngine,
                        waveBankNames
                    );
                }
            }

            INTERNAL_isManaged = managed;

            INTERNAL_category = INTERNAL_baseEngine.INTERNAL_initCue(
                this,
                data.Category
            );

            INTERNAL_userControlledPlaying = false;
            INTERNAL_isPositional = false;
            INTERNAL_queuedPlayback = false;
            INTERNAL_queuedPaused = false;

            INTERNAL_instancePool = new List<SoundEffectInstance>();
            INTERNAL_instanceVolumes = new List<float>();
            INTERNAL_instancePitches = new List<float>();
        }
예제 #21
0
파일: Music.cs 프로젝트: pampersrocker/STAR
 public void Initialize(IServiceProvider serviceProvider,Options options)
 {
     popUpText = new DrawableText();
     content = new ContentManager(serviceProvider, "Data");
     popUpText.font = content.Load<SpriteFont>("Stuff\\Arial");
     popUpBG = content.Load<Texture2D>("Stuff\\popUpBG");
     popUpText.Text = "";
     popUpText.color = Color.White;
     this.options = options;
     options.MusicVolumeChanged += new MusicVolumeChangedEventHandler(options_MusicVolumeChanged);
     options.ResolutionChanged += new ResolutionChangedEventHandler(options_ResolutionChanged);
     audioEngine = new AudioEngine(GameConstants.AUDIO_PATH + "Music.xgs");
     waveBank = new WaveBank(audioEngine, GameConstants.AUDIO_PATH + "Music.xwb");
     soundBank = new SoundBank(audioEngine, GameConstants.AUDIO_PATH + "Music.xsb");
     menuCategory = audioEngine.GetCategory("Music");
     graphXPackCategory = menuCategory;
     menuCategory.SetVolume(options.MusicVolumeFloat);
     playList = FileManager.GetFileDictString(GameConstants.MENU_PLAYLIST);
     currentPlaylist = playList;
     oldVolume = options.MusicVolumeFloat;
     currentVolume = options.MusicVolumeFloat;
     currentCategory = menuCategory;
     CreatePopUpRectangle(options.Resolution);
 }
예제 #22
0
파일: Audio.cs 프로젝트: bradleat/trafps
 /// <summary>
 /// Used to get the category from the Xact file
 /// </summary>
 /// <param name="categoryname">A string of the name of the category i.e "Music"</param>
 /// <returns>Returns an AudioCategory</returns>
 public AudioCategory GetCategory(string categoryname)
 {
     musicCategory = engine.GetCategory(categoryname);
     return musicCategory;
 }
예제 #23
0
파일: Audio.cs 프로젝트: bradleat/trafps
        public float ChangeVolume(AudioCategory category, float volume, bool increase, float maxVolume)
        {
            if (increase)
            {
                volume = MathHelper.Clamp(volume + 0.01f, 0.0f, maxVolume);
            }
            else
                volume = MathHelper.Clamp(volume - 0.01f, 0.0f, maxVolume);

            category.SetVolume(volume);
            return volume;
        }
예제 #24
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()
        {
            botones = new List<Boton>();
            seleccionados = new List<Boton>();
            seguros = new List<Boton>();
            posicionFrameY = new int[4];
            tamFrameX = new int[4];
            tamFrameY = new int[4];
            posicionFrameYs = new int[4];
            tamFrameXs = new int[4];
            tamFrameYs = new int[4];
            pulsados = new Boolean[4];
            posicionBotonY = 276;
            posicionBotonX = 730;
            posicionSeleccionado = 720;
            direccion = 0;
            velocidad = 50;
            idBoton = 0;
            mostrarSeguro = false;

            posicionFrameY[0] = 1346;
            posicionFrameY[1] = 1375;
            posicionFrameY[2] = 1407;
            posicionFrameY[3] = 1443;
            tamFrameX[0] = 164;
            tamFrameX[1] = 234;
            tamFrameX[2] = 77;
            tamFrameX[3] = 177;
            tamFrameY[0] = 29;
            tamFrameY[1] = 31;
            tamFrameY[2] = 30;
            tamFrameY[3] = 35;
            posicionFrameYs[0] = 901;
            posicionFrameYs[1] = 991;
            posicionFrameYs[2] = 1125;
            posicionFrameYs[3] = 1254;
            tamFrameXs[0] = 504;
            tamFrameXs[1] = 434;
            tamFrameXs[2] = 543;
            tamFrameXs[3] = 202;
            tamFrameYs[0] = 90;
            tamFrameYs[1] = 134;
            tamFrameYs[2] = 129;
            tamFrameYs[3] = 92;

            menu = new Mapa(
            Game.Content.Load<Texture2D>(@"Images/menuSprite"),
            new Vector2(0, 0),
            new Point(1366, 768),
            new Point(0, 0),
            new Point(0, 0),
            new Point(0, 0),
            Vector2.Zero,
            0f,
            1000, 0f);

            pointer = new StaticSprite(
            Game.Content.Load<Texture2D>(@"Images/cursor"),
            new Vector2(0, 0),
            new Point(24, 28),
            new Point(5, 5),
            new Point(0, 0),
            new Point(0, 0),
            Vector2.Zero,
            0f,
            1000, 0.9f);

            for (int i = 0; i < 4; i++)
            {

                botones.Add(new Boton(
                Game.Content.Load<Texture2D>(@"Images/menuSprite"),
                new Vector2(1000, posicionBotonY),
                new Point(tamFrameX[i], tamFrameY[i]),
                new Point(0, posicionFrameY[i]),
                new Point(0, posicionFrameY[i]),
                new Point(0, 0),
                Vector2.Zero,
                0f,
                1000, 0.1f)
                );
                posicionBotonY += tamFrameY[i] + 30;
            }

            for (int i = 0; i < 4; i++)
            {

                seleccionados.Add(new Boton(
                Game.Content.Load<Texture2D>(@"Images/menuSprite"),
                new Vector2(posicionBotonX, 85),
                new Point(tamFrameXs[i], tamFrameYs[i]),
                new Point(0, posicionFrameYs[i]),
                new Point(0, posicionFrameYs[i]),
                new Point(0, 0),
                Vector2.Zero,
                0f,
                1000, 0.1f)
                );
                posicionBotonX += tamFrameXs[i] + 300;
            }

                seguros.Add(new Boton(
                Game.Content.Load<Texture2D>(@"Images/menuSprite"),
                new Vector2(525, 380),
                new Point(33,33),
                new Point(0,0),
                new Point(0, 1687),
                new Point(0, 0),
                Vector2.Zero,
                0f,
                1000, 0.89f)
                );

                seguros.Add(new Boton(
                    Game.Content.Load<Texture2D>(@"Images/menuSprite"),
                    new Vector2(675, 380),
                    new Point(51, 33),
                    new Point(0, 0),
                    new Point(0, 1720),
                    new Point(0, 0),
                    Vector2.Zero,
                    0f,
                    1000, 0.89f)
                    );

                seguros.Add(new Boton(
                        Game.Content.Load<Texture2D>(@"Images/menuSprite"),
                        new Vector2(450, 250),
                        new Point(350, 210),
                        new Point(0, 0),
                        new Point(0, 1478),
                        new Point(0, 0),
                        Vector2.Zero,
                        0f,
                        1000, 0.89f)
                        );

            // TODO: Add your initialization code here
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb");
            musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb");
            musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb");
            musicCategory = audioEngine.GetCategory("Default");
            reproducirMusica("menu");
        }
예제 #25
0
        public AudioEngine(string settingsFile, TimeSpan lookAheadTime, string rendererId)
        {
            //Read the xact settings file
            //Credits to alisci01 for initial format documentation
            using (var stream = File.OpenRead(settingsFile))
                using (var reader = new BinaryReader(stream)) {
                    uint magic = reader.ReadUInt32();
                    if (magic != 0x46534758)               //'XGFS'
                    {
                        throw new ArgumentException("XGS format not recognized");
                    }

                    uint toolVersion   = reader.ReadUInt16();
                    uint formatVersion = reader.ReadUInt16();
#if DEBUG
                    if (formatVersion != 42)
                    {
                        Console.WriteLine("Warning: XGS format not supported");
                    }
#endif
                    uint crc = reader.ReadUInt16();              //??

                    uint lastModifiedLow  = reader.ReadUInt32();
                    uint lastModifiedHigh = reader.ReadUInt32();

                    reader.ReadByte();              //unkn, 0x03. Platform?

                    uint numCats = reader.ReadUInt16();
                    uint numVars = reader.ReadUInt16();

                    reader.ReadUInt16();              //unkn, 0x16
                    reader.ReadUInt16();              //unkn, 0x16

                    uint numRpc        = reader.ReadUInt16();
                    uint numDspPresets = reader.ReadUInt16();
                    uint numDspParams  = reader.ReadUInt16();

                    uint catsOffset = reader.ReadUInt32();
                    uint varsOffset = reader.ReadUInt32();

                    reader.ReadUInt32();              //unknown, leads to a short with value of 1?
                    uint catNameIndexOffset = reader.ReadUInt32();
                    reader.ReadUInt32();              //unknown, two shorts of values 2 and 3?
                    uint varNameIndexOffset = reader.ReadUInt32();

                    uint catNamesOffset   = reader.ReadUInt32();
                    uint varNamesOffset   = reader.ReadUInt32();
                    uint rpcOffset        = reader.ReadUInt32();
                    uint dspPresetsOffset = reader.ReadUInt32();
                    uint dspParamsOffset  = reader.ReadUInt32();

                    reader.BaseStream.Seek(catNamesOffset, SeekOrigin.Begin);
                    string[] categoryNames = readNullTerminatedStrings(numCats, reader);

                    categories = new AudioCategory[numCats];
                    reader.BaseStream.Seek(catsOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numCats; i++)
                    {
                        categories [i] = new AudioCategory(this, categoryNames [i], reader);
                        categoryLookup.Add(categoryNames [i], i);
                    }

                    reader.BaseStream.Seek(varNamesOffset, SeekOrigin.Begin);
                    string[] varNames = readNullTerminatedStrings(numVars, reader);

                    variables = new Variable[numVars];
                    reader.BaseStream.Seek(varsOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numVars; i++)
                    {
                        variables [i].name = varNames [i];

                        byte flags = reader.ReadByte();
                        variables [i].isPublic   = (flags & 0x1) != 0;
                        variables [i].isReadOnly = (flags & 0x2) != 0;
                        variables [i].isGlobal   = (flags & 0x4) == 0;
                        variables [i].isReserved = (flags & 0x8) != 0;

                        variables [i].initValue = reader.ReadSingle();
                        variables [i].minValue  = reader.ReadSingle();
                        variables [i].maxValue  = reader.ReadSingle();

                        variables [i].value = variables [i].initValue;

                        variableLookup.Add(varNames [i], i);
                    }

                    rpcCurves = new RpcCurve[numRpc];
                    reader.BaseStream.Seek(rpcOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numRpc; i++)
                    {
                        rpcCurves [i].variable = reader.ReadUInt16();
                        int pointCount = (int)reader.ReadByte();
                        rpcCurves [i].parameter = (RpcParameter)reader.ReadUInt16();

                        rpcCurves [i].points = new RpcPoint[pointCount];
                        for (int j = 0; j < pointCount; j++)
                        {
                            rpcCurves [i].points [j].x    = reader.ReadSingle();
                            rpcCurves [i].points [j].y    = reader.ReadSingle();
                            rpcCurves [i].points [j].type = (RpcPointType)reader.ReadByte();
                        }
                    }
                }
        }
예제 #26
0
        /// <param name="settingsFile">Path to a XACT settings file.</param>
        /// <param name="lookAheadTime">Determines how many milliseconds the engine will look ahead when determing when to transition to another sound.</param>
        /// <param name="rendererId">A string that specifies the audio renderer to use.</param>
        /// <remarks>For the best results, use a lookAheadTime of 250 milliseconds or greater.</remarks>
        public AudioEngine(string settingsFile, TimeSpan lookAheadTime, string rendererId)
        {
            if (string.IsNullOrEmpty(settingsFile))
            {
                throw new ArgumentNullException("settingsFile");
            }

            // Read the xact settings file
            // Credits to alisci01 for initial format documentation
            using (var stream = OpenStream(settingsFile))
                using (var reader = new BinaryReader(stream))
                {
                    uint magic = reader.ReadUInt32();
                    if (magic != 0x46534758) //'XGFS'
                    {
                        throw new ArgumentException("XGS format not recognized");
                    }

                    reader.ReadUInt16(); // toolVersion
                    uint formatVersion = reader.ReadUInt16();
                    if (formatVersion != 42)
                    {
                        Debug.WriteLine("Warning: XGS format " + formatVersion + " not supported!");
                    }

                    reader.ReadUInt16(); // crc
                    reader.ReadUInt32(); // lastModifiedLow
                    reader.ReadUInt32(); // lastModifiedHigh
                    reader.ReadByte();   //unkn, 0x03. Platform?

                    uint numCats = reader.ReadUInt16();
                    uint numVars = reader.ReadUInt16();

                    reader.ReadUInt16(); //unkn, 0x16
                    reader.ReadUInt16(); //unkn, 0x16

                    uint numRpc        = reader.ReadUInt16();
                    uint numDspPresets = reader.ReadUInt16();
                    uint numDspParams  = reader.ReadUInt16();

                    uint catsOffset = reader.ReadUInt32();
                    uint varsOffset = reader.ReadUInt32();

                    reader.ReadUInt32(); //unknown, leads to a short with value of 1?
                    reader.ReadUInt32(); // catNameIndexOffset
                    reader.ReadUInt32(); //unknown, two shorts of values 2 and 3?
                    reader.ReadUInt32(); // varNameIndexOffset

                    uint catNamesOffset = reader.ReadUInt32();
                    uint varNamesOffset = reader.ReadUInt32();
                    uint rpcOffset      = reader.ReadUInt32();
                    reader.ReadUInt32(); // dspPresetsOffset
                    uint dspParamsOffset = reader.ReadUInt32();

                    reader.BaseStream.Seek(catNamesOffset, SeekOrigin.Begin);
                    string[] categoryNames = ReadNullTerminatedStrings(numCats, reader);

                    _categories = new AudioCategory[numCats];
                    reader.BaseStream.Seek(catsOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numCats; i++)
                    {
                        _categories [i] = new AudioCategory(this, categoryNames [i], reader);
                        _categoryLookup.Add(categoryNames [i], i);
                    }

                    reader.BaseStream.Seek(varNamesOffset, SeekOrigin.Begin);
                    string[] varNames = ReadNullTerminatedStrings(numVars, reader);

                    var variables       = new List <RpcVariable>();
                    var cueVariables    = new List <RpcVariable>();
                    var globalVariables = new List <RpcVariable>();
                    reader.BaseStream.Seek(varsOffset, SeekOrigin.Begin);
                    for (var i = 0; i < numVars; i++)
                    {
                        var v = new RpcVariable();
                        v.Name      = varNames[i];
                        v.Flags     = reader.ReadByte();
                        v.InitValue = reader.ReadSingle();
                        v.MinValue  = reader.ReadSingle();
                        v.MaxValue  = reader.ReadSingle();
                        v.Value     = v.InitValue;

                        variables.Add(v);
                        if (!v.IsGlobal)
                        {
                            cueVariables.Add(v);
                        }
                        else
                        {
                            globalVariables.Add(v);
                            _variableLookup.Add(v.Name, globalVariables.Count - 1);
                        }
                    }
                    _cueVariables = cueVariables.ToArray();
                    _variables    = globalVariables.ToArray();

                    var reverbCurves = new List <RpcCurve>();
                    RpcCurves = new RpcCurve[numRpc];
                    if (numRpc > 0)
                    {
                        reader.BaseStream.Seek(rpcOffset, SeekOrigin.Begin);
                        for (var i = 0; i < numRpc; i++)
                        {
                            var curve = new RpcCurve();
                            curve.FileOffset = (uint)reader.BaseStream.Position;

                            var variable = variables[reader.ReadUInt16()];
                            if (variable.IsGlobal)
                            {
                                curve.IsGlobal = true;
                                curve.Variable = globalVariables.FindIndex(e => e.Name == variable.Name);
                            }
                            else
                            {
                                curve.IsGlobal = false;
                                curve.Variable = cueVariables.FindIndex(e => e.Name == variable.Name);
                            }

                            var pointCount = (int)reader.ReadByte();
                            curve.Parameter = (RpcParameter)reader.ReadUInt16();

                            curve.Points = new RpcPoint[pointCount];
                            for (var j = 0; j < pointCount; j++)
                            {
                                curve.Points[j].Position = reader.ReadSingle();
                                curve.Points[j].Value    = reader.ReadSingle();
                                curve.Points[j].Type     = (RpcPointType)reader.ReadByte();
                            }

                            // If the parameter is greater than the max then this is a DSP
                            // parameter which is for reverb.
                            var dspParameter = curve.Parameter - RpcParameter.NumParameters;
                            if (dspParameter >= 0 && variable.IsGlobal)
                            {
                                reverbCurves.Add(curve);
                            }

                            RpcCurves[i] = curve;
                        }
                    }
                    _reverbCurves = reverbCurves.ToArray();

                    if (numDspPresets > 0)
                    {
                        // Note:  It seemed like MS designed this to support multiple
                        // DSP effects, but in practice XACT only has one... Microsoft Reverb.
                        //
                        // So because of this we know exactly how many presets and
                        // parameters we should have.
                        if (numDspPresets != 1)
                        {
                            throw new Exception("Unexpected number of DSP presets!");
                        }
                        if (numDspParams != 22)
                        {
                            throw new Exception("Unexpected number of DSP parameters!");
                        }

                        reader.BaseStream.Seek(dspParamsOffset, SeekOrigin.Begin);
                        _reverbSettings = new ReverbSettings(reader);
                    }
                }

            _stopwatch = new Stopwatch();
            _stopwatch.Start();
        }
        //+++++++++++++++++++++++         INITIALIZE        +++++++++++++++++
        /// <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()
        {
            rnd = new Random();
            texto = "";

            tiempoMuertoKielTotal = 7000;
            estaEnSuSitio = false;
            kielMuertoSprite = false;
            tiempoMuertoKiel = 0;
            kielMuerto = false;
            tocaRayoKiel = false;
            tiempoTocaRayoKiel = 5000;
            currMouseState = Mouse.GetState();
            lastMouseState = Mouse.GetState();
            fondo = false;
            completoDelTo = false;
            tiempoFin = 0;
            collisionOffSet = Point.Zero;
            cayendo = false;
            tiempoLluvia = 0;
            densidadLluvia2 = 500;
            tiempoLluvia2 = 0;
            colision = 0;
            colisiond = 0;
            colisioni = 0;
            parada = 0;
            alturaTerreno = 4;
            jumpTimer = -10f;
            tiempoVelocidadSalto = 0;
            mundo1 = new Mundo(2.2f);
            currentDisparoState = DisparoState.Quieto;
            currentGravedadState = GravedadState.Aire;
            borrarBala = false;
            filas = 20;
            columnas = 0;
            count = 0;

            spriteList = new List<AutomatedSprite>();
            kiel = new List<JefeFinal>();
            disparoList = new List<Disparo>();
            lluviaList = new List<Disparo>();
            lluviaList2 = new List<Disparo>();
            mapaList = new List<Mapa>();
            terrenoList = new List<Mapa>();
            terrenoList2 = new List<Mapa>();
            terrenoListSuelo = new List<Mapa>();
            fondoList1 = new List<Mapa>();
            fondoList2 = new List<Mapa>();
            map = new List<Point>();
            disparoJefeList = new List<Mapa>();
            jefeList = new List<Jefe>();
            vidaList = new List<Mapa>();
            vidaList2 = new List<Mapa>();
            vidaListKiel = new List<Mapa>();
            vidaList2Kiel = new List<Mapa>();
            tigres = new List<Mapa>();
            maxPosBloque = 0f;
            terrenoTiempoPasado = 0;
            terrenoDireccion = 0;
            terrenoDireccionAnterior = 4;
            terrenoTiempo = 100;
            temblorTerrenoTime = 0;
            temblorTerrenoElec = 0;
            temblorTerrenoNivel = 3;
            arrastre = 0;
            //Lluvia
            densidadLluvia = 500; //milisegundos entre mota
            velocidadLluvia = 6f;
            viento = -2;

            enemySpawnMinMilliseconds = 1000;
            enemySpawnMaxMilliseconds = 2000;
            enemyMinSpeed = 2;
            enemyMaxSpeed = 6;

            nextSpawnTime = 0;

            //Variables jefe
            respawnJefeMin = 0;
            respawnJefeMax = 1;

            //Posiciones
            posicionTerrenoX = 0;
            posicionTerrenoY = 700;
            posicionTerrenoBase = 0;
            posicionFondo1 = -1000;
            posicionFondo2 = -1000;

            //Disparo
            delayDisparo = 200;
            delayDisparoCurrent = 900;
            animaDisparo = 0;
            //Monsturo
            heridoDelayCurrent = 0;
            //Mapa
            cambioMapaDelay = 8000;
            cambioMapaDelayCurrent = 0;
            hastaMapa1 = 8000;
            hastaMapa2 = 15000;
            currentParteMapa = ParteMapa.Suelo;
            numFondo1 = 0;
            numFondo2 = 0;
            numTerreno1 = 0;
            capaTerreno = 0.5f;

            //Muerte
            caido = false;
            puntosControl = new List<float>();
            puntoControl = 0;
            vidaPos = 0;
            vidaPosKiel = 0;
            tiempoHerido = 500f;
            tiempoMuerto = 0;
            muertoDelTo = false;

            for (int n = 0; n < 200; n++)
                map.Add(new Point(2, 0));

            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb");
            waveBank2 = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank 2.xwb");
            soundBank2 = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank 2.xsb");
            musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb");
            musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb");
            ambientWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Ambient.xwb");
            ambientBank = new SoundBank(audioEngine, @"Content\Sonidos\Ambient Bank.xsb");
            musicCategory = audioEngine.GetCategory("Default");
            musicCategory.SetVolume(0);
            //disparoJefeList.Add(new Mapa(
            //                Game.Content.Load<Texture2D>(@"Images/DisparoJefe"),
            //                new Vector2(kiel.getPlayerPosition.X + posxDisparoKiel, kiel.getPlayerPosition.Y),
            //                new Point(0, 0),
            //                new Point(200, 200),
            //                new Point(0, 0),
            //                new Point(4, 1),
            //                new Vector2(0f, 0),
            //                0f,
            //                1000, 0.89f));

            complete = new Mapa(
                Game.Content.Load<Texture2D>(@"Images/LevelComplete"),
                new Vector2(120, 120),
                new Point(1140, 496),
                new Point(0, 0),
                new Point(0, 0),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f);

            vidaList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(0, 0),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
            vidaPos += 7;
            for (int i = 0; i < 28; i++)
            {
                vidaList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(1, 0),
                new Point(1, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
                vidaPos += 7;
            }
            vidaList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(2, 0),
                new Point(2, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
            vidaPos = 0;
            vidaList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(0, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
            vidaPos += 7;
            for (int i = 0; i < 28; i++)
            {
                vidaList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(1, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
                vidaPos += 7;
            }
            vidaList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(2, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
            vidaPos += 7;

            //Vida de kiel

            vidaListKiel.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"),
                new Vector2(500 + vidaPosKiel, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(0, 0),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
            vidaPosKiel += 7;
            for (int i = 0; i < 98; i++)
            {
                vidaListKiel.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"),
                new Vector2(500 + vidaPosKiel, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(1, 0),
                new Point(1, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
                vidaPosKiel += 7;
            }
            vidaListKiel.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"),
                new Vector2(500 + vidaPosKiel, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(2, 0),
                new Point(2, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
            vidaPosKiel = 0;
            vidaList2Kiel.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"),
                new Vector2(500 + vidaPosKiel, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(0, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
            vidaPosKiel += 7;
            for (int i = 0; i < 98; i++)
            {
                vidaList2Kiel.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"),
                new Vector2(500 + vidaPosKiel, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(1, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
                vidaPosKiel += 7;
            }
            vidaList2Kiel.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSpriteKiel"),
                new Vector2(500 + vidaPosKiel, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(2, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
            vidaPosKiel += 7;

            player = new UserControlledSprite(
            Game.Content.Load<Texture2D>(@"Images/pj"),
            new Vector2((1366 / 2) - 152, 300),
            new Point(194, 178),
            new Point(collisionOffSet.X, collisionOffSet.Y),
            new Point(0, 0),
            new Point(0, 0),
            new Vector2(0f, 0),
            0f,
            70, 0.80f, 30);

            pointer = new StaticSprite(
            Game.Content.Load<Texture2D>(@"Images/cursor"),
            new Vector2(0, 0),
            new Point(24, 28),
            new Point(5, 5),
            new Point(0, 0),
            new Point(0, 0),
            Vector2.Zero,
            0f,
            1000, 0.9f);

            reproducirMusica("kiel");
            reproducirAmbiente("viento");
            trackCue = soundBank.GetCue("caido");
            trackCue2 = soundBank2.GetCue("bicho1");
            //Suelo(-100, posicionTerrenoY, 0, -600, terrenoList);
            SueloGrande(0, posicionTerrenoY, 0, -100, terrenoList);
            SueloGrande(posicionTerrenoX + 1000, posicionTerrenoY, 0, 0, terrenoList);
            Escaleras(-400 , posicionTerrenoY - 200, 600, 0, 2, terrenoList2, 0.210f, true);

            kiel.Add(new JefeFinal(
            Game.Content.Load<Texture2D>(@"Images/kiel"),
            new Vector2(500, 20),
            new Point(180, 200),
            new Point(80, 30),
            new Point(0, 0),
            new Point(4, 2),
            new Vector2(5, 5),
            0f,
            400, 0.95f, 100));

            final = new Mapa(
            Game.Content.Load<Texture2D>(@"Images/final"),
            new Vector2(posicionTerrenoX + 2000, posicionTerrenoY - 146),
            new Point(171, 156),
            new Point(0, 0),
            new Point(0, 1),
            new Point(4, 3),
            new Vector2(0f, 0),
            0f,
            200, 0.9f);
            posicionTerrenoX = 0;
            posicionTerrenoY = 0;

            //Escaleras(posicionTerrenoX + 600, posicionTerrenoY, 100, 10, 10, terrenoList2, 0.210f, true);
            //SegundoPlano();

            foreach (Sprite s in terrenoList2)
            {
                s.getEscala = 0.8f;
                s.GetCollisionOffSet = new Point(60, 60);
            }

            puntuacionFuente = Game.Content.Load<SpriteFont>(@"Fuentes\fuente");

            player.setTamAura = 300;
            foreach (Sprite s in jefeList)
                s.setTamAura = 400;
        }
예제 #28
0
        ////////////////////////////////////////////////////////////////////////////////
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);

              title_sprite = Content.Load<Texture2D> ("images/title_trans");
              title_yellow = Content.Load<Texture2D> ("images/title_yellow");
              title_green = Content.Load<Texture2D> ("images/title_green");
              title_blue = Content.Load<Texture2D> ("images/title_blue");
              title_red = Content.Load<Texture2D> ("images/title_red");
              title_orange = Content.Load<Texture2D> ("images/title_orange");
              menu_new_sprite = Content.Load<Texture2D> ("images/menu_newgame");
              menu_instruct_sprite = Content.Load<Texture2D> ("images/menu_instruct");
              menu_exit_sprite = Content.Load<Texture2D> ("images/menu_exit");
              menu_resume_sprite = Content.Load<Texture2D> ("images/menu_resume");
              ng_sprite = Content.Load<Texture2D> ("images/ng");
              menu_credits_sprite = Content.Load<Texture2D> ("images/credits_sprite2");
              bg1 = Content.Load<Texture2D> ("images/bg1c");
              bg2 = Content.Load<Texture2D> ("images/bg2");
              bg3 = Content.Load<Texture2D> ("images/bg3");
              bg4 = Content.Load<Texture2D> ("images/bg4");
              bg5 = Content.Load<Texture2D> ("images/bg5");
              bg6 = Content.Load<Texture2D> ("images/bg6");
              instructions1 = Content.Load<Texture2D> ("images/instructions1");
              instructions2 = Content.Load<Texture2D> ("images/instructions2");
              //instructions_blur = Content.Load<Texture2D> ("images/instructions_blur");
              credits_screen = Content.Load<Texture2D> ("images/credits7");
              chart_sprite = Content.Load<Texture2D> ("images/Chart1");
              chart_stuff_sprite = Content.Load<Texture2D> ("images/Chart2");
              wall_sprite = Content.Load<Texture2D> ("images/Walls");
              conveyor_sprite = Content.Load<Texture2D> ("images/Conveyor");
              grabber_sprite = Content.Load<Texture2D> ("images/Grabber");
              lightning_sprite = Content.Load<Texture2D> ("images/Lightning");
              frame_sprite = Content.Load<Texture2D> ("images/Frame3");
              block_sprite = Content.Load<Texture2D> ("images/Blocks");
              big_purple_sprite = Content.Load<Texture2D> ("images/bigpurple");
              rainbow_sprite = Content.Load<Texture2D> ("images/Rainbow");
              box_sprite = Content.Load<Texture2D> ("images/Box2");
              box_newgame_sprite = Content.Load<Texture2D> ("images/box_newgame");
              box_difficulty_sprite = Content.Load<Texture2D> ("images/box_difficulty");
              box_menu_sprite = Content.Load<Texture2D> ("images/box_menu");
              box_sound_sprite = Content.Load<Texture2D> ("images/box_sound");
              box_on_sprite = Content.Load<Texture2D> ("images/box_on");
              box_off_sprite = Content.Load<Texture2D> ("images/box_off");
              box_music_sprite = Content.Load<Texture2D> ("images/box_music");
              box_on2_sprite = Content.Load<Texture2D> ("images/box_on2");
              box_off2_sprite = Content.Load<Texture2D> ("images/box_off2");
              box_1_sprite = Content.Load<Texture2D> ("images/box_1");
              box_2_sprite = Content.Load<Texture2D> ("images/box_2");
              box_3_sprite = Content.Load<Texture2D> ("images/box_3");
              box_4_sprite = Content.Load<Texture2D> ("images/box_4");
              box_5_sprite = Content.Load<Texture2D> ("images/box_5");
              box_6_sprite = Content.Load<Texture2D> ("images/box_6");
              box_7_sprite = Content.Load<Texture2D> ("images/box_7");
              box_8_sprite = Content.Load<Texture2D> ("images/box_8");
              box_9_sprite = Content.Load<Texture2D> ("images/box_9");
              box_10_sprite = Content.Load<Texture2D> ("images/box_10");
              box_height_sprite = Content.Load<Texture2D> ("images/box_height");
              box_exit_sprite = Content.Load<Texture2D> ("images/box_exit");
              box_timer_sprite = Content.Load<Texture2D> ("images/box_timer");
              timer_0_sprite = Content.Load<Texture2D> ("images/timer_0");
              timer_1_sprite = Content.Load<Texture2D> ("images/timer_1");
              timer_2_sprite = Content.Load<Texture2D> ("images/timer_2");
              timer_3_sprite = Content.Load<Texture2D> ("images/timer_3");
              timer_4_sprite = Content.Load<Texture2D> ("images/timer_4");
              timer_5_sprite = Content.Load<Texture2D> ("images/timer_5");
              timer_6_sprite = Content.Load<Texture2D> ("images/timer_6");
              timer_7_sprite = Content.Load<Texture2D> ("images/timer_7");
              timer_8_sprite = Content.Load<Texture2D> ("images/timer_8");
              timer_9_sprite = Content.Load<Texture2D> ("images/timer_9");
              counter_0_sprite = Content.Load<Texture2D> ("images/counter_0");
              counter_1_sprite = Content.Load<Texture2D> ("images/counter_1");
              counter_2_sprite = Content.Load<Texture2D> ("images/counter_2");
              counter_3_sprite = Content.Load<Texture2D> ("images/counter_3");
              counter_4_sprite = Content.Load<Texture2D> ("images/counter_4");
              counter_5_sprite = Content.Load<Texture2D> ("images/counter_5");
              counter_6_sprite = Content.Load<Texture2D> ("images/counter_6");
              counter_7_sprite = Content.Load<Texture2D> ("images/counter_7");
              counter_8_sprite = Content.Load<Texture2D> ("images/counter_8");
              counter_9_sprite = Content.Load<Texture2D> ("images/counter_9");
              counter_label = Content.Load<Texture2D> ("images/blocksleft3");
              blockhead_logo_sprite = Content.Load<Texture2D> ("images/blockhead3");
              youwin_sprite = Content.Load<Texture2D> ("images/youwin");
              youlose_sprite = Content.Load<Texture2D> ("images/youlose");
              particle_red = Content.Load<Texture2D> ("images/particle_red");
              particle_orange = Content.Load<Texture2D> ("images/particle_orange");
              particle_yellow = Content.Load<Texture2D> ("images/particle_yellow");
              particle_green = Content.Load<Texture2D> ("images/particle_green");
              particle_blue = Content.Load<Texture2D> ("images/particle_blue");
              particle_purple = Content.Load<Texture2D> ("images/particle_purple");
              particle_white = Content.Load<Texture2D> ("images/particle_white");
              particle_grey = Content.Load<Texture2D> ("images/particle_grey");
              particle_black = Content.Load<Texture2D> ("images/particle_black");
              particle_smoke_sprite = Content.Load<Texture2D> ("images/particle_smoke");
              solid_black = Content.Load<Texture2D> ("images/solid_black");
              solid_white = Content.Load<Texture2D> ("images/solid_white");
              solid_red = Content.Load<Texture2D> ("images/solid_red");
              solid_orange = Content.Load<Texture2D> ("images/solid_orange");
              solid_yellow = Content.Load<Texture2D> ("images/solid_yellow");
              solid_green = Content.Load<Texture2D> ("images/solid_green");
              solid_blue = Content.Load<Texture2D> ("images/solid_blue");
              solid_purple = Content.Load<Texture2D> ("images/solid_purple");
              color_flash_sprite = Content.Load<Texture2D> ("images/solid_white");
              splash_sprite = Content.Load<Texture2D> ("images/splash2");
              intro_lightning1_sprite = Content.Load<Texture2D> ("images/lightning1a");
              intro_lightning2_sprite = Content.Load<Texture2D> ("images/lightning2");
              intro_lightning3_sprite = Content.Load<Texture2D> ("images/lightning3");
              credits_hypno = Content.Load<Texture2D> ("images/hypno3");
              demolition_sprite = Content.Load<Texture2D> ("images/demolition1c");

              title_bg_sprite = title_green;

              debug_font = Content.Load<SpriteFont>("Kooten");

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

              sound_category = audioEngine.GetCategory("Default");
              music_category = audioEngine.GetCategory("Music");

              sound_category.SetVolume(sound_volume);
              music_category.SetVolume(music_volume);
        }
예제 #29
0
        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);
        }
예제 #30
0
        /// <param name="settingsFile">Path to a XACT settings file.</param>
        /// <param name="lookAheadTime">Determines how many milliseconds the engine will look ahead when determing when to transition to another sound.</param>
        /// <param name="rendererId">A string that specifies the audio renderer to use.</param>
        /// <remarks>For the best results, use a lookAheadTime of 250 milliseconds or greater.</remarks>
		public AudioEngine (string settingsFile, TimeSpan lookAheadTime, string rendererId)
		{
			//Read the xact settings file
			//Credits to alisci01 for initial format documentation
#if !ANDROID
			using (var stream = TitleContainer.OpenStream(settingsFile))
			{
#else
			using (var fileStream = Game.Activity.Assets.Open(settingsFile))
			{
				MemoryStream stream = new MemoryStream();
				fileStream.CopyTo(stream);
				stream.Position = 0;
#endif
				using (var reader = new BinaryReader(stream)) {
					uint magic = reader.ReadUInt32 ();
					if (magic != 0x46534758) { //'XGFS'
						throw new ArgumentException ("XGS format not recognized");
					}

                    reader.ReadUInt16 (); // toolVersion
					uint formatVersion = reader.ReadUInt16 ();
#if DEBUG
					if (formatVersion != 42) {
						System.Diagnostics.Debug.WriteLine ("Warning: XGS format not supported");
					}
#endif
                    reader.ReadUInt16 (); // crc

                    reader.ReadUInt32 (); // lastModifiedLow
                    reader.ReadUInt32 (); // lastModifiedHigh

					reader.ReadByte (); //unkn, 0x03. Platform?

					uint numCats = reader.ReadUInt16 ();
					uint numVars = reader.ReadUInt16 ();

					reader.ReadUInt16 (); //unkn, 0x16
					reader.ReadUInt16 (); //unkn, 0x16

					uint numRpc = reader.ReadUInt16 ();
                    reader.ReadUInt16 (); // numDspPresets
                    reader.ReadUInt16 (); // numDspParams

					uint catsOffset = reader.ReadUInt32 ();
					uint varsOffset = reader.ReadUInt32 ();

					reader.ReadUInt32 (); //unknown, leads to a short with value of 1?
                    reader.ReadUInt32 (); // catNameIndexOffset
					reader.ReadUInt32 (); //unknown, two shorts of values 2 and 3?
                    reader.ReadUInt32 (); // varNameIndexOffset

					uint catNamesOffset = reader.ReadUInt32 ();
					uint varNamesOffset = reader.ReadUInt32 ();
					uint rpcOffset = reader.ReadUInt32 ();
                    reader.ReadUInt32 (); // dspPresetsOffset
                    reader.ReadUInt32 (); // dspParamsOffset
					reader.BaseStream.Seek (catNamesOffset, SeekOrigin.Begin);
					string[] categoryNames = readNullTerminatedStrings (numCats, reader);

					categories = new AudioCategory[numCats];
					reader.BaseStream.Seek (catsOffset, SeekOrigin.Begin);
					for (int i=0; i<numCats; i++) {
						categories [i] = new AudioCategory (this, categoryNames [i], reader);
						categoryLookup.Add (categoryNames [i], i);
					}

					reader.BaseStream.Seek (varNamesOffset, SeekOrigin.Begin);
					string[] varNames = readNullTerminatedStrings (numVars, reader);

					variables = new Variable[numVars];
					reader.BaseStream.Seek (varsOffset, SeekOrigin.Begin);
					for (int i=0; i<numVars; i++) {
						variables [i].name = varNames [i];

						byte flags = reader.ReadByte ();
						variables [i].isPublic = (flags & 0x1) != 0;
						variables [i].isReadOnly = (flags & 0x2) != 0;
						variables [i].isGlobal = (flags & 0x4) == 0;
						variables [i].isReserved = (flags & 0x8) != 0;
						
						variables [i].initValue = reader.ReadSingle ();
						variables [i].minValue = reader.ReadSingle ();
						variables [i].maxValue = reader.ReadSingle ();

						variables [i].value = variables [i].initValue;

						variableLookup.Add (varNames [i], i);
					}

					rpcCurves = new RpcCurve[numRpc];
					reader.BaseStream.Seek (rpcOffset, SeekOrigin.Begin);
					for (int i=0; i<numRpc; i++) {
						rpcCurves [i].variable = reader.ReadUInt16 ();
						int pointCount = (int)reader.ReadByte ();
						rpcCurves [i].parameter = (RpcParameter)reader.ReadUInt16 ();

						rpcCurves [i].points = new RpcPoint[pointCount];
						for (int j=0; j<pointCount; j++) {
							rpcCurves [i].points [j].x = reader.ReadSingle ();
							rpcCurves [i].points [j].y = reader.ReadSingle ();
							rpcCurves [i].points [j].type = (RpcPointType)reader.ReadByte ();
						}
					}

				}
			}

            _stopwatch = new Stopwatch();
            _stopwatch.Start();
		}
예제 #31
0
        /// <param name="settingsFile">Path to a XACT settings file.</param>
        /// <param name="lookAheadTime">Determines how many milliseconds the engine will look ahead when determing when to transition to another sound.</param>
        /// <param name="rendererId">A string that specifies the audio renderer to use.</param>
        /// <remarks>For the best results, use a lookAheadTime of 250 milliseconds or greater.</remarks>
        public AudioEngine(string settingsFile, TimeSpan lookAheadTime, string rendererId)
        {
            //Read the xact settings file
            //Credits to alisci01 for initial format documentation
#if !ANDROID
            using (var stream = TitleContainer.OpenStream(settingsFile))
            {
#else
            using (var fileStream = Game.Activity.Assets.Open(settingsFile))
            {
                MemoryStream stream = new MemoryStream();
                fileStream.CopyTo(stream);
                stream.Position = 0;
#endif
                using (var reader = new BinaryReader(stream)) {
                    uint magic = reader.ReadUInt32();
                    if (magic != 0x46534758)                       //'XGFS'
                    {
                        throw new ArgumentException("XGS format not recognized");
                    }

                    reader.ReadUInt16();  // toolVersion
                    uint formatVersion = reader.ReadUInt16();
#if DEBUG
                    if (formatVersion != 42)
                    {
                        System.Diagnostics.Debug.WriteLine("Warning: XGS format not supported");
                    }
#endif
                    reader.ReadUInt16();  // crc

                    reader.ReadUInt32();  // lastModifiedLow
                    reader.ReadUInt32();  // lastModifiedHigh

                    reader.ReadByte();    //unkn, 0x03. Platform?

                    uint numCats = reader.ReadUInt16();
                    uint numVars = reader.ReadUInt16();

                    reader.ReadUInt16();                      //unkn, 0x16
                    reader.ReadUInt16();                      //unkn, 0x16

                    uint numRpc = reader.ReadUInt16();
                    reader.ReadUInt16();  // numDspPresets
                    reader.ReadUInt16();  // numDspParams

                    uint catsOffset = reader.ReadUInt32();
                    uint varsOffset = reader.ReadUInt32();

                    reader.ReadUInt32();  //unknown, leads to a short with value of 1?
                    reader.ReadUInt32();  // catNameIndexOffset
                    reader.ReadUInt32();  //unknown, two shorts of values 2 and 3?
                    reader.ReadUInt32();  // varNameIndexOffset

                    uint catNamesOffset = reader.ReadUInt32();
                    uint varNamesOffset = reader.ReadUInt32();
                    uint rpcOffset      = reader.ReadUInt32();
                    reader.ReadUInt32();  // dspPresetsOffset
                    reader.ReadUInt32();  // dspParamsOffset
                    reader.BaseStream.Seek(catNamesOffset, SeekOrigin.Begin);
                    string[] categoryNames = readNullTerminatedStrings(numCats, reader);

                    categories = new AudioCategory[numCats];
                    reader.BaseStream.Seek(catsOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numCats; i++)
                    {
                        categories [i] = new AudioCategory(this, categoryNames [i], reader);
                        categoryLookup.Add(categoryNames [i], i);
                    }

                    reader.BaseStream.Seek(varNamesOffset, SeekOrigin.Begin);
                    string[] varNames = readNullTerminatedStrings(numVars, reader);

                    variables = new Variable[numVars];
                    reader.BaseStream.Seek(varsOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numVars; i++)
                    {
                        variables [i].name = varNames [i];

                        byte flags = reader.ReadByte();
                        variables [i].isPublic   = (flags & 0x1) != 0;
                        variables [i].isReadOnly = (flags & 0x2) != 0;
                        variables [i].isGlobal   = (flags & 0x4) == 0;
                        variables [i].isReserved = (flags & 0x8) != 0;

                        variables [i].initValue = reader.ReadSingle();
                        variables [i].minValue  = reader.ReadSingle();
                        variables [i].maxValue  = reader.ReadSingle();

                        variables [i].value = variables [i].initValue;

                        variableLookup.Add(varNames [i], i);
                    }

                    rpcCurves = new RpcCurve[numRpc];
                    reader.BaseStream.Seek(rpcOffset, SeekOrigin.Begin);
                    for (int i = 0; i < numRpc; i++)
                    {
                        rpcCurves [i].variable = reader.ReadUInt16();
                        int pointCount = (int)reader.ReadByte();
                        rpcCurves [i].parameter = (RpcParameter)reader.ReadUInt16();

                        rpcCurves [i].points = new RpcPoint[pointCount];
                        for (int j = 0; j < pointCount; j++)
                        {
                            rpcCurves [i].points [j].x    = reader.ReadSingle();
                            rpcCurves [i].points [j].y    = reader.ReadSingle();
                            rpcCurves [i].points [j].type = (RpcPointType)reader.ReadByte();
                        }
                    }
                }
            }

            _stopwatch = new Stopwatch();
            _stopwatch.Start();
        }
예제 #32
0
파일: gxtAudioScene.cs 프로젝트: Loko/GXT
 public gxtAudioCollection(AudioCategory category)
 {
     this.category = category;
     cues = new List<Cue>();
     Volume = 1.0f;
 }
예제 #33
0
        public override void Initialize()
        {
            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            creditosList = new List<Mapa>();
            creditosList2 = new List<Mapa>();
            tiempoEmpiezo = 0;
            pararCreditos = false;
            audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb");
            waveBank2 = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank 2.xwb");
            soundBank2 = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank 2.xsb");
            musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb");
            musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb");
            ambientWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Ambient.xwb");
            ambientBank = new SoundBank(audioEngine, @"Content\Sonidos\Ambient Bank.xsb");
            musicCategory = audioEngine.GetCategory("Default");
            musicCategory.SetVolume(0);
            reproducirMusica("batidora");

            puntero = new StaticSprite(
            Game.Content.Load<Texture2D>(@"Images/cursor"),
            new Vector2(0, 0),
            new Point(24, 28),
            new Point(5, 5),
            new Point(0, 0),
            new Point(0, 0),
            Vector2.Zero,
            0f,
            1000, 0.9f);
            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (455 / 2), (768 / 2) - 145),
                new Point(455, 142),
                new Point(0, 0),
                new Point(0, 0),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366/2)-(807/2), 768),
                new Point(807, 104),
                new Point(0, 0),
                new Point(0, 160),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (324 / 2), 768 + 120),
                new Point(324, 45),
                new Point(0, 0),
                new Point(0, 600),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/pj"),
                new Vector2((1366 / 2) - (194 / 2), 950),
                new Point(194, 178),
                new Point(0, 0),
                new Point(0, 0),
                new Point(4, 0),
                new Vector2(0f, 0),
                0f,
                300, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (383 / 2), 1152),
                new Point(383, 97),
                new Point(0, 0),
                new Point(0, 274),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (324 / 2), 1152 + 120),
                new Point(324, 45),
                new Point(0, 0),
                new Point(0, 600),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/growlie"),
                new Vector2((1366 / 2) - (87 / 2), 1370),
                new Point(87, 88),
                new Point(0, 0),
                new Point(0, 0),
                new Point(3, 1),
                new Vector2(0f, 0),
                0f,
                500, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (375 / 2), 1470),
                new Point(375, 105),
                new Point(0, 0),
                new Point(0, 374),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (324 / 2), 1470 + 120),
                new Point(324, 45),
                new Point(0, 0),
                new Point(0, 600),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/kiel"),
                new Vector2((1366 / 2) - (180 / 2), 1670),
                new Point(180, 200),
                new Point(0, 0),
                new Point(0, 0),
                new Point(4, 1),
                new Vector2(0f, 0),
                0f,
                500, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (912 / 2), 1870),
                new Point(912, 121),
                new Point(0, 0),
                new Point(0, 479),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (498 / 2), 1870 + 120),
                new Point(498, 49),
                new Point(0, 0),
                new Point(0, 644),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (500 / 2), 1990 + 70),
                new Point(500, 50),
                new Point(0, 0),
                new Point(0, 692),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (626 / 2), 2060 + 70),
                new Point(626, 52),
                new Point(0, 0),
                new Point(0, 749),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));

            creditosList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/creditos"),
                new Vector2((1366 / 2) - (168 / 2), 2330),
                new Point(168, 174),
                new Point(0, 0),
                new Point(0, 809),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
        }
예제 #34
0
파일: Cue.cs 프로젝트: clarvalon/FNA
		internal Cue(
			AudioEngine audioEngine,
			List<string> waveBankNames,
			string name,
			CueData data,
			bool managed
		) {
			INTERNAL_baseEngine = audioEngine;

			Name = name;

			INTERNAL_data = data;
			foreach (XACTSound curSound in data.Sounds)
			{
				if (!curSound.HasLoadedTracks)
				{
					curSound.LoadTracks(
						INTERNAL_baseEngine,
						waveBankNames
					);
				}
			}

			INTERNAL_isManaged = managed;

			INTERNAL_category = INTERNAL_baseEngine.INTERNAL_initCue(
				this,
				data.Category
			);

			eventVolume = 1.0f;
			eventPitch = 0.0f;

			INTERNAL_userControlledPlaying = false;
			INTERNAL_isPositional = false;

			INTERNAL_eventList = new List<XACTEvent>();
			INTERNAL_eventPlayed = new List<bool>();
			INTERNAL_eventLoops = new Dictionary<XACTEvent, int>();
			INTERNAL_waveEventSounds = new Dictionary<SoundEffectInstance, XACTEvent>();

			INTERNAL_timer =  new Stopwatch();

			INTERNAL_instancePool = new List<SoundEffectInstance>();
			INTERNAL_instanceVolumes = new List<float>();
			INTERNAL_instancePitches = new List<float>();

			INTERNAL_rpcTrackVolumes = new List<float>();
			INTERNAL_rpcTrackPitches = new List<float>();
		}
예제 #35
0
        internal Cue(
            AudioEngine audioEngine,
            List <string> waveBankNames,
            string name,
            CueData data,
            bool managed
            )
        {
            INTERNAL_baseEngine    = audioEngine;
            INTERNAL_waveBankNames = waveBankNames;

            Name = name;

            INTERNAL_data = data;
            IsPrepared    = false;
            IsPreparing   = true;

            INTERNAL_maxRpcReleaseTime = 0;

            foreach (XACTSound curSound in data.Sounds)
            {
                /* Determine the release times per track, if any, to be used to extend
                 * the sound when playing the release.
                 */
                {
                    ushort maxReleaseMS = 0;

                    // Loop over tracks.
                    for (int i = 0; i < curSound.RPCCodes.Count; i += 1)
                    {
                        // Loop over curves.
                        foreach (uint curCode in curSound.RPCCodes[i])
                        {
                            RPC curRPC = INTERNAL_baseEngine.INTERNAL_getRPC(curCode);
                            if (!INTERNAL_baseEngine.INTERNAL_isGlobalVariable(curRPC.Variable))
                            {
                                // Only release times applied to volume are considered.
                                if (curRPC.Variable.Equals("ReleaseTime") && curRPC.Parameter == RPCParameter.Volume)
                                {
                                    maxReleaseMS = Math.Max((ushort)curRPC.LastPoint.X, maxReleaseMS);
                                }
                            }
                        }
                    }

                    // Keep track of the maximum release time to extend the sound.
                    INTERNAL_maxRpcReleaseTime = maxReleaseMS;
                }
            }

            IsPrepared  = true;
            IsPreparing = false;

            IsStopped = false;

            INTERNAL_isManaged = managed;

            INTERNAL_category = INTERNAL_baseEngine.INTERNAL_initCue(
                this,
                data.Category
                );

            eventVolume = 0.0;
            eventPitch  = 0.0f;

            INTERNAL_userControlledPlaying = false;
            INTERNAL_isPositional          = false;

            INTERNAL_playWaveEventBySound =
                new Dictionary <SoundEffectInstance, PlayWaveEventInstance>();

            INTERNAL_timer = new Stopwatch();

            INTERNAL_instancePool    = new List <SoundEffectInstance>();
            INTERNAL_instanceVolumes = new List <double>();
            INTERNAL_instancePitches = new List <short>();

            INTERNAL_rpcTrackVolumes = new List <float>();
            INTERNAL_rpcTrackPitches = new List <float>();
        }
예제 #36
0
        public SoundHelper(AudioEngine audioengine, System.IO.BinaryReader reader)
        {
            _priority = reader.ReadInt32();

            int volume = reader.ReadInt32();
            double attenuation_in_db = volume / 100.0f;
            GSGE.Debug.assert(attenuation_in_db <= 0);
            gain = (float)Math.Pow(10, attenuation_in_db / 20.0);
            GSGE.Debug.assert(gain <= 1.0f);

            _pitch = (float)(reader.ReadInt32() / 100.0f);

            int trackCount = reader.ReadInt32();
            _tracks = new TrackHelper[trackCount];
            for (int i = 0; i < trackCount; i++)
            {
                _tracks[i] = new TrackHelper(reader);
            }

            int strLen = reader.ReadInt16();
            byte[] bytes = reader.ReadBytes((int)strLen);
            string catname = Encoding.ASCII.GetString(bytes);
            category = audioengine.GetCategory(catname);

            int rpcCount = reader.ReadInt32();
            rpcs = new RPCCurve[rpcCount];
            for (int i = 0; i < rpcCount; i++)
            {
                strLen = reader.ReadInt16();
                bytes = reader.ReadBytes((int)strLen);
                string rpc = Encoding.ASCII.GetString(bytes);

                rpcs[i] = audioengine.GetRPC(rpc);
            }

            strLen = reader.ReadInt16();
            bytes = reader.ReadBytes((int)strLen);
            effect = Encoding.ASCII.GetString(bytes);
        }
        //+++++++++++++++++++++++         INITIALIZE        +++++++++++++++++
        /// <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()
        {
            rnd = new Random();
            texto = "";

            currMouseState = Mouse.GetState();
            lastMouseState = Mouse.GetState();
            fondo = false;
            completoDelTo = false;
            tiempoFin = 0;
            collisionOffSet = Point.Zero;
            tiempoLluvia = 0;
            colisiond = 0;
            colisioni = 0;
            parada = 0;
            alturaTerreno = 4;
            jumpTimer = -10f;
            tiempoVelocidadSalto = 0;
            mundo1 = new Mundo(2.2f);
            currentDisparoState = DisparoState.Quieto;
            currentGravedadState = GravedadState.Aire;
            borrarBala = false;

            spriteList = new List<AutomatedSprite>();
            disparoList = new List<Disparo>();
            lluviaList = new List<Disparo>();
            mapaList = new List<Mapa>();
            terrenoList = new List<Mapa>();
            terrenoList2 = new List<Mapa>();
            terrenoListSuelo = new List<Mapa>();
            fondoList1 = new List<Mapa>();
            fondoList2 = new List<Mapa>();
            map = new List<Point>();
            jefeList = new List<Jefe>();
            vidaList = new List<Mapa>();
            vidaList2 = new List<Mapa>();
            tigres = new List<Mapa>();
            maxPosBloque = 0f;
            terrenoTiempoPasado = 0;
            terrenoDireccion = 0;
            terrenoTiempo = 100;
            arrastre = 0;

            //Variables jefe
            respawnJefeMin = 0;
            respawnJefeMax = 1;

            //Posiciones
            posicionTerrenoX = 0;
            posicionTerrenoY = 700;
            posicionFondo1 = -1000;
            posicionFondo2 = -1000;

            //Disparo
            delayDisparo = 200;
            delayDisparoCurrent = 900;
            currentParteMapa = ParteMapa.Suelo;
            numFondo1 = 0;
            numFondo2 = 0;
            numTerreno1 = 0;
            capaTerreno = 0.5f;

            //Muerte
            caido = false;
            puntosControl = new List<float>();
            puntoControl = 0;
            vidaPos = 0;
            tiempoHerido = 500f;
            tiempoMuerto = 0;
            muertoDelTo = false;

            for (int n = 0; n < 200; n++)
                map.Add(new Point(2, 0));

            complete = new Mapa(
                Game.Content.Load<Texture2D>(@"Images/LevelComplete"),
                new Vector2(120, 120),
                new Point(1140, 496),
                new Point(0, 0),
                new Point(0, 0),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f);

            vidaList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(0, 0),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
            vidaPos += 7;
            for (int i = 0; i < 28; i++)
            {
                vidaList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(1, 0),
                new Point(1, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
                vidaPos += 7;
            }
            vidaList.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(2, 0),
                new Point(2, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.89f));
            vidaPos = 0;
            vidaList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(0, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
            vidaPos += 7;
            for (int i = 0; i < 28; i++)
            {
                vidaList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(1, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
                vidaPos += 7;
            }
            vidaList2.Add(new Mapa(
                Game.Content.Load<Texture2D>(@"Images/vidaSprite"),
                new Vector2(50 + vidaPos, 30),
                new Point(10, 23),
                new Point(0, 0),
                new Point(2, 1),
                new Point(0, 0),
                new Vector2(0f, 0),
                0f,
                1000, 0.99f));
            vidaPos += 7;

            player = new UserControlledSprite(
            Game.Content.Load<Texture2D>(@"Images/pj"),
            new Vector2((1366 / 2) - 152, 164),
            new Point(194, 178),
            new Point(collisionOffSet.X, collisionOffSet.Y),
            new Point(0, 0),
            new Point(0, 0),
            new Vector2(0f, 0),
            0f,
            70, 0.80f, 30);

            pointer = new StaticSprite(
            Game.Content.Load<Texture2D>(@"Images/cursor"),
            new Vector2(0, 0),
            new Point(24, 28),
            new Point(5, 5),
            new Point(0, 0),
            new Point(0, 0),
            Vector2.Zero,
            0f,
            1000, 0.9f);

            spriteBatch = new SpriteBatch(Game.GraphicsDevice);
            audioEngine = new AudioEngine(@"Content\Sonidos\sonidos.xgs");
            waveBank = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank.xwb");
            soundBank = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank.xsb");
            waveBank2 = new WaveBank(audioEngine, @"Content\Sonidos\Wave Bank 2.xwb");
            soundBank2 = new SoundBank(audioEngine, @"Content\Sonidos\Sound Bank 2.xsb");
            musicaWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Music.xwb");
            musicaBank = new SoundBank(audioEngine, @"Content\Sonidos\Music Bank.xsb");
            ambientWave = new WaveBank(audioEngine, @"Content\Sonidos\Wave Ambient.xwb");
            ambientBank = new SoundBank(audioEngine, @"Content\Sonidos\Ambient Bank.xsb");
            musicCategory = audioEngine.GetCategory("Default");
            musicCategory.SetVolume(0);
            reproducirMusica("ingame");
            reproducirAmbiente("viento");
            trackCue = soundBank.GetCue("caido");

            Suelo(-100, posicionTerrenoY, 0, -600, terrenoList, 0.540f);
            SueloGrande(0, posicionTerrenoY, 0, 400, terrenoList, 0.530f);
            PuntoControlTigre(1366 / 2 - 15, posicionTerrenoY);
            puntosControl.Add(-(1366 / 2 - 15));
            Suelo(posicionTerrenoX, posicionTerrenoY, 860, -120, terrenoList, 0.541f);
            texto = "Posicion escaleras X" + posicionTerrenoX + "Posicion escaleras Y" + posicionTerrenoY;
            Escaleras2(posicionTerrenoX-1000, posicionTerrenoY - 200, 500, 0, 9, terrenoList2, 0.300f, true);

            Suelo(posicionTerrenoX, posicionTerrenoY+300, 4500, -120, terrenoList, 0.542f);
            PuntoControlTigre(posicionTerrenoX + 350, posicionTerrenoY - tigres[0].getFrameSize.Y + 30);
            puntosControl.Add(-posicionTerrenoX + 350);
            Suelo(posicionTerrenoX, posicionTerrenoY+300, 1000, -120, terrenoList, 0.542f);

            PuntoControlTigre(posicionTerrenoX + 350, posicionTerrenoY - tigres[0].getFrameSize.Y + 30);
            puntosControl.Add(-posicionTerrenoX + 350);
            SueloChico(posicionTerrenoX, posicionTerrenoY, 800, -50, 0, terrenoList, 0.543f);
            SueloChico(posicionTerrenoX, posicionTerrenoY, 250, -50, 4, terrenoList, 0.543f);
            SueloChico(posicionTerrenoX, posicionTerrenoY, 250, -50, 3, terrenoList, 0.543f);
            SueloChico(posicionTerrenoX, posicionTerrenoY, 250, -50, 3, terrenoList, 0.543f);
            Suelo(posicionTerrenoX + 700, posicionTerrenoY + 100, 0, 0, terrenoList, 0.543f);
            Escaleras(posicionTerrenoX +700, posicionTerrenoY + 200, 100, 50, 9, terrenoList, 0.543f, true);
            Suelo(posicionTerrenoX + 700, posicionTerrenoY + 200, 0, 0, terrenoList, 0.543f);
            SueloChico(posicionTerrenoX, posicionTerrenoY - 50, 700, 0, 6, terrenoList, 0.543f);
            Suelo(posicionTerrenoX + 200, posicionTerrenoY +50, 0, 0, terrenoList, 0.543f);
            SueloChico(posicionTerrenoX, posicionTerrenoY - 50, 700, 0, 6, terrenoList, 0.543f);
            Suelo(posicionTerrenoX + 200, posicionTerrenoY + 50, 0, 0, terrenoList, 0.543f);
            SueloChico(posicionTerrenoX, posicionTerrenoY - 50, 700, 0, 6, terrenoList, 0.543f);
            Suelo(posicionTerrenoX + 200, posicionTerrenoY + 50, 0, 0, terrenoList, 0.543f);
            Escaleras(posicionTerrenoX + 2800, posicionTerrenoY, 100, 10, 20, terrenoList, 0.543f, false);

            final = new Mapa(
            Game.Content.Load<Texture2D>(@"Images/final"),
            new Vector2(posicionTerrenoX + 200, posicionTerrenoY - 146),
            new Point(171, 156),
            new Point(0, 0),
            new Point(0, 1),
            new Point(4, 3),
            new Vector2(0f, 0),
            0f,
            200, 0.9f);
            posicionTerrenoX = 0;
            posicionTerrenoY = 0;

            Suelo(posicionTerrenoX+6500, posicionTerrenoY+300, 0, 0, terrenoList2, 0.302f);
            Escaleras(posicionTerrenoX + 3000, posicionTerrenoY + 200, 100, 30, 15, terrenoList2, 0.302f, true);
            foreach (Sprite s in terrenoList2)
            {
                s.getEscala = 0.8f;
                s.GetCollisionOffSet = new Point(60, 60);
            }

            puntuacionFuente = Game.Content.Load<SpriteFont>(@"Fuentes\fuente");

            player.setTamAura = 300;
            foreach (Sprite s in jefeList)
                s.setTamAura = 400;

            //base.Initialize();
        }