Esempio n. 1
0
 public static int GridSize(this LaunchpadModels model)
 => (model == LaunchpadModels.Pro || model == LaunchpadModels.ProMK3 || model == LaunchpadModels.All)
         ? 10
         : 9;
Esempio n. 2
0
 public static bool HasModeLight(this LaunchpadModels model)
 => model == LaunchpadModels.Pro || model == LaunchpadModels.All;
Esempio n. 3
0
 public static bool HasNovationLED(this LaunchpadModels model)
 => model == LaunchpadModels.X || model == LaunchpadModels.ProMK3;
Esempio n. 4
0
        public static void DecodeConfig(Stream input) => Decode(input, (reader, version) => {
            Preferences.AlwaysOnTop         = reader.ReadBoolean();
            Preferences.CenterTrackContents = reader.ReadBoolean();

            if (version >= 24)
            {
                Preferences.ChainSignalIndicators  = reader.ReadBoolean();
                Preferences.DeviceSignalIndicators = reader.ReadBoolean();
            }
            else if (version >= 23)
            {
                Preferences.ChainSignalIndicators = Preferences.DeviceSignalIndicators = reader.ReadBoolean();
            }

            if (version >= 28)
            {
                Preferences.ColorDisplayFormat = (ColorDisplayType)reader.ReadInt32();
            }

            if (version >= 9)
            {
                Preferences.LaunchpadStyle = (LaunchpadStyles)reader.ReadInt32();
            }

            if (version >= 14)
            {
                Preferences.LaunchpadGridRotation = reader.ReadInt32() > 0;
            }

            if (version >= 24)
            {
                LaunchpadModels model = (LaunchpadModels)reader.ReadInt32();

                if (version <= 28 && model >= LaunchpadModels.ProMK3)
                {
                    model++;
                }

                Preferences.LaunchpadModel = model;
            }

            Preferences.AutoCreateKeyFilter   = reader.ReadBoolean();
            Preferences.AutoCreateMacroFilter = reader.ReadBoolean();

            if (version >= 11)
            {
                Preferences.AutoCreatePattern = reader.ReadBoolean();
            }

            if (version >= 31)
            {
                Preferences.FPSLimit = reader.ReadInt32();
            }
            else
            {
                Preferences.FPSLimit = Math.Max(180, (int)(1081.45 * Math.Pow(Math.Log(1 - reader.ReadDouble()), 2) + 2));
            }

            Preferences.CopyPreviousFrame = reader.ReadBoolean();

            if (version >= 7)
            {
                Preferences.CaptureLaunchpad = reader.ReadBoolean();
            }

            Preferences.EnableGestures = reader.ReadBoolean();

            if (version >= 32)
            {
                Preferences.RememberPatternPosition = reader.ReadBoolean();
            }

            if (version >= 7)
            {
                Preferences.PaletteName   = reader.ReadString();
                Preferences.CustomPalette = new Palette(Enumerable.Range(0, 128).Select(i => Decode <Color>(reader, version)).ToArray());
                Preferences.ImportPalette = (Palettes)reader.ReadInt32();

                Preferences.Theme = (ThemeType)reader.ReadInt32();
            }

            if (version >= 10)
            {
                Preferences.Backup   = reader.ReadBoolean();
                Preferences.Autosave = reader.ReadBoolean();
            }

            if (version >= 12)
            {
                Preferences.UndoLimit = reader.ReadBoolean();
            }

            if (version <= 0)
            {
                Preferences.DiscordPresence = true;
                reader.ReadBoolean();
            }
            else
            {
                Preferences.DiscordPresence = reader.ReadBoolean();
            }

            Preferences.DiscordFilename = reader.ReadBoolean();

            ColorHistory.Set(
                Enumerable.Range(0, reader.ReadInt32()).Select(i => Decode <Color>(reader, version)).ToList()
                );

            if (version >= 2)
            {
                MIDI.Devices = Enumerable.Range(0, reader.ReadInt32()).Select(i => Decode <Launchpad>(reader, version)).ToList();
            }

            if (version >= 15)
            {
                Preferences.Recents = Enumerable.Range(0, reader.ReadInt32()).Select(i => reader.ReadString()).ToList();
            }

            if (version >= 25)
            {
                Preferences.VirtualLaunchpads = Enumerable.Range(0, reader.ReadInt32()).Select(i => reader.ReadInt32()).ToList();
            }

            if (15 <= version && version <= 22)
            {
                reader.ReadString();
                reader.ReadString();
            }

            if (version >= 23)
            {
                Preferences.Crashed   = reader.ReadBoolean();
                Preferences.CrashPath = reader.ReadString();
            }

            if (version >= 16)
            {
                Preferences.CheckForUpdates = reader.ReadBoolean();
            }

            if (17 <= version && version <= 28)
            {
                Preferences.BaseTime = reader.ReadInt64();
            }
        });
 public static Pitch matrixToSideLEDs(int x, int y, LaunchpadModels model)
 {
     switch (model)
     {
         case LaunchpadModels.LaunchpadS:
             return sideLEDnotesS[y];
             break;
         case LaunchpadModels.LaunchpadPro:
             return sideLEDnotes[y];
             break;
         case LaunchpadModels.LaunchpadMini:
             return sideLEDnotesS[y];
             break;
         case LaunchpadModels.LaunchpadMk2:
             return sideLEDnotes[y];
             break;
         default:
             return Pitch.A0;
             break;
     }
 }
 public static Pitch matrixToNote(int x, int y, LaunchpadModels model)
 {
     switch (model)
     {
         case LaunchpadModels.LaunchpadS:
             return sessionNotesS[x, y];
             break;
         case LaunchpadModels.LaunchpadPro:
             return sessionNotes[x, y];
             break;
         case LaunchpadModels.LaunchpadMini:
             return sessionNotesS[x, y];
             break;
         case LaunchpadModels.LaunchpadMk2:
             return sessionNotes[x, y];
             break;
         default:
             return Pitch.A0;
             break;
     }
 }
 public static int colorToVelo(Color color, LaunchpadModels model)
 {
     switch (model)
     {
         case LaunchpadModels.LaunchpadS:
             devid = 1;
             break;
         case LaunchpadModels.LaunchpadPro:
             devid = 2;
             break;
         case LaunchpadModels.LaunchpadMini:
             devid = 1;
             break;
         case LaunchpadModels.LaunchpadMk2:
             devid = 2;
             break;
         default:
             break;
     }
     if (devid == 1 && LaunchpadSColors.ContainsKey(color.Name))
     {
         return LaunchpadSColors[color.Name];
     }
     else if (devid == 2 && LaunchpadMk2Colors.ContainsKey(color.Name))
     {
         return LaunchpadMk2Colors[color.Name];
     }
     else if (CustomColors.previewColors.ContainsValue(color))
     {
         Dictionary<string, int> velos = CustomColors.loadColorsFromConfig();
         string name = CustomColors.previewColors.FirstOrDefault(x => x.Value == color).Key;
         return velos[name];
     }
     else
     {
         return 0;
     }
 }