예제 #1
0
파일: MediaPlayer.cs 프로젝트: xiuzhifu/FNA
 public static void GetVisualizationData(VisualizationData data)
 {
     if (IsVisualizationEnabled)
     {
         data.CalculateData(Queue.ActiveSong);
     }
 }
예제 #2
0
파일: MediaPlayer.cs 프로젝트: kiates/FNA
 public static void GetVisualizationData(VisualizationData data)
 {
     FAudio.XNA_GetSongVisualizationData(
         data.freq,
         data.samp,
         VisualizationData.Size
         );
 }
예제 #3
0
 public int getAverage(Point Between, VisualizationData visData)
 {
     int average = 0;
     for (int i = Between.X; i < Between.Y; i++)
     {
         average += Convert.ToInt32(visData.Frequencies[i]);
     }
     int diff = Between.Y - Between.X + 1;
     return average / diff;
 }
예제 #4
0
 protected override void LoadContent()
 {
     this._visualizationData = new VisualizationData();
     this._referencePosition = new Vector2Int((int)this._player.Position.X - this._visualizationData.Frequencies.Count / 2, (int)this._player.Position.Z);
     MediaPlayer.Volume = 1f;
     MediaPlayer.IsVisualizationEnabled = true;
     new Thread(VisualizationReader) { IsBackground = true }.Start();
     this._song = Game.Content.Load<Song>("yael");
     MediaPlayer.Play(this._song);
 }
예제 #5
0
파일: SoundTrack.cs 프로젝트: Zikomo/Leximo
 public SoundTrack(Game game)
     : base(game)
 {
     //PlaySong(playList[0]);
     MediaPlayer.IsVisualizationEnabled = true;
     MediaPlayer.IsRepeating = false;
     MediaPlayer.ActiveSongChanged += new EventHandler(MediaPlayer_ActiveSongChanged);
     visualizationData = new VisualizationData();
     previousGamerHasControl = MediaPlayer.GameHasControl;
 }
예제 #6
0
        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            // Frame rate is 30 fps by default for Windows Phone.
            TargetElapsedTime = TimeSpan.FromTicks(333333);

            // Extend battery life under lock.
            InactiveSleepTime = TimeSpan.FromSeconds(1);

            graphics.PreferredBackBufferHeight = 300;
            graphics.PreferredBackBufferWidth = 1280;
            visualizationData = new VisualizationData();
        }
예제 #7
0
파일: Game1.cs 프로젝트: Mainmatsu/Learning
        private int xsize = 1; // множитель очков

        #endregion Fields

        #region Constructors

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);

            graphics.PreferredBackBufferWidth = 800;
            graphics.PreferredBackBufferHeight = 600;
            graphics.IsFullScreen = false;
            graphics.ApplyChanges();

            Content.RootDirectory = "Content";

            // Создаем переменные
            mediaLibrary = new MediaLibrary();
            visualizationData = new VisualizationData();

            scores = 0;
        }
예제 #8
0
 /// <summary>
 /// Initializes any necessary resources used by <c>GenMusic</c>.
 /// </summary>
 public static void Initialize()
 {
     _volume = 1f;
     _fadeTimer = new GenTimer(0f, null);
     #if WINDOWS || XBOX
     VisualData = new VisualizationData();
     VisualDataEnabled = false;
     #endif
 }
예제 #9
0
 public static void GetVisualizationData(VisualizationData data)
 {
     if (IsVisualizationEnabled)
     {
         data.CalculateData(Queue.ActiveSong);
     }
 }
예제 #10
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            graphics.PreferredBackBufferWidth = 800; //1920;
            graphics.PreferredBackBufferHeight = 600; //1080;
            graphics.ApplyChanges();

            frameCounter = 0;
            currentFrameRate = 0;
            frameTime = 0;

            InitializeEffect();
            InitializeLists();

            visualizationData = new VisualizationData();
            songs = new Song[2];

            Player1 = new PlayerInput(PlayerIndex.One);

            base.Initialize();
        }
예제 #11
0
        public BeatDetector(Game game)
            : base(game)
        {
            timeWindow = 60; //one second of history
            //timeWindow = 30; //half second of history

            spread = 1;

            sampThreshold = 0.56f;
            freqThreshold = 0.03f;

            MediaPlayer.IsVisualizationEnabled = true;
            //Debug.Assert(MediaPlayer.GameHasControl);

            numDivisions = 7;

            currFreqAvgs = new float[numDivisions];
            runningFreqAvgs = new float[numDivisions];
            currFreqVars = new float[numDivisions];
            runningFreqVars = new float[numDivisions];

            beatFreqAvailable = new bool[numDivisions];
            beatAvailable = true;

            FreqBeats = new bool[numDivisions]; //max numDivisions

            currSampAvg = 0;
            runningSampAvg = 0;

            visData = new VisualizationData();

            numSamples = 0;
            sampleIndex = 0;

            prevSampAvgs = new List<float>();
            prevSamples = new List<float>();
            currSamples = new List<float>();
            prevSDeviations = new List<float>();

            numFreqs = 0;
            freqIndex = 0;
            prevFreqs = new List<List<float>>();
            currFreqs = new List<List<float>>();
            prevFDeviations = new List<List<float>>();
            prevFreqAvgs = new List<List<float>>();

            for (int i = 0; i < numDivisions; i++)
            {
                prevFreqs.Add(new List<float>());
                currFreqs.Add(new List<float>());
                prevFreqAvgs.Add(new List<float>());
                prevFDeviations.Add(new List<float>());

                currFreqAvgs[i] = 0;
                runningFreqAvgs[i] = 0;
                currFreqVars[i] = 0;
                runningFreqVars[i] = 0;

                beatFreqAvailable[i] = true;
                FreqBeats[i] = false;
            }

            // The Beat Detector class assumes 60fps
            // Frame rate is 60 fps
            //TargetElapsedTime = TimeSpan.FromSeconds(1 / 60.0);

            //Fill prev freqs with 0's to start
            while (numFreqs < timeWindow || numSamples < timeWindow)
            {
                numFreqs++;
                numSamples++;
                for (int i = 0; i < numDivisions; i++)
                {
                    prevFreqs[i].Add(0);
                }
                prevSamples.Add(0);
            }
            ////////////////////////////

            Game.Services.AddService(typeof(IBeatDetector), this);
        }
예제 #12
0
        public override void Load()
        {
            base.Load();

            visData = new VisualizationData();
            mushroom = content.Load<Texture2D>("1upheart");
            hitmap = content.Load<Texture2D>("hitmap");
            shader = content.Load<Effect>("effects");
            music = content.Load<Song>("minibosses-supermariobros2");

            SetUpCamera(game.GraphicsDevice);

            particleSystem = new MushroomLevelParticleSystem(game);
            particleSystem.AutoInitialize(game.GraphicsDevice, content, null);
            particleSystem.Hitmap = hitmap;
            particleSystem.CustView = viewMatrix;
            particleSystem.CustProjection = projectionMatrix;
            particleSystem.CustViewport = game.GraphicsDevice.Viewport;
        }
예제 #13
0
파일: Game1.cs 프로젝트: martell/heartworks
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            player=new Player();
            plLives = new PlayerLives();
            minimap = new Sprite();
            bgTL = new Sprite();
            bgTR = new Sprite();
            bgBL = new Sprite();
            bgBR = new Sprite();
            pipeT1 = new PipeT1[5];
            pipeT2 = new PipeT2[5];
            pipeT3 = new PipeT3[5];
            pipeT4 = new PipeT4[5];
            cogs = new Cog[12];
            viz = new VisualizationData();
            MediaPlayer.IsVisualizationEnabled = true;
            MediaPlayer.IsRepeating = true;

            int i = 0;
            for (i = 0; i < pipeT1.Length; i++)
            {
                pipeT1[i] = new PipeT1();
            }
            for (i = 0; i < pipeT2.Length; i++)
            {
                pipeT2[i] = new PipeT2();
            }
            for (i = 0; i < pipeT3.Length; i++)
            {
                pipeT3[i] = new PipeT3();
            }
            for (i = 0; i < pipeT4.Length; i++)
            {
                pipeT4[i] = new PipeT4();
            }

            for (i = 0; i < cogs.Length; i++)
            {
                cogs[i] = new Cog();
            }

            base.Initialize();
        }
예제 #14
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()
        {
            this.camera = (Camera)this.Game.Services.GetService(typeof(Camera));
            this.visualData = new VisualizationData();

            this.model = this.Game.Content.Load<Model>("model/low/sphere");
            base.Initialize();
        }
예제 #15
0
        // Initializes variables for the level
        // Loads textures used in the level
        public void Initialize()
        {
            StartReset();

            // Still playing
            GameOver = false;
            MatchEnded = false;
            ReturnToMenu = false;

            // Creates the list for the player pods
            Pods = new List<Pod>();

            // Random generator
            r = new Random();

            // The game rectangle
            GameRectangle = new Rectangle(128, 72, 1024, 576);

            // Highscores
            hsc_ = HighscoreComponent.Find<IGameComponent>(Game1.Global.Components, Game1.FilterHighscore) as HighscoreComponent;
            if (hsc_ == null)
                throw new InvalidOperationException("You must have initialized the highscore component to use HighscoreScreen.");
            // hsc_.HighscoresChanged += new HighscoresChanged(Game1.hsc_HighscoresChanged);

            MusicData = new VisualizationData();
            LastMusicData = new float[256];

            // Waves
            wave = 0;
            spawningEnemies = false;

            Particles = new List<Particle>();
            ParticlePool = new Stack<Particle>();
            PulseParticles = new List<Particle>();
            TrailParticles = new List<Particle>();
            LiquidParticles = new List<Particle>();

            // Border texture
            BorderPosition = Vector2.Zero;
            BorderAlpha = 1.0f;
            BorderShowing = false;

            // Helpers
            RemoveBulletList = new List<Bullet>();
            RemoveEnemyList = new List<Enemy>();
            RemoveParticleList = new List<Particle>();

            // SpawnLiquidParticles(25);

            // The text that is onscreen
            Text = new List<ScreenText>();

            // Imprints
            Imprints = new List<Imprint>();

            // Keeps track of global time variables
            TotalSeconds = 0;
            EnemyCount = 2;

            // Random element positions
            TimePosition = new Vector2(622, 72);
            HUDPosition = Vector2.Zero;
            PodHUDPosition = new Vector2(135, 72);

            BackgroundFade = 1.0f;
        }
예제 #16
0
 public static void GetVisualizationData(VisualizationData visualizationData)
 {
     throw new NotImplementedException();
 }
예제 #17
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            visData = new VisualizationData();

            songs = new Song[5];
            songs[0] = Content.Load<Song>(@"BG");
            songs[1] = Content.Load<Song>(@"Bass");
            songs[2] = Content.Load<Song>(@"Lead");
            songs[3] = Content.Load<Song>(@"Other");
            songs[4] = Content.Load<Song>(@"Vox");
            songIndex = 0;

            tw = new StreamWriter(songs[songIndex] + ".txt");

            MediaPlayer.IsVisualizationEnabled = true;
            //MediaPlayer.Volume = 0.0f;
            MediaPlayer.Stop();

            soundData = "";
            soundBuffer = "";
            prevMin = 0;
            splitvalue = 16;
        }
예제 #18
0
 public static void GetVisualizationData(VisualizationData visualizationData)
 {
     throw new NotImplementedException();
 }
예제 #19
0
        public override void Load()
        {
            base.Load();

            visData = new VisualizationData();
            mushroom = content.Load<Texture2D>("trondaftpunk");
            hitmap = content.Load<Texture2D>("tron-hitmap");
            shader = content.Load<Effect>("tron-effects");
            music = content.Load<Song>("tron-disc wars");

            SetUpCamera(game.GraphicsDevice);

            particleSystem = new TronLevelParticleSystem(game);
            particleSystem.AutoInitialize(game.GraphicsDevice, content, null);
            particleSystem.Hitmap = hitmap;
            particleSystem.CustView = viewMatrix;
            particleSystem.CustProjection = projectionMatrix;
            particleSystem.CustViewport = game.GraphicsDevice.Viewport;
        }