Esempio n. 1
0
        public GamePlayer(InputDevice input, MidiFile midifile, MidiOptions midiOption)
        {
            inputDevice = input;
            processer = new MidiProcesser(midifile, midiOption);

            inputDevice.NoteOn += delegate(NoteOnMessage msg)
            {
                ComputeScore(msg.Pitch, processer.Position);
            };

            inputDevice.NoteOff += delegate(NoteOffMessage msg)
            {

            };

            inputDevice.ProgramChange += delegate(ProgramChangeMessage msg)
            {

            };

            inputDevice.PitchBend += delegate(PitchBendMessage msg)
            {

            };
        }
Esempio n. 2
0
        public LearningPlayer(InputDevice input, MidiFile midifile, MidiOptions midiOption)
        {
            processer = new MidiProcesser(midifile, midiOption);
            inputDevice = input;
            inputDevice.NoteOn += delegate(NoteOnMessage msg)
            {
                ProcessPitch(msg.Pitch);
            };

            processer.NoteOn += delegate(Channel channel, Pitch pitch, int velocity)
            {
                waitPitch = pitch;
                processer.Stop();
            };
        }
Esempio n. 3
0
        public MidiPlayer(MidiFile midiFile, MidiOptions midiOptions)
        {
            processer = new MidiProcesser(midiFile, midiOptions);

            processer.NoteOn += delegate(Channel channel, Pitch pitch, int velocity)
            {
                if (outDevice != null)
                {
                    outDevice.SendNoteOn(channel,pitch,velocity);
                }
            };

            processer.NoteOff += delegate(Channel channel, Pitch pitch, int velocity)
            {
                if (outDevice != null)
                {
                    outDevice.SendNoteOff(channel, pitch, velocity);
                }
            };

            processer.ProgramChange += delegate(Channel channel, Instrument instrument)
            {
                if (outDevice != null)
                {
                    outDevice.SendProgramChange(channel, instrument);
                }
            };

            processer.ControlChange += delegate(Channel channel, MidiControl control, int value)
            {
                if (outDevice != null)
                {
                    outDevice.SendControlChange(channel, control,value);
                }
            };
        }