Beispiel #1
0
        private void PlayFromInput(NoteEvent noteEvent)
        {
            if (noteEvent.Velocity > 0)
            {
                SetInputKey(noteEvent);
            }

            if (!ChordMode)
            {
                S1Value = noteEvent.NoteNumber;
                MidiLogic.PlayNote(_mOut, SelectedChannel, noteEvent.NoteNumber, noteEvent.Velocity);
            }
            else
            {
                var chord = Triad.InputChordGen(noteEvent.NoteNumber, TriadShapeEnum.Major);
                if (noteEvent.Velocity > 0)
                {
                    SetNotes(chord.Notes);
                }

                MidiLogic.PlayChord(_mOut, SelectedChannel, noteEvent.Velocity, chord.Notes.ToArray());
            }
        }
Beispiel #2
0
 private void Strum4B()
 {
     MidiLogic.PlayNote(_mOut, SelectedChannel, S4Value);
 }
Beispiel #3
0
        private void StartMelody(int line)
        {
            var scale   = ChosenScale;
            int counter = 0;

            ThreadPool.QueueUserWorkItem(
                o =>
            {
                if (ProgressionPattern != null && ProgressionPattern.Count > 0)
                {
                    foreach (var root in ProgressionPattern)
                    {
                        var adjustedNote = NoteLogic.OctaveC[OctavePattern[counter % OctavePattern.Count] + 4] + scale.Steps[root % scale.Steps.Count] + ChosenKey.Offset;

                        switch (line)
                        {
                        case 1:
                            S1Value = adjustedNote;
                            break;

                        case 2:
                            S2Value = adjustedNote;
                            break;

                        case 3:
                            S3Value = adjustedNote;
                            break;

                        case 4:
                            S4Value = adjustedNote;
                            break;
                        }

                        MidiLogic.PlayNote(_mOut, SelectedChannel, adjustedNote);
                        Thread.Sleep(LengthPattern[counter % LengthPattern.Count]);
                        MidiLogic.StopNote(_mOut, SelectedChannel, adjustedNote);
                        counter++;
                    }
                }
                else
                {
                    for (int i = 0; i < scale.Steps.Count; i++)
                    {
                        var adjustedNote = NoteLogic.OctaveC[OctavePattern[counter % OctavePattern.Count] + 4] + scale.Steps[i % scale.Steps.Count] + ChosenKey.Offset;

                        switch (line)
                        {
                        case 1:
                            S1Value = adjustedNote;
                            break;

                        case 2:
                            S2Value = adjustedNote;
                            break;

                        case 3:
                            S3Value = adjustedNote;
                            break;

                        case 4:
                            S4Value = adjustedNote;
                            break;
                        }

                        MidiLogic.PlayNote(_mOut, SelectedChannel, adjustedNote);
                        Thread.Sleep(LengthPattern[counter % LengthPattern.Count]);
                        MidiLogic.StopNote(_mOut, SelectedChannel, adjustedNote);
                        counter++;
                    }
                }
            });
        }