Ejemplo n.º 1
0
        // OnMidiVoice + OffMidiVoice is called with correct octave shift
        private void OnMidiVoice(Object o, NoteEvent onNote)
        {
            Statistics.AddNoteCount();

            if (Properties.Settings.Default.Verbose)
            {
                FFXIVKeybindDat.Keybind thiskeybind = FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note);
                if (thiskeybind == null)
                {
                    string ns = FFXIVKeybindDat.RawNoteByteToPianoKey(onNote.note);
                    if (!string.IsNullOrEmpty(ns))
                    {
                        string str = string.Format("Note {0} is out of range, it will not be played.", ns);
                        this.LogMidi(str);
                    }
                }
            }

            if (LocalOrchestra.OrchestraEnabled)
            {
                return;
            }

            if (Player.Status == PlayerStatus.Conducting)
            {
                return;
            }
            if (!FFXIV.IsPerformanceReady())
            {
                return;
            }
            if (onNote.track != null)
            {
                // If from midi file
                if (onNote.track != Player.Player.LoadedTrack)
                {
                    return;
                }
            }
            if (Sharlayan.Reader.CanGetChatInput())
            {
                if (FFXIV.memory.ChatInputOpen)
                {
                    return;
                }
            }

            if (FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note) is FFXIVKeybindDat.Keybind keybind)
            {
                if (WantsHold)
                {
                    FFXIV.hook.SendKeybindDown(keybind);
                }
                else
                {
                    FFXIV.hook.SendAsyncKeybind(keybind);
                }
            }
        }
Ejemplo n.º 2
0
        private void Hotkeys_OnFileLoad(FFXIVKeybindDat hotkeys)
        {
            Player.Keyboard.UpdateNoteKeys(hotkeys);

            if (!hotkeys.ExtendedKeyboardBound && !keyboardWarning)
            {
                keyboardWarning = true;

                BmpKeybindWarning keybindWarning = new BmpKeybindWarning();
                keybindWarning.ShowDialog(this);

                //Log(string.Format("Your performance keybinds aren't set up correctly, songs will be played incomplete."));
            }
        }
Ejemplo n.º 3
0
        public void UpdateFrequency(List <int> notes)
        {
            KeyboardLetterList list = keyboardData.letterList;
            int notesAvailable      = 0;
            int notesInRange        = 0;

            lowFreq  = 0;
            highFreq = 0;

            foreach (string key in list.Keys)
            {
                list[key].frequency = 0;
            }

            foreach (int note in notes)
            {
                notesAvailable++;
                string perfKey = FFXIVKeybindDat.NoteByteToPerformanceKey((byte)note);
                if (list.ContainsKey(perfKey))
                {
                    notesInRange++;
                    list[perfKey].frequency++;
                }
                else
                {
                    if (note <= 0)
                    {
                        lowFreq++;
                    }
                    if (note >= 38)
                    {
                        highFreq++;
                    }
                }
            }

            this.Text = string.Empty;
            if (notesAvailable == 0)
            {
                this.Text = "No notes playing on this track.";
            }
            else if (notesInRange == 0)
            {
                this.Text = "All notes out of range.";
            }

            this.Refresh();
        }
Ejemplo n.º 4
0
        public void UpdateNoteKeys(FFXIVKeybindDat hotkeys)
        {
            KeyboardLetterList list = keyboardData.letterList;

            foreach (string key in list.Keys)
            {
                list[key].key = string.Empty;

                string pk = FFXIVKeybindDat.NoteKeyToPerformanceKey(key);
                if (!string.IsNullOrEmpty(pk))
                {
                    list[key].key = hotkeys[pk].ToString();
                }
            }
            this.Refresh();
        }
Ejemplo n.º 5
0
        // OnMidiVoice + OffMidiVoice is called with correct octave shift
        private void OnMidiVoice(Object o, NoteEvent onNote)
        {
            Statistics.AddNoteCount();

            if (Properties.Settings.Default.Verbose)
            {
                FFXIVKeybindDat.Keybind keybind = FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note);
                if (keybind == null)
                {
                    string ns = FFXIVKeybindDat.RawNoteByteToPianoKey(onNote.note);
                    if (!string.IsNullOrEmpty(ns))
                    {
                        string str = string.Format("Note {0} is out of range, it will not be played.", ns);
                        ChatLogAll.AppendRtf(BmpChatParser.FormatRtf(str, "\\red255\\green200\\blue200"));
                    }
                }
            }

            if (LocalOrchestra.OrchestraEnabled)
            {
                LocalOrchestra.ProcessOnNote(onNote);
                return;
            }

            if (Player.Status == PlayerStatus.Conducting)
            {
                return;
            }
            if (!Player.Player.IsPlaying)
            {
                return;
            }
            if (!FFXIV.IsPerformanceReady())
            {
                return;
            }
            if (onNote.track != null)
            {
                // If from midi file
                if (onNote.track != Player.Player.LoadedTrack)
                {
                    return;
                }
            }
            if (!FFXIV.memory.ChatInputOpen)
            {
                if (WantsSlow)
                {
                    if (FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note) is FFXIVKeybindDat.Keybind keybind)
                    {
                        int delay = Decimal.ToInt32(Properties.Settings.Default.PlayHold);
                        // Slow play

                        Player.Player.InternalClock.Stop();
                        FFXIV.hook.SendSyncKey(keybind.GetKey(), true, true, false);

                        //Bmp.Player.InternalClock.Sleep(delay);
                        Thread.Sleep(delay);

                        FFXIV.hook.SendSyncKey(keybind.GetKey(), true, false, true);
                        Player.Player.InternalClock.Continue();

                        return;
                    }
                }
                if (Properties.Settings.Default.AutoArpeggiate)
                {
                    if (chordNotes.OnKey(onNote))
                    {
                        // Chord detected and queued
                        Console.WriteLine("Delay " + onNote + " by 100ms");
                    }
                }
                if (!chordNotes.HasTimer(onNote))
                {
                    if (FFXIV.hotkeys.GetKeybindFromNoteByte(onNote.note) is FFXIVKeybindDat.Keybind keybind)
                    {
                        if (WantsHold)
                        {
                            FFXIV.hook.SendKeybindDown(keybind);
                        }
                        else
                        {
                            FFXIV.hook.SendAsyncKeybind(keybind);
                        }
                    }
                }
            }
        }