Example #1
0
        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Debug.Initialize(spriteBatch, Content);

            KeyboardManager.OnKeyPressed += OnKeyPressed;

            System.Windows.Forms.OpenFileDialog openFileDialog = new System.Windows.Forms.OpenFileDialog();
            openFileDialog.Filter = "WAV Files|*.wav|MP3 Files|*.mp3";
            var r = openFileDialog.ShowDialog();

            if (r == System.Windows.Forms.DialogResult.OK)
            {
                currentFile = openFileDialog.FileName;
                spectrum    = new DrawableSpectrum(openFileDialog.FileName);
                spectrum.Start();
            }
            else
            {
                Environment.Exit(0);
            }
        }
Example #2
0
        private void OnKeyPressed(Keys obj)
        {
            if (obj == Keys.Space)
            {
                if (!m_paused)
                {
                    spectrum.Pause();
                    m_paused = true;
                }
                else
                {
                    spectrum.Start();
                    m_paused = false;
                }
            }
            if (obj == Keys.Back)
            {
                spectrum.Dispose();

                spectrum = new DrawableSpectrum(currentFile);
                spectrum.Start();
            }
        }