Ejemplo n.º 1
0
 private void UpdatePerformance()
 {
     if (Conductor.IsConducting)
     {
         // Someone is controlling you, disable stuff
         Playlist.Visible  = false;
         Conductor.Visible = true;
     }
     else
     {
         Playlist.Visible  = true;
         Conductor.Visible = false;
     }
     if (Player.Status == PlayerStatus.Conducting)
     {
         Player.Interactable          = true;
         Player.Keyboard.OverrideText = "Conducting in progress.";
         Player.Keyboard.Enabled      = false;
     }
     else if (!Program.programOptions.DisableMemory)
     {
         Player.Interactable          = FFXIV.IsPerformanceReady();
         Player.Keyboard.OverrideText = FFXIV.IsPerformanceReady() ? string.Empty : "Open Bard Performance mode to play.";
         Player.Keyboard.Enabled      = true;
     }
 }
Ejemplo n.º 2
0
        public void FindProcess()
        {
            processSelector.ShowDialog(this);
            if (processSelector.DialogResult == DialogResult.Yes)
            {
                Process proc = processSelector.selectedProcess;
                if (proc != null)
                {
                    FFXIV.SetProcess(proc);

                    if (processSelector.useLocalOrchestra)
                    {
                        InfoTabs.TabPages.Remove(localOrchestraTab);
                        InfoTabs.TabPages.Insert(2, localOrchestraTab);
                        Player.Status = PlayerStatus.Conducting;
                    }
                    else
                    {
                        Player.Status = PlayerStatus.Performing;
                        InfoTabs.TabPages.Remove(localOrchestraTab);
                    }
                    LocalOrchestra.OrchestraEnabled = processSelector.useLocalOrchestra;
                    if (LocalOrchestra.OrchestraEnabled)
                    {
                        LocalOrchestra.PopulateLocalProcesses(processSelector.multiboxProcesses);
                        LocalOrchestra.Sequencer = Player.Player;
                        InfoTabs.SelectTab(2);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private bool ChatCommandOpen(BmpChatListener.Command cmd)
        {
            if (IsCommandPermitted(cmd))
            {
                Performance.Instrument instrument = Player.PreferredInstrument;

                if (!string.IsNullOrEmpty(cmd.param))
                {
                    if (!FFXIV.GetPerformanceInstrument(cmd.param, out instrument))
                    {
                        Log(string.Format("Cannot open [\"{0}\"] - that isn't an instrument.", cmd.param));
                        return(false);
                    }
                }

                if (!FFXIV.GetHotkeyForInstrument(instrument, out FFXIVKeybindDat.Keybind keybind))
                {
                    Log(string.Format("Cannot open [{0}] - that performance action isn't placed on your hotbar.", instrument.ToString()));
                    return(false);
                }
                if (keybind is FFXIVKeybindDat.Keybind && keybind.GetKey() != Keys.None)
                {
                    if (FFXIV.IsPlayerJobReady())
                    {
                        FFXIV.hook.SendSyncKeybind(keybind);
                    }
                }
                else
                {
                    Log(string.Format("Cannot open [{0}] - no keybind is assigned to that hotbar slot.", instrument.ToString()));
                }
            }
            return(true);
        }
Ejemplo n.º 4
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.º 5
0
 private bool ChatCommandNote(BmpChatListener.Command cmd)
 {
     if (IsCommandPermitted(cmd))
     {
         FFXIV.PlayPerformanceNote(cmd.param);
     }
     return(true);
 }
Ejemplo n.º 6
0
 private bool ChatCommandClose(BmpChatListener.Command cmd)
 {
     if (IsCommandPermitted(cmd))
     {
         FFXIV.UnequipPerformance();
     }
     return(true);
 }
Ejemplo n.º 7
0
 private void Hook_OnKeyPressed(Object o, Keys key)
 {
     if (Properties.Settings.Default.ForcedOpen)
     {
         return;
     }
     if (FFXIV.IsPerformanceReady() && !FFXIV.memory.ChatInputOpen)
     {
         if (key == Keys.F10)
         {
             foreach (FFXIVKeybindDat.Keybind keybind in FFXIV.hotkeys.GetPerformanceKeybinds())
             {
                 FFXIV.hook.SendAsyncKey(keybind.GetKey());
                 System.Threading.Thread.Sleep(100);
             }
         }
         if (key == Keys.Space)
         {
             if (Player.Player.IsPlaying)
             {
                 Player.Player.Pause();
             }
             else
             {
                 Player.Player.Play();
             }
         }
         if (key == Keys.Right)
         {
             if (Player.Player.IsPlaying)
             {
                 Player.Player.Seek(1000);
             }
         }
         if (key == Keys.Left)
         {
             if (Player.Player.IsPlaying)
             {
                 Player.Player.Seek(-1000);
             }
         }
         if (key == Keys.Up)
         {
             if (Player.Player.IsPlaying)
             {
                 Player.Player.Seek(10000);
             }
         }
         if (key == Keys.Down)
         {
             if (Player.Player.IsPlaying)
             {
                 Player.Player.Seek(-10000);
             }
         }
     }
 }
Ejemplo n.º 8
0
        protected override void OnClosing(CancelEventArgs e)
        {
            FFXIV.ShutdownMemory();

            Player.Player.CloseInputDevice();
            Player.Player.Pause();

            FFXIV.hook.ClearLastPerformanceKeybinds();

            base.OnClosing(e);
        }
Ejemplo n.º 9
0
 private bool ChatCommandCommand(BmpChatListener.Command cmd)
 {
     if (IsCommandPermitted(cmd))
     {
         if (!string.IsNullOrEmpty(cmd.param))
         {
             if (Properties.Settings.Default.PlayLyrics)
             {
                 FFXIV.SendChatString(cmd.param);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 10
0
 private void UpdatePerformance()
 {
     if (Player.Status == PlayerStatus.Conducting)
     {
         Player.Interactable          = true;
         Player.Keyboard.OverrideText = "Conducting in progress.";
         Player.Keyboard.Enabled      = false;
     }
     else if (!Program.programOptions.DisableMemory)
     {
         Player.Interactable          = FFXIV.IsPerformanceReady();
         Player.Keyboard.OverrideText = FFXIV.IsPerformanceReady() ? string.Empty : "Open Bard Performance mode to play.";
         Player.Keyboard.Enabled      = true;
     }
 }
Ejemplo n.º 11
0
        protected override void OnClosing(CancelEventArgs e)
        {
            Properties.Settings.Default.Location = this.Location;
            Properties.Settings.Default.Size     = this.Size;
            Properties.Settings.Default.Save();

            base.OnClosing(e);

            FFXIV.ShutdownMemory();

            Player.Player.CloseInputDevice();
            Player.Player.Pause();

            FFXIV.hook.ClearLastPerformanceKeybinds();
        }
Ejemplo n.º 12
0
        private bool ChatCommandSeek(BmpChatListener.Command cmd)
        {
            if (IsCommandPermitted(cmd))
            {
                if (int.TryParse(cmd.param, out int delay))
                {
                    delay = delay.Clamp(-500, 500);

                    if (FFXIV.IsPerformanceReady() && Player.Player.IsPlaying)
                    {
                        Player.Player.Seek(delay);
                    }
                }
            }
            return(true);
        }
Ejemplo n.º 13
0
 private bool LyricCommandHotbar(BmpChatListener.Command cmd)
 {
     if (!string.IsNullOrEmpty(cmd.param))
     {
         if (int.TryParse(cmd.param, out int hotbarNum))
         {
             int hotbar = (int)Math.Floor(hotbarNum / 12.0);
             int slot   = hotbarNum % 12 - 1;
             int job    = FFXIV.memory.currentPlayer.CurrentPlayer.JobID;
             if (FFXIV.GetHotkeyForHotbarSlot(hotbar, slot, job, out FFXIVKeybindDat.Keybind keybind))
             {
                 FFXIV.hook.SendSyncKeybind(keybind);
             }
         }
     }
     return(true);
 }
Ejemplo n.º 14
0
        private void OffMidiVoice(Object o, NoteEvent offNote)
        {
            if (LocalOrchestra.OrchestraEnabled)
            {
                LocalOrchestra.ProcessOffNote(offNote);
                return;
            }

            if (Player.Status == PlayerStatus.Conducting)
            {
                return;
            }

            if (!FFXIV.IsPerformanceReady())
            {
                return;
            }

            if (offNote.track != null)
            {
                if (offNote.track != Player.Player.LoadedTrack)
                {
                    return;
                }
            }

            if (WantsSlow)
            {
                return;
            }

            if (!FFXIV.memory.ChatInputOpen)
            {
                if (WantsHold)
                {
                    if (FFXIV.hotkeys.GetKeybindFromNoteByte(offNote.note) is FFXIVKeybindDat.Keybind keybind)
                    {
                        FFXIV.hook.SendKeybindUp(keybind);
                    }
                    chordNotes.OffKey(offNote);
                }
            }
        }
Ejemplo n.º 15
0
        private void OnMidiLyric(Object o, string lyric)
        {
            string chan = Properties.Settings.Default.ListenChannel;

            if (chatListener.GetChatCommand(lyric, chan) is Func <bool> cmdChatFunc)
            {
                if (cmdChatFunc())
                {
                    return;
                }
            }
            if (lyricListener.GetChatCommand(lyric, chan) is Func <bool> cmdLyricFunc)
            {
                if (cmdLyricFunc())
                {
                    return;
                }
            }
            if (Properties.Settings.Default.PlayLyrics)
            {
                FFXIV.SendChatString(lyric);
            }
        }
Ejemplo n.º 16
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);
                        }
                    }
                }
            }
        }
Ejemplo n.º 17
0
 public void WarningLog(string format)
 {
     FFXIV.SetErrorStatus("Warning: " + format);
 }
Ejemplo n.º 18
0
 public void ErrorLog(string format)
 {
     FFXIV.SetErrorStatus("[ERROR] " + format);
 }