Beispiel #1
0
    public void pianoKeyDown(PianoKeyEventArgs k)
    {
        if (PianoKeyDown == null) return;
        PianoKeyDown(this, k);

        if (lastKey != null)
            intervalPlayed(new IntervalEventArgs(lastKey, k.key));
        lastKey = k.key;
    }
Beispiel #2
0
        private void pianoControl1_PianoKeyDown(object sender, PianoKeyEventArgs e)
        {
            #region Guard

            if (playing)
            {
                return;
            }

            #endregion

            outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, e.NoteID, 127));
        }
Beispiel #3
0
        private void pianoControl1_PianoKeyUp(object sender, PianoKeyEventArgs e)
        {
            #region Guard

            if (model.playing)
            {
                return;
            }

            #endregion

            model.outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, e.NoteID, 0));
        }
Beispiel #4
0
        private void pianoKeyboard_PianoKeyDown(object sender, PianoKeyEventArgs e)
        {
            Note note = new Note(e.NoteID);

            // Insert a note to current position
            noteList.Add(note);
            listViewNotes.SelectedIndex = listViewNotes.Items.Count - 1;

            listViewNotes.UpdateLayout();
            listViewNotes.ScrollIntoView(listViewNotes.SelectedItem);

            CommandManager.InvalidateRequerySuggested();
            outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, e.NoteID, 127));
        }
Beispiel #5
0
        private void pianoControl1_PianoKeyDown(object sender, PianoKeyEventArgs e)
        {
            #region Guard

            if (playing)
            {
                return;
            }

            #endregion
            var ni = TinyAdiago.note.get(e.NoteID);
            debug("piano key: " + e.NoteID + " note: " + ni);
            outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, e.NoteID, 127));
        }
Beispiel #6
0
        // For when the Keyboard Note or Mouse Note is released
        private void PianoControl_PianoKeyUp(object sender, PianoKeyEventArgs e)
        {
            oldTimers[e.NoteID].Stop();
            outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, e.NoteID, 0));
            currentTimers[e.NoteID] = oldTimers[e.NoteID];
            long duration = currentTimers[e.NoteID].ElapsedMilliseconds.Round(100);

            // Checking for Thirds
            Timing symbols = noteEstimator.GetNoteFromDuration(duration);

            if (symbols == Timing.ThirdHalf || symbols == Timing.ThirdQuart ||
                symbols == Timing.ThirdEigth || symbols == Timing.ThirdWhole || symbols == Timing.ThirdSixteen)
            {
                thirds = true;
            }
            else
            {
                thirds = false;
            }

            System.Diagnostics.Debug.WriteLine($"{symbols } timing");

            // System.Diagnostics.Debug.WriteLine($"{whitePressed } white note");
            // System.Diagnostics.Debug.WriteLine($"{blackPressed } black note");

            whitePressed = keys.WhiteKeyPress(e.NoteID, out chrom);
            blackPressed = keys.BlackKeyPress(e.NoteID, out chrom);

            // Setting the Positions
            keys.SetPositions(blackPressed, whitePressed, chromatic, chrom);


            sheetForm.SetChromatic(chrom, chromatic);

            // Globally shared variables
            Global.Symbol    = note.GetNoteSymbol(symbols);
            Global.Chromatic = note.GetChromaticSymbol(chromatic);
            Timing time;

            Global.Image = note.GetImage(symbols, out time);
            Global.Time  = time;

            sheetForm.UpdatePaint(offset, shiftX, thirds, keys.GetPosition(e.NoteID));

            oldTimers[e.NoteID].Reset();
        }
Beispiel #7
0
        // For when the Keyboard Note or Mouse  Note is pressed
        private void PianoControl_PianoKeyDown(object sender, PianoKeyEventArgs e)
        {
            oldTimers[e.NoteID].Start();
            oldNote = e.NoteID - 21;


            System.Diagnostics.Debug.WriteLine($"{e.NoteID} noteID");
            System.Diagnostics.Debug.WriteLine($"{oldNote} oldNote");
            System.Diagnostics.Debug.WriteLine($"{newNote} newNote");

            outDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, e.NoteID, 127));
            offset += 45;

            System.Diagnostics.Debug.WriteLine($"{chromatic } when pressed");
            if (number > 0)
            {
                //chromatic = keys.ChangePosition(oldNote, newNote, blackPressed, shiftX, chromatic);
            }

            newNote = oldNote;
        }
Beispiel #8
0
 private void PianoControl_PianoKeyUp(object sender, PianoKeyEventArgs e)
 {
     MidiManager.Playback(false, e.NoteID);
 }
 private void PianoControl1_PianoKeyUp(object sender, PianoKeyEventArgs e)
 {
     player.PianoControl1_PianoKeyUp(sender, e);
 }
Beispiel #10
0
 public void PianoControl1_PianoKeyDown(object sender, PianoKeyEventArgs e)
 {
     OutDevice.Send(new ChannelMessage(ChannelCommand.NoteOn, 0, e.NoteID, 127));
 }
Beispiel #11
0
 public void keyDownEffect(PianoKeyEventArgs k)
 {
     meshMake(k.key);
 }
 public void keyDownEffect(PianoKeyEventArgs ka)
 {
     randomSpawnParticle(bangSpawn, ka.key.pitch);
 }
Beispiel #13
0
        // For when the Keyboard Note or Mouse Note is released
        private void PianoControl_PianoKeyUp(object sender, PianoKeyEventArgs e)
        {
            if (Global.Handy == Hand.Left)
            {
                leftHand--;
            }
            else if (Global.Handy == Hand.Right)
            {
                rightHand--;
            }

            if (leftHand < 0)
            {
                leftHand = 0;
            }
            if (rightHand < 0)
            {
                rightHand = 0;
            }

            // Setting the Positions
            blackPressed = keys.BlackKeyPress(e.NoteID, out chrom);
            whitePressed = keys.WhiteKeyPress(e.NoteID, out chrom);

            Chromatic oldValue = chromatic;
            int       shiftX   = keys.ChangePosition(oldY, newY, numberPlayed, chrom, oldValue, out chromatic);

            keys.SetPositions(blackPressed, whitePressed, chromatic, chrom);

            sheetForm.SetChromatic(chrom, chromatic);
            oldY = keys.GetPosition(e.NoteID);

            oldTimers[e.NoteID].Stop();
            outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, e.NoteID, 0));

            currentTimers[e.NoteID] = oldTimers[e.NoteID];
            long duration = currentTimers[e.NoteID].ElapsedMilliseconds.Round(100);

            // Checking for Thirds
            Timing symbols = noteEstimator.GetNoteFromDuration(duration);

            if (symbols == Timing.ThirdHalf || symbols == Timing.ThirdQuart ||
                symbols == Timing.ThirdEigth || symbols == Timing.ThirdSixteen)
            {
                thirds = true;
            }
            else
            {
                thirds = false;
            }

            System.Diagnostics.Debug.WriteLine($"{symbols } timing");
            System.Diagnostics.Debug.WriteLine($"{oldY } old Y Position");
            System.Diagnostics.Debug.WriteLine($"{newY } new Y Position");

            newY = oldY;

            // Globally shared variables
            Global.Symbol    = drawn.GetNoteSymbol(symbols);
            Global.Chromatic = drawn.GetChromaticSymbol(chromatic);
            Timing time;

            Global.Image = drawn.GetImage(symbols, out time);
            Global.Time  = time;

            sheetForm.UpdatePaint(offset + shiftX, thirds, oldY);

            oldTimers[e.NoteID].Reset();
        }
Beispiel #14
0
 // Call the handling methods here. Effector generalizes from input -> output.
 public void pianoKeyDown(object source, PianoKeyEventArgs k)
 {
     keyEffector.keyDownEffect(k);
 }
Beispiel #15
0
 private void pianoKeyboard_PianoKeyUp(object sender, PianoKeyEventArgs e)
 {
     outDevice.Send(new ChannelMessage(ChannelCommand.NoteOff, 0, e.NoteID, 0));
 }