Ejemplo n.º 1
0
        /// <summary>
        /// Function to connect with a LaunchpadDevice
        /// </summary>
        /// <param name="device">The Launchpad to connect to.</param>
        /// <returns>Returns bool if connection was successful.</returns>
        public bool connect(LaunchpadDevice device)
        {
            foreach (InputDevice id in Midi.InputDevice.InstalledDevices)
            {
                if (id.Name.ToLower() == device._midiName.ToLower())
                {
                    targetInput = id;
                    Console.WriteLine($"Connecting to : {id.Name}");
                    targetInput.Open();
                    if (id.Name == "Launchpad MK2")
                    {
                        Console.WriteLine($"Detected as MK2, using updated button positions");
                        rowBasePitch  = rowBasePitch_launchpadmk2;
                        ccBaseControl = ccBaseControl_launchpadmk2;
                        launchpadType = LaunchpadType.MK2;
                    }
                    else
                    {
                        rowBasePitch  = rowBasePitch_launchpadMini; // works-ish with a lot of them
                        ccBaseControl = ccBaseControl_launchpadMini;
                        launchpadType = LaunchpadType.Mini;
                    }
                    Console.WriteLine($"isReceiving: {targetInput.IsReceiving}, open: {targetInput.IsOpen}");
                    targetInput.NoteOn        += new InputDevice.NoteOnHandler(midiPress);
                    targetInput.ControlChange += new InputDevice.ControlChangeHandler(midiCC);
                    targetInput.StartReceiving(null);
                }
            }
            foreach (OutputDevice od in Midi.OutputDevice.InstalledDevices)
            {
                if (od.Name.ToLower() == device._midiName.ToLower())
                {
                    targetOutput = od;
                    od.Open();
                }
            }

            return(true); // targetInput.IsOpen && targetOutput.IsOpen;
        }
Ejemplo n.º 2
0
 public static bool HasProgrammerFwHack(this LaunchpadType type)
 => LaunchpadType.X <= type && type <= LaunchpadType.MiniMK3;
Ejemplo n.º 3
0
 public static bool IsPro(this LaunchpadType type)
 => LaunchpadType.Pro <= type && type <= LaunchpadType.CFW;
Ejemplo n.º 4
0
 public static bool IsGenerationX(this LaunchpadType type)
 => LaunchpadType.X <= type && type <= LaunchpadType.ProMK3;
Ejemplo n.º 5
0
 public static bool HasModeLight(this LaunchpadType type)
 => LaunchpadType.Pro <= type && type <= LaunchpadType.CFW;