Earlz / midi-dot-net

Automatically exported from code.google.com/p/midi-dot-net
0 stars 0 forks source link

Note played twice #9

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
I've added IF statment, connected midi keyboard, run application.
Not matter if i use clock.Scheudle... to play note or use SoundPlayer with 
specific wave file added to resource notes are played twice!
I want them to be played once - only when i press note, not when note (key) is 
released.

Please help! Any advice? :)))

        public void NoteOn(NoteOnMessage msg)
        {
            if (InvokeRequired) {
                BeginInvoke(noteOnHandler, msg);
                return;
            }
            inputStatusLabel.Text = String.Format("{0}", msg.Pitch);
            String nutka = inputStatusLabel.Text;

            if(nutka == "C1")
            {
               clock.Schedule(new NoteOnOffMessage(outputDevice, Channel.Channel1, Pitch.C1, 80, clock.Time, clock, 2));

            }
            if (nutka == "B0")
            {

                clock.Schedule(new NoteOnOffMessage(outputDevice, Channel.Channel2, Pitch.B0, 80, clock.Time, clock, 2));

                //   var p1 = new System.Media.SoundPlayer(Properties.Resources.piano_d0);
                //  p1.Play();            
            }            
        }

Original issue reported on code.google.com by m.rysi...@gmail.com on 17 Jun 2015 at 6:46