Exemplo n.º 1
0
        // Form events
        private void Form1_Load(object sender, EventArgs e)
        {
            this.WaveOutDevice = new WaveOut();

            this.player1 = new Player(this.chart1, this.File1Label);
            this.player1.SetFile("c:\\Users\\Simon\\Desktop\\3 2 5.5.wav");

            this.player2 = new Player(this.chart2, this.File2Label);
            this.player2.SetFile("c:\\Users\\Simon\\Desktop\\Simon2.wav");

            this.Play(this.player1);
            this.Mute1Button.Text = "Mute";
            this.Mute2Button.Text = "Unmute";
        }
Exemplo n.º 2
0
        // Non-public methods
        private void Play(Player player, float volume = 1, int positionInMillions = 10)
        {
            player.Volume = volume;
            this.WaveOutDevice.Volume = volume;

            this.PlayWave(player, 10 * player.Million);
        }
Exemplo n.º 3
0
        private void PlayWave(Player player, long position)
        {
            player.Reader.Position = position;

            if (this.WaveOutDevice != null)
                this.WaveOutDevice.Stop();

            this.WaveOutDevice = new WaveOut();

            try
            {
                this.WaveOutDevice.Init(player.Reader);
                this.label1.Text = player.File;
                this.WaveOutDevice.Play();
            }
            catch (Exception ee)
            {
                MessageBox.Show("error " + ee.Message);
            }
        }