diff --git a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/cell/LocalizeCell.java b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/cell/LocalizeCell.java new file mode 100644 index 0000000000000000000000000000000000000000..ce138035282722a35ee8f74f2774200f0a079a5a --- /dev/null +++ b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/cell/LocalizeCell.java @@ -0,0 +1,23 @@ +package de.tobias.playpad.viewcontroller.cell; + +import de.thecodelabs.utils.util.Localization; +import javafx.scene.control.ListCell; + +public class LocalizeCell extends ListCell<String> { + + private final String baseName; + + public LocalizeCell(String baseName) { + this.baseName = baseName; + } + + @Override + protected void updateItem(String item, boolean empty) { + super.updateItem(item, empty); + if (!empty) { + setText(Localization.getString(baseName + item)); + } else { + setText(""); + } + } +} diff --git a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java index a949622480873dcea5e15793d279d61a25bcf05f..66bc7372d9f342ba83f7cee5dd48334ff89bd200 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java +++ b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/feedback/SingleFeedbackViewController.java @@ -10,9 +10,6 @@ import de.thecodelabs.utils.ui.NVC; import de.thecodelabs.utils.ui.icon.FontIcon; import de.thecodelabs.utils.util.ColorUtils; import de.thecodelabs.utils.util.Localization; -import de.tobias.playpad.action.feedback.LightMode; -import de.tobias.playpad.profile.Profile; -import de.tobias.playpad.profile.ProfileSettings; import de.tobias.playpad.view.FeedbackColorPickerView; import de.tobias.playpad.viewcontroller.design.IColorButton; import javafx.event.ActionEvent; @@ -43,9 +40,9 @@ public class SingleFeedbackViewController extends NVC implements IColorButton { private PopOver colorChooser; - private FeedbackColor[] colors; - private Feedback feedback; - private Action action; + private final FeedbackColor[] colors; + private final Feedback feedback; + private final Action action; public SingleFeedbackViewController(Feedback feedback, FeedbackType type, FeedbackValue[] values, Action action) { load("view/option/feedback", "SingleFeedback", Localization.getBundle()); @@ -98,11 +95,6 @@ public class SingleFeedbackViewController extends NVC implements IColorButton { final FeedbackColor feedbackColor = getFeedbackColor(feedback); List<? extends FeedbackColor> selectableColors = Arrays.asList(colors); - if (colors instanceof LightMode.ILightMode[]) { - ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); - selectableColors = LightMode.filter((LightMode.ILightMode[]) colors, profileSettings.getLightMode()); - } - FeedbackColorPickerView colorView = new FeedbackColorPickerView(feedbackColor, selectableColors, item -> { colorChooser.hide(); diff --git a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java index a184e370feeb0fb15feec5d6325aba4e58fba057..e6453ef16d4b6eddd5491fe696e841645f614bc4 100644 --- a/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java +++ b/PlayWall/src/main/java/de/tobias/playpad/viewcontroller/option/profile/MappingTabViewController.java @@ -17,7 +17,7 @@ import de.tobias.playpad.Strings; import de.tobias.playpad.action.ActionProvider; import de.tobias.playpad.action.ActionType; import de.tobias.playpad.action.feedback.ColorAdjuster; -import de.tobias.playpad.action.feedback.LightMode; +import de.tobias.playpad.action.feedback.FeedbackColorSuggester; import de.tobias.playpad.action.settings.ActionSettingsEntry; import de.tobias.playpad.action.settings.ActionSettingsMappable; import de.tobias.playpad.profile.Profile; @@ -27,7 +27,7 @@ import de.tobias.playpad.registry.Component; import de.tobias.playpad.viewcontroller.BaseMapperListViewController; import de.tobias.playpad.viewcontroller.IMappingTabViewController; import de.tobias.playpad.viewcontroller.cell.DisplayableTreeCell; -import de.tobias.playpad.viewcontroller.cell.EnumCell; +import de.tobias.playpad.viewcontroller.cell.LocalizeCell; import de.tobias.playpad.viewcontroller.cell.MappingListCell; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.playpad.viewcontroller.option.IProfileReloadTask; @@ -77,7 +77,7 @@ public class MappingTabViewController extends ProfileSettingsTabViewController i private ComboBox<String> deviceComboBox; @FXML - private ComboBox<LightMode> lightModeComboBox; + private ComboBox<String> midiColorMappingComboBox; // Main View @FXML @@ -141,9 +141,20 @@ public class MappingTabViewController extends ProfileSettingsTabViewController i }); treeView.setCellFactory(list -> new DisplayableTreeCell<>()); - lightModeComboBox.getItems().setAll(LightMode.values()); - lightModeComboBox.setCellFactory(list -> new EnumCell<>("LightMode.")); - lightModeComboBox.setButtonCell(new EnumCell<>("LightMode.")); + initMidiColorMappingComboBox(); + midiColorMappingComboBox.getSelectionModel().selectedItemProperty().addListener((observable, oldValue, newValue) -> { + final ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); + profileSettings.setMidiColorMapping(midiColorMappingComboBox.getValue()); + }); + } + + private void initMidiColorMappingComboBox() { + if (Midi.getInstance().getFeedbackTranscript() instanceof FeedbackColorSuggester) { + final FeedbackColorSuggester feedbackColorSuggester = (FeedbackColorSuggester) Midi.getInstance().getFeedbackTranscript(); + midiColorMappingComboBox.getItems().setAll(feedbackColorSuggester.getMidiColorMappings()); + midiColorMappingComboBox.setCellFactory(list -> new LocalizeCell("MidiColorMapping.")); + midiColorMappingComboBox.setButtonCell(new LocalizeCell("MidiColorMapping.")); + } } private TreeItem<ActionSettingsEntry> createTreeView(Mapping mapping) { @@ -230,6 +241,7 @@ public class MappingTabViewController extends ProfileSettingsTabViewController i } } } + initMidiColorMappingComboBox(); } @SuppressWarnings("Duplicates") @@ -392,7 +404,7 @@ public class MappingTabViewController extends ProfileSettingsTabViewController i midiActiveCheckBox.setSelected(profileSettings.isMidiActive()); deviceComboBox.setDisable(!profileSettings.isMidiActive()); deviceComboBox.setValue(profileSettings.getMidiDevice()); - lightModeComboBox.setValue(profileSettings.getLightMode()); + midiColorMappingComboBox.setValue(profileSettings.getMidiColorMapping()); } @Override @@ -401,7 +413,6 @@ public class MappingTabViewController extends ProfileSettingsTabViewController i // Midi profileSettings.setMidiActive(isMidiActive()); - profileSettings.setLightMode(lightModeComboBox.getValue()); } @Override diff --git a/PlayWall/src/main/resources/lang/_de.properties b/PlayWall/src/main/resources/lang/_de.properties index 89375f4cd298891b17d51dc0afa36aad00086b3f..84809cdf0268fa8f6ed2bbb5f625136426f8a3ee 100755 --- a/PlayWall/src/main/resources/lang/_de.properties +++ b/PlayWall/src/main/resources/lang/_de.properties @@ -265,8 +265,3 @@ Server.Error.IO=Anmeldung fehlgeschlagen. Der Server ist nicht erreichbar. Versu Server.Error.Login=Anmeldung fehlgeschlagen. Der Nutzername oder das Passwort sind nicht korrekt. Auth.Logout=Alle Onlineprojekte sind nicht mehr lokal verf\u00FCgbar. - -#LightMode Enum -LightMode.LOW=Niedrig -LightMode.NORMAL=Mittel -LightMode.HIGH=Hell \ No newline at end of file diff --git a/PlayWall/src/main/resources/lang/ui_de.properties b/PlayWall/src/main/resources/lang/ui_de.properties index f7eb45e0b6f85393bd5a290726f0d7502463a35d..d90e1e09f759c5a4eb83a98b2eff7465035da671 100755 --- a/PlayWall/src/main/resources/lang/ui_de.properties +++ b/PlayWall/src/main/resources/lang/ui_de.properties @@ -97,8 +97,8 @@ settings.paths.button.choose=W\u00E4hlen... settings.paths.checkbox.mediaActive=Mediendateien beim Import in den Medienordner kopieren settings.button.finish=Fertig settings.checkbox.activate=Aktivieren -settings.label.lightmode=Helligkeit -settings.label.lightmode.info=(Nur f\u00FCr LaunchPad MK2 unterst\u00FCtzt) +settings.label.midiColorMapping=Farbmodus +settings.label.midiColorMapping.info=(Nur f\u00FCr LaunchPad MK2 unterst\u00FCtzt) plugins.button.install=Installieren plugins.button.uninstall=Deinstallieren diff --git a/PlayWall/src/main/resources/view/option/profile/Mapping.fxml b/PlayWall/src/main/resources/view/option/profile/Mapping.fxml index d52b331da82a236ee33b08ed1d95c7ddf8efd3a0..77f8684ef88127b43b67361bdf1cc446c2c46e09 100644 --- a/PlayWall/src/main/resources/view/option/profile/Mapping.fxml +++ b/PlayWall/src/main/resources/view/option/profile/Mapping.fxml @@ -45,15 +45,15 @@ </HBox> <HBox spacing="14.0"> <children> - <Label alignment="CENTER_RIGHT" prefWidth="150.0" text="%settings.label.lightmode"> + <Label alignment="CENTER_RIGHT" prefWidth="150.0" text="%settings.label.midiColorMapping"> <HBox.margin> <Insets top="4.0" /> </HBox.margin> </Label> <HBox maxWidth="1.7976931348623157E308" spacing="14.0" HBox.hgrow="ALWAYS"> <children> - <ComboBox fx:id="lightModeComboBox" onAction="#deviceHandler" prefWidth="150.0" /> - <Label text="%settings.label.lightmode.info" /> + <ComboBox fx:id="midiColorMappingComboBox" onAction="#deviceHandler" prefWidth="150.0" /> + <Label text="%settings.label.midiColorMapping.info" /> </children> </HBox> </children> diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/FeedbackColorSuggester.java b/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/FeedbackColorSuggester.java index 9af2b7699149cbf75ea4ed13c3ac872b224ccd05..53aa94a8d940e4e45b50fe15854bb29c808fa14c 100644 --- a/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/FeedbackColorSuggester.java +++ b/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/FeedbackColorSuggester.java @@ -3,7 +3,11 @@ package de.tobias.playpad.action.feedback; import de.thecodelabs.midi.feedback.FeedbackColor; import javafx.scene.paint.Color; +import java.util.List; + public interface FeedbackColorSuggester { + List<String> getMidiColorMappings(); + FeedbackColor suggest(Color color); } diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/LightMode.java b/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/LightMode.java deleted file mode 100644 index 324ebe9ddd6cc9795f62cec20eb4a5fdf3cd120b..0000000000000000000000000000000000000000 --- a/PlayWallCore/src/main/java/de/tobias/playpad/action/feedback/LightMode.java +++ /dev/null @@ -1,25 +0,0 @@ -package de.tobias.playpad.action.feedback; - -import de.thecodelabs.midi.feedback.FeedbackColor; - -import java.util.List; -import java.util.stream.Collectors; -import java.util.stream.Stream; - -public enum LightMode { - LOW, - NORMAL, - HIGH; - - public interface ILightMode extends FeedbackColor { - LightMode getLightMode(); - - FeedbackColor translate(LightMode lightMode); - } - - public static List<ILightMode> filter(ILightMode[] values, LightMode filter) { - return Stream.of(values) - .filter(v -> v.getLightMode() == filter) - .collect(Collectors.toList()); - } -} \ No newline at end of file diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/profile/ProfileSettings.java b/PlayWallCore/src/main/java/de/tobias/playpad/profile/ProfileSettings.java index 0b20a03f7e516161a6507e746031236a4c02c80e..96605a40bdbefca0e271aaeedbf833dcf672a30e 100644 --- a/PlayWallCore/src/main/java/de/tobias/playpad/profile/ProfileSettings.java +++ b/PlayWallCore/src/main/java/de/tobias/playpad/profile/ProfileSettings.java @@ -4,7 +4,6 @@ import de.thecodelabs.logger.Logger; import de.thecodelabs.storage.settings.UserDefaults; import de.thecodelabs.storage.settings.annotation.Key; import de.tobias.playpad.PlayPadPlugin; -import de.tobias.playpad.action.feedback.LightMode; import de.tobias.playpad.design.modern.model.ModernGlobalDesign; import de.tobias.playpad.design.modern.serializer.ModernGlobalDesignSerializer; import de.tobias.playpad.pad.TimeMode; @@ -39,7 +38,7 @@ public class ProfileSettings { @Key private boolean midiActive = false; @Key - private LightMode lightMode = LightMode.NORMAL; + private String midiColorMapping = ""; // Audio Output @Key @@ -87,8 +86,8 @@ public class ProfileSettings { return midiDevice; } - public LightMode getLightMode() { - return lightMode; + public String getMidiColorMapping() { + return midiColorMapping; } public String getMainLayoutType() { @@ -140,8 +139,8 @@ public class ProfileSettings { this.midiDevice = midiDevice; } - public void setLightMode(LightMode lightMode) { - this.lightMode = lightMode; + public void setMidiColorMapping(String midiColorMapping) { + this.midiColorMapping = midiColorMapping; } public void setMainLayoutType(String mainLayoutType) { @@ -204,7 +203,7 @@ public class ProfileSettings { private static final String DESIGN_ELEMENT = "Design"; private static final String MIDI_ACTIVE_ELEMENT = "MidiActive"; private static final String MIDI_DEVICE_ELEMENT = "MidiDevice"; - private static final String LIGHT_MODE = "LightMode"; + private static final String MIDI_COLOR_MAPPING = "MidiColorMapping"; // File Handler public static ProfileSettings load(Path path) throws DocumentException, IOException { @@ -221,8 +220,8 @@ public class ProfileSettings { profileSettings.setMidiDeviceName(root.element(MIDI_DEVICE_ELEMENT).getStringValue()); if (root.element(MIDI_ACTIVE_ELEMENT) != null) profileSettings.setMidiActive(Boolean.parseBoolean(root.element(MIDI_ACTIVE_ELEMENT).getStringValue())); - if (root.element(LIGHT_MODE) != null) - profileSettings.setLightMode(LightMode.valueOf(root.element(LIGHT_MODE).getStringValue())); + if (root.element(MIDI_COLOR_MAPPING) != null) + profileSettings.setMidiColorMapping(root.elementText(MIDI_COLOR_MAPPING)); if (root.element(DESIGN_ELEMENT) != null) { Element element = root.element(DESIGN_ELEMENT); @@ -292,7 +291,7 @@ public class ProfileSettings { if (midiDevice != null) root.addElement(MIDI_DEVICE_ELEMENT).addText(midiDevice); root.addElement(MIDI_ACTIVE_ELEMENT).addText(String.valueOf(midiActive)); - root.addElement(LIGHT_MODE).addText(lightMode.name()); + root.addElement(MIDI_COLOR_MAPPING).addText(midiColorMapping); Element designElement = root.addElement(DESIGN_ELEMENT); ModernGlobalDesignSerializer serializer = new ModernGlobalDesignSerializer(); diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/LaunchpadPluginImpl.java b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/LaunchpadPluginImpl.java index 0a62f947c6504e42134e4e139aaff43886478acf..971674a1105103c029cf319691fe08f2c9a6331c 100644 --- a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/LaunchpadPluginImpl.java +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/LaunchpadPluginImpl.java @@ -4,6 +4,7 @@ import de.thecodelabs.logger.Logger; import de.thecodelabs.midi.midi.feedback.MidiFeedbackTranscriptionRegistry; import de.thecodelabs.plugins.PluginDescriptor; import de.thecodelabs.plugins.versionizer.PluginArtifact; +import de.thecodelabs.utils.util.Localization; import de.tobias.playpad.launchpadplugin.midi.mk2.LaunchPadMK2; import de.tobias.playpad.launchpadplugin.midi.s.LaunchPadS; import de.tobias.playpad.plugin.Module; @@ -17,6 +18,7 @@ public class LaunchpadPluginImpl implements PlayPadPluginStub, PluginArtifact { @Override public void startup(PluginDescriptor descriptor) { module = new Module(descriptor.getName(), descriptor.getArtifactId()); + Localization.addResourceBundle("lang/l10n", LaunchpadPluginImpl.class.getClassLoader()); final MidiFeedbackTranscriptionRegistry registry = MidiFeedbackTranscriptionRegistry.getInstance(); registry.register(LaunchPadMK2.NAME, new LaunchPadMK2()); diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/MapParser.java b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/MapParser.java index 6870092286dc3456b5a0991a3f032792ef845e76..76ccdfc38c10ee139c82c4e3d8c4e9fec50bc4ee 100644 --- a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/MapParser.java +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/impl/MapParser.java @@ -1,5 +1,6 @@ package de.tobias.playpad.launchpadplugin.impl; +import de.thecodelabs.midi.feedback.FeedbackColor; import de.thecodelabs.utils.io.IOUtils; import java.io.IOException; @@ -12,8 +13,8 @@ public class MapParser { private MapParser() { } - public static Map<String, String> load(URL resource) throws IOException { - Map<String, String> items = new HashMap<>(); + public static Map<String, FeedbackColor> load(URL resource, Class<? extends Enum> type) throws IOException { + Map<String, FeedbackColor> items = new HashMap<>(); for (String line : IOUtils.readURL(resource).split("\n")) { line = line.trim(); @@ -25,8 +26,8 @@ public class MapParser { String[] split = line.split("="); if (split.length == 2) { String color = split[0]; - String val = split[1]; - items.put(color, val); + Enum<?> val = Enum.valueOf(type, split[1]); + items.put(color, (FeedbackColor) val); } } return items; diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2.java b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2.java index bd6f1c60c5d2bf91a7d71ee5fcf51429fdf258f8..aabc7fb7d6f8c3a766f6ea462c992eeb640fab78 100644 --- a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2.java +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2.java @@ -11,14 +11,12 @@ import de.thecodelabs.midi.midi.MidiCommand; import de.thecodelabs.midi.midi.MidiCommandType; import de.thecodelabs.midi.midi.feedback.MidiFeedbackTranscript; import de.tobias.playpad.action.feedback.FeedbackColorSuggester; -import de.tobias.playpad.action.feedback.LightMode; import de.tobias.playpad.launchpadplugin.impl.MapParser; import de.tobias.playpad.profile.Profile; import javafx.scene.paint.Color; import java.net.URL; -import java.util.Map; -import java.util.Optional; +import java.util.*; public class LaunchPadMK2 implements MidiFeedbackTranscript, FeedbackColorSuggester { @@ -26,12 +24,22 @@ public class LaunchPadMK2 implements MidiFeedbackTranscript, FeedbackColorSugges public static final String NATIVE_NAME = "CoreMIDI4J - Launchpad MK2"; // Modern Colors mapped to the colors of the launchpad - private static Map<String, String> mapProperties; + private static final String[] COLOR_MAPPING_FILES = { + "launchpad_mk2_colorful.map", + "launchpad_mk2_high.map", + "launchpad_mk2_normal.map", + "launchpad_mk2_low.map" + }; + private static final String DEFAULT_COLOR_MAPPING = COLOR_MAPPING_FILES[0]; + private static final Map<String, Map<String, FeedbackColor>> midiColorMappings; static { + midiColorMappings = new HashMap<>(); try { - URL resource = LaunchPadMK2.class.getClassLoader().getResource("launchpad_mk2.map"); - mapProperties = MapParser.load(resource); + for (String mappingFile : COLOR_MAPPING_FILES) { + URL resource = LaunchPadMK2.class.getClassLoader().getResource(mappingFile); + midiColorMappings.put(mappingFile, MapParser.load(resource, LaunchPadMK2Color.class)); + } } catch (Exception e) { Logger.error(e); } @@ -86,7 +94,12 @@ public class LaunchPadMK2 implements MidiFeedbackTranscript, FeedbackColorSugges @Override public FeedbackValue[] getFeedbackValues() { - return LaunchPadMK2Color.values(); + String midiColorMapping = Profile.currentProfile().getProfileSettings().getMidiColorMapping(); + if (midiColorMapping == null || midiColorMapping.isEmpty()) { + midiColorMapping = DEFAULT_COLOR_MAPPING; + } + final Map<String, FeedbackColor> colorMap = midiColorMappings.get(midiColorMapping); + return colorMap.values().stream().sorted().distinct().toArray(FeedbackColor[]::new); } @Override @@ -94,14 +107,23 @@ public class LaunchPadMK2 implements MidiFeedbackTranscript, FeedbackColorSugges return Optional.ofNullable(LaunchPadMK2Color.valueOf(b)); } + /* + FeedbackColorSuggester + */ + + @Override + public List<String> getMidiColorMappings() { + return Arrays.asList(COLOR_MAPPING_FILES); + } + @Override public FeedbackColor suggest(Color color) { - if (mapProperties.containsKey(color.toString())) { - String nameOfConst = mapProperties.get(color.toString()); - final LaunchPadMK2Color mk2Color = LaunchPadMK2Color.valueOf(nameOfConst); + final String midiColorMapping = Optional.ofNullable(Profile.currentProfile().getProfileSettings().getMidiColorMapping()) + .orElse(DEFAULT_COLOR_MAPPING); + final Map<String, FeedbackColor> colorMap = midiColorMappings.get(midiColorMapping); - LightMode lightMode = Profile.currentProfile().getProfileSettings().getLightMode(); - return mk2Color.translate(lightMode); + if (colorMap.containsKey(color.toString())) { + return colorMap.get(color.toString()); } return null; } diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2Color.java b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2Color.java index e6ca89373768ef0d4c91b1c85eb559a194245f03..fa9e780c913b4dfe72ca7c2ea1f01e416a226896 100644 --- a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2Color.java +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/java/de/tobias/playpad/launchpadplugin/midi/mk2/LaunchPadMK2Color.java @@ -1,100 +1,103 @@ package de.tobias.playpad.launchpadplugin.midi.mk2; import de.thecodelabs.midi.feedback.FeedbackColor; -import de.tobias.playpad.action.feedback.LightMode; import javafx.scene.paint.Color; import javafx.scene.paint.Paint; -public enum LaunchPadMK2Color implements FeedbackColor, LightMode.ILightMode { +public enum LaunchPadMK2Color implements FeedbackColor { + + /* + High + Normal + Low + */ // White - C0_1(1, Color.rgb(255, 255, 255), LightMode.LOW), - C0_2(2, Color.rgb(255, 255, 255), LightMode.NORMAL), - C0_3(3, Color.rgb(255, 255, 255), LightMode.HIGH), + C0_3(3, Color.rgb(255, 255, 255)), + C0_2(2, Color.rgb(255, 255, 255).darker()), + C0_1(1, Color.rgb(255, 255, 255).darker().darker()), // RED - C1_2(5, Color.rgb(255, 0, 0), LightMode.HIGH), - C1_3(6, Color.rgb(255, 0, 0), LightMode.NORMAL), - C1_4(7, Color.rgb(255, 0, 0), LightMode.LOW), + C1_1(5, Color.rgb(255, 0, 0)), + C1_2(6, Color.rgb(255, 0, 0).darker()), + C1_3(7, Color.rgb(255, 0, 0).darker().darker()), // Orange - C2_2(9, Color.rgb(255, 127, 0), LightMode.HIGH), - C2_3(10, Color.rgb(255, 127, 0), LightMode.NORMAL), - C2_4(11, Color.rgb(255, 127, 0), LightMode.LOW), + C2_1(9, Color.rgb(255, 127, 0)), + C2_2(10, Color.rgb(255, 127, 0).darker()), + C2_3(11, Color.rgb(255, 127, 0).darker().darker()), // LIME - C3_2(13, Color.rgb(235, 255, 39), LightMode.HIGH), - C3_3(14, Color.rgb(235, 255, 39), LightMode.NORMAL), - C3_4(15, Color.rgb(235, 255, 39), LightMode.LOW), + C3_1(13, Color.rgb(235, 255, 39)), + C3_2(14, Color.rgb(235, 255, 39).darker()), + C3_3(15, Color.rgb(235, 255, 39).darker().darker()), // LIGHT GREEN - C4_2(17, Color.rgb(123, 255, 66), LightMode.HIGH), - C4_3(18, Color.rgb(123, 255, 66), LightMode.NORMAL), - C4_4(19, Color.rgb(123, 255, 66), LightMode.LOW), + C4_1(17, Color.rgb(123, 255, 66)), + C4_2(18, Color.rgb(123, 255, 66).darker()), + C4_3(19, Color.rgb(123, 255, 66).darker().darker()), // GREEN - C5_2(21, Color.rgb(0, 255, 0), LightMode.HIGH), - C5_3(22, Color.rgb(0, 255, 0), LightMode.NORMAL), - C5_4(23, Color.rgb(0, 255, 0), LightMode.LOW), + C5_1(21, Color.rgb(0, 255, 0)), + C5_2(22, Color.rgb(0, 255, 0).darker()), + C5_3(23, Color.rgb(0, 255, 0).darker().darker()), // GREEN - C6_2(25, Color.rgb(62, 255, 112), LightMode.HIGH), - C6_3(26, Color.rgb(62, 255, 112), LightMode.NORMAL), - C6_4(27, Color.rgb(62, 255, 112), LightMode.LOW), + C6_1(25, Color.rgb(62, 255, 112)), + C6_2(26, Color.rgb(62, 255, 112).darker()), + C6_3(27, Color.rgb(62, 255, 112).darker().darker()), // TURKEY - C7_2(29, Color.rgb(62, 255, 112), LightMode.HIGH), - C7_3(30, Color.rgb(62, 255, 112), LightMode.NORMAL), - C7_4(31, Color.rgb(62, 255, 112), LightMode.LOW), + C7_1(29, Color.rgb(62, 255, 112)), + C7_2(30, Color.rgb(62, 255, 112).darker()), + C7_3(31, Color.rgb(62, 255, 112).darker().darker()), // TURKEY - C8_2(33, Color.rgb(101, 255, 196), LightMode.HIGH), - C8_3(34, Color.rgb(101, 255, 196), LightMode.NORMAL), - C8_4(35, Color.rgb(101, 255, 196), LightMode.LOW), + C8_1(33, Color.rgb(101, 255, 196)), + C8_2(34, Color.rgb(101, 255, 196).darker()), + C8_3(35, Color.rgb(101, 255, 196).darker().darker()), // LIGHT BLUE - C9_2(37, Color.rgb(91, 255, 253), LightMode.HIGH), - C9_3(38, Color.rgb(91, 255, 253), LightMode.NORMAL), - C9_4(39, Color.rgb(91, 255, 253), LightMode.LOW), + C9_1(37, Color.rgb(91, 255, 253)), + C9_2(38, Color.rgb(91, 255, 253).darker()), + C9_3(39, Color.rgb(91, 255, 253).darker().darker()), // BLUE - C10_2(41, Color.rgb(69, 169, 255), LightMode.HIGH), - C10_3(42, Color.rgb(69, 169, 255), LightMode.NORMAL), - C10_4(43, Color.rgb(69, 169, 255), LightMode.LOW), + C10_1(41, Color.rgb(69, 169, 255)), + C10_2(42, Color.rgb(69, 169, 255).darker()), + C10_3(43, Color.rgb(69, 169, 255).darker().darker()), // DARK BLUE - C11_2(45, Color.rgb(30, 67, 255), LightMode.HIGH), - C11_3(46, Color.rgb(30, 67, 255), LightMode.NORMAL), - C11_4(47, Color.rgb(30, 67, 255), LightMode.LOW), + C11_1(45, Color.rgb(30, 67, 255)), + C11_2(46, Color.rgb(30, 67, 255).darker()), + C11_3(47, Color.rgb(30, 67, 255).darker().darker()), // PURPLE - C12_2(49, Color.rgb(125, 73, 255), LightMode.HIGH), - C12_3(50, Color.rgb(125, 73, 255), LightMode.NORMAL), - C12_4(51, Color.rgb(125, 73, 255), LightMode.LOW), + C12_1(49, Color.rgb(125, 73, 255)), + C12_2(50, Color.rgb(125, 73, 255).darker()), + C12_3(51, Color.rgb(125, 73, 255).darker().darker()), // VIOLET - C13_2(53, Color.rgb(254, 85, 255), LightMode.HIGH), - C13_3(54, Color.rgb(254, 85, 255), LightMode.NORMAL), - C13_4(55, Color.rgb(254, 85, 255), LightMode.LOW), + C13_1(53, Color.rgb(254, 85, 255)), + C13_2(54, Color.rgb(254, 85, 255).darker()), + C13_3(55, Color.rgb(254, 85, 255).darker().darker()), // VIOLET - C14_2(57, Color.rgb(255, 75, 191), LightMode.HIGH), - C14_3(58, Color.rgb(255, 75, 191), LightMode.NORMAL), - C14_4(59, Color.rgb(255, 75, 191), LightMode.LOW), + C14_1(57, Color.rgb(255, 75, 191)), + C14_2(58, Color.rgb(255, 75, 191).darker()), + C14_3(59, Color.rgb(255, 75, 191).darker().darker()), // BROWN - C15_2(61, Color.rgb(255, 100, 69), LightMode.HIGH), - C15_3(62, Color.rgb(255, 100, 69), LightMode.NORMAL), - C15_4(63, Color.rgb(255, 100, 69), LightMode.LOW); + C15_1(61, Color.rgb(255, 100, 69)), + C15_2(62, Color.rgb(255, 100, 69).darker()), + C15_3(63, Color.rgb(255, 100, 69).darker().darker()); private final int midi; private final Color color; - private final LightMode lightMode; - LaunchPadMK2Color(int midi, Color color, LightMode lightMode) { + LaunchPadMK2Color(int midi, Color color) { this.midi = midi; this.color = color; - this.lightMode = lightMode; } @Override @@ -107,22 +110,6 @@ public enum LaunchPadMK2Color implements FeedbackColor, LightMode.ILightMode { return (byte) midi; } - @Override - public LightMode getLightMode() { - return lightMode; - } - - @Override - public FeedbackColor translate(LightMode lightMode) { - for (LaunchPadMK2Color instance : values()) { - if (instance.getColor().equals(this.getColor()) && instance.lightMode == lightMode) { - return instance; - } - } - return null; - } - - public static FeedbackColor valueOf(int id) { for (LaunchPadMK2Color color : values()) { if (color.getValue() == id) { diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/lang/l10n.properties b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/lang/l10n.properties new file mode 100644 index 0000000000000000000000000000000000000000..2311de413f0b204b42af46086d3a4c9e120b4f25 --- /dev/null +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/lang/l10n.properties @@ -0,0 +1,4 @@ +MidiColorMapping.launchpad_mk2_colorful.map=Farbenfroh +MidiColorMapping.launchpad_mk2_high.map=Hell +MidiColorMapping.launchpad_mk2_low.map=Normal +MidiColorMapping.launchpad_mk2_normal.map=Dunkel \ No newline at end of file diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_colorful.map b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_colorful.map new file mode 100644 index 0000000000000000000000000000000000000000..e7c0ea99f1f837cfe84282fcbb9c707d5d4d64cc --- /dev/null +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_colorful.map @@ -0,0 +1,57 @@ +% RED +0xef9a9aff=C1_3 +0xef5350ff=C1_2 +0xe53935ff=C1_1 + +% DARK_RED +0xd92349ff=C1_3 +0xc92349ff=C1_2 +0xa90329ff=C1_1 + +% PINK +0xf48fb1ff=C14_3 +0xec407aff=C14_2 +0xd81b60ff=C14_1 + +% PURPLE +0xce93d8ff=C12_3 +0xab47bcff=C12_2 +0x8e24aaff=C12_1 + +% LIGHT_BLUE +0x80deeaff=C10_3 +0x26c6daff=C10_2 +0x00acc1ff=C10_1 + +% BLUE +0x90caf9ff=C11_3 +0x42a5f5ff=C11_2 +0x1e88e5ff=C11_1 + +% LIGHT_GREEN +0xc5e1a5ff=C5_3 +0x9ccc65ff=C5_2 +0x7cb342ff=C5_1 + +% LIME +0xe6ee9cff=C4_3 +0xd4e157ff=C4_2 +0xc0ca33ff=C4_1 + +% YELLOW +0xfff59dff=C3_3 +0xffee58ff=C3_2 +0xfdd835ff=C3_1 + +% ORANGE +0xffcc80ff=C2_3 +0xffa726ff=C2_2 +0xfb8c00ff=C2_1 + +% GRAY +0xeeeeeeff=C0_3 +0xccccccff=C0_3 +0xaaaaaaff=C0_3 +0x888888ff=C0_2 +0x666666ff=C0_2 +0x444444ff=C0_1 \ No newline at end of file diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_high.map b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_high.map new file mode 100644 index 0000000000000000000000000000000000000000..4f6532323fd9c3767adaa9936c7b28dd4d5c4cd6 --- /dev/null +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_high.map @@ -0,0 +1,57 @@ +% RED +0xef9a9aff=C1_1 +0xef5350ff=C1_1 +0xe53935ff=C1_1 + +% DARK_RED +0xd92349ff=C1_1 +0xc92349ff=C1_1 +0xa90329ff=C1_1 + +% PINK +0xf48fb1ff=C14_1 +0xec407aff=C14_1 +0xd81b60ff=C14_1 + +% PURPLE +0xce93d8ff=C12_1 +0xab47bcff=C12_1 +0x8e24aaff=C12_1 + +% LIGHT_BLUE +0x80deeaff=C10_1 +0x26c6daff=C10_1 +0x00acc1ff=C10_1 + +% BLUE +0x90caf9ff=C11_1 +0x42a5f5ff=C11_1 +0x1e88e5ff=C11_1 + +% LIGHT_GREEN +0xc5e1a5ff=C5_1 +0x9ccc65ff=C5_1 +0x7cb342ff=C5_1 + +% LIME +0xe6ee9cff=C4_1 +0xd4e157ff=C4_1 +0xc0ca33ff=C4_1 + +% YELLOW +0xfff59dff=C3_1 +0xffee58ff=C3_1 +0xfdd835ff=C3_1 + +% ORANGE +0xffcc80ff=C2_1 +0xffa726ff=C2_1 +0xfb8c00ff=C2_1 + +% GRAY +0xeeeeeeff=C0_3 +0xccccccff=C0_3 +0xaaaaaaff=C0_3 +0x888888ff=C0_2 +0x666666ff=C0_2 +0x444444ff=C0_1 \ No newline at end of file diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_low.map b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_low.map new file mode 100644 index 0000000000000000000000000000000000000000..34053852f3be518718bf5f982b255aa695b131b6 --- /dev/null +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_low.map @@ -0,0 +1,57 @@ +% RED +0xef9a9aff=C1_3 +0xef5350ff=C1_3 +0xe53935ff=C1_3 + +% DARK_RED +0xd92349ff=C1_3 +0xc92349ff=C1_3 +0xa90329ff=C1_3 + +% PINK +0xf48fb1ff=C14_3 +0xec407aff=C14_3 +0xd81b60ff=C14_3 + +% PURPLE +0xce93d8ff=C12_3 +0xab47bcff=C12_3 +0x8e24aaff=C12_3 + +% LIGHT_BLUE +0x80deeaff=C10_3 +0x26c6daff=C10_3 +0x00acc1ff=C10_3 + +% BLUE +0x90caf9ff=C11_3 +0x42a5f5ff=C11_3 +0x1e88e5ff=C11_3 + +% LIGHT_GREEN +0xc5e1a5ff=C5_3 +0x9ccc65ff=C5_3 +0x7cb342ff=C5_3 + +% LIME +0xe6ee9cff=C4_3 +0xd4e157ff=C4_3 +0xc0ca33ff=C4_3 + +% YELLOW +0xfff59dff=C3_3 +0xffee58ff=C3_3 +0xfdd835ff=C3_3 + +% ORANGE +0xffcc80ff=C2_3 +0xffa726ff=C2_3 +0xfb8c00ff=C2_3 + +% GRAY +0xeeeeeeff=C0_3 +0xccccccff=C0_3 +0xaaaaaaff=C0_3 +0x888888ff=C0_2 +0x666666ff=C0_2 +0x444444ff=C0_1 \ No newline at end of file diff --git a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2.map b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_normal.map similarity index 97% rename from PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2.map rename to PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_normal.map index 72565457824aa9a5741c5a28924031efef3ea9db..8ab039471cdd4999aa4a59cd591c75b5138221d9 100644 --- a/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2.map +++ b/PlayWallPlugins/PlayWallPluginLaunchpad/src/main/resources/launchpad_mk2_normal.map @@ -54,4 +54,4 @@ 0xaaaaaaff=C0_3 0x888888ff=C0_2 0x666666ff=C0_2 -0x444444ff=C0_2 \ No newline at end of file +0x444444ff=C0_1 \ No newline at end of file