From 95173e35c984b9779802808efd629750d8bae007 Mon Sep 17 00:00:00 2001 From: Benji Arrigo Date: Tue, 8 Mar 2022 15:48:43 -0600 Subject: [PATCH] Version 1.17 Update Stable & Working! --- photon/.classpath | 51 +++--- photon/.project | 41 +++-- photon/pom.xml | 9 +- .../main/java/com/strikete/photon/Photon.java | 147 +++++++++++++----- .../photon/events/CompleteDataModelEvent.java | 11 ++ .../photon/events/CountResponseEvent.java | 29 ++++ .../photon/events/GenericUpdateEvent.java | 23 +++ .../events/ObjectDataGatheredEvent.java | 29 ++++ .../photon/events/UpdateOscObjectsEvent.java | 11 ++ .../photon/events/VersionResponseEvent.java | 23 +++ .../strikete/photon/osc/OscInterpreter.java | 2 +- .../photon/photonosc/PhotonOscRoutines.java | 72 ++++++--- .../strikete/photon/utils/PhotonTypes.java | 22 +++ 13 files changed, 356 insertions(+), 114 deletions(-) create mode 100644 photon/src/main/java/com/strikete/photon/events/CompleteDataModelEvent.java create mode 100644 photon/src/main/java/com/strikete/photon/events/CountResponseEvent.java create mode 100644 photon/src/main/java/com/strikete/photon/events/GenericUpdateEvent.java create mode 100644 photon/src/main/java/com/strikete/photon/events/ObjectDataGatheredEvent.java create mode 100644 photon/src/main/java/com/strikete/photon/events/UpdateOscObjectsEvent.java create mode 100644 photon/src/main/java/com/strikete/photon/events/VersionResponseEvent.java create mode 100644 photon/src/main/java/com/strikete/photon/utils/PhotonTypes.java diff --git a/photon/.classpath b/photon/.classpath index a5d9509..449ed8d 100644 --- a/photon/.classpath +++ b/photon/.classpath @@ -1,32 +1,23 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/photon/.project b/photon/.project index 4151717..92ae70e 100644 --- a/photon/.project +++ b/photon/.project @@ -1,23 +1,18 @@ - - - photon - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.m2e.core.maven2Builder - - - - - - org.eclipse.jdt.core.javanature - org.eclipse.m2e.core.maven2Nature - - + + + photon + A plugin interface for Light Boards. NO_M2ECLIPSE_SUPPORT: Project files created with the maven-eclipse-plugin are not supported in M2Eclipse. + + + + org.eclipse.jdt.core.javabuilder + + + org.eclipse.m2e.core.maven2Builder + + + + org.eclipse.jdt.core.javanature + org.eclipse.m2e.core.maven2Nature + + \ No newline at end of file diff --git a/photon/pom.xml b/photon/pom.xml index 4c6332e..4b3858d 100644 --- a/photon/pom.xml +++ b/photon/pom.xml @@ -2,7 +2,7 @@ 4.0.0 com.strikete photon - 0.0.1-SNAPSHOT + 1.17 Photon LX Console Plugin Manager A plugin interface for Light Boards @@ -24,7 +24,7 @@ com.google.guava guava - 30.0-jre + 31.0.1-jre org.apache.commons @@ -32,6 +32,11 @@ 1.9.0 + + UTF-8 + 1.8 + 1.8 + diff --git a/photon/src/main/java/com/strikete/photon/Photon.java b/photon/src/main/java/com/strikete/photon/Photon.java index 69e812c..1c45561 100644 --- a/photon/src/main/java/com/strikete/photon/Photon.java +++ b/photon/src/main/java/com/strikete/photon/Photon.java @@ -2,10 +2,17 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.concurrent.ExecutorService; +import java.util.concurrent.Executors; import org.apache.log4j.BasicConfigurator; import org.apache.log4j.Logger; +import com.google.common.eventbus.AsyncEventBus; +import com.google.common.eventbus.Subscribe; +import com.strikete.photon.events.CompleteDataModelEvent; +import com.strikete.photon.events.ObjectDataGatheredEvent; +import com.strikete.photon.events.UpdateOscObjectsEvent; import com.strikete.photon.objects.BeamPalette; import com.strikete.photon.objects.Channel; import com.strikete.photon.objects.ColorPalette; @@ -34,12 +41,13 @@ public class Photon { * VARIABLES - PROGRAM SPECIFIC */ public static Logger log; - public static final String version = "SNAPSHOT 0.9.0"; + public static final String version = "1.17"; public OscSender sender; public OscInterpreter interpreter; public PhotonDataUtilities dataUtility; public OscSenderRoutines senderRoutines; - + public AsyncEventBus photonEventBus; + public ExecutorService executor; /* * VARIABLES - EOS SPECIFIC @@ -69,6 +77,9 @@ public class Photon { public ArrayList subs; public int cuelistCount; + public boolean workingBool; + public boolean threadsAllowed; + /* * METHODS - GETTERS @@ -77,6 +88,24 @@ public String getEosVersion() { return eosVersion; } + /* + * METHODS - USER + */ + + public void stopUpdating() { + workingBool = false; + } + public boolean isUpdating() { + return workingBool; + } + public void closeAllThreads() { + executor.shutdownNow(); + threadsAllowed = false; + } + public void allowThreads() { + threadsAllowed = true; + } + /* * METHODS - SETTERS @@ -100,44 +129,87 @@ private static void printWelcomeMessage() { //Only to be called after the logger * METHODS - CORE FUNCTIONS */ + @Subscribe + public void updateOscObjectsViaEvent(UpdateOscObjectsEvent e) { + updateOscObjects(); + } + public void updateOscObjects() { log.debug("PHOTON: Updating OSC Objects."); + workingBool = true; - senderRoutines.getPatchCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getCuelistCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getGroupCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getMacroCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getSubCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getPresetCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getIntensityPaletteCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getFocusPaletteCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getColorPaletteCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getBeamPaletteCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getCurveCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getEffectCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getSnapshotCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getPixelmapCount(); - waitForPause(1000000000L); //Wait 1 second after last message - senderRoutines.getMagicSheetCount(); - waitForPause(1000000000L); //Wait 1 second after last message + while(workingBool) { + senderRoutines.getPatchCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Channels",channels.size())); + + senderRoutines.getCuelistCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Cuelists",cuelists.size())); + + senderRoutines.getGroupCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Groups",groups.size())); + + senderRoutines.getMacroCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Macros",macros.size())); + + senderRoutines.getSubCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Subs",subs.size())); + + senderRoutines.getPresetCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Presets",presets.size())); + + senderRoutines.getIntensityPaletteCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Intensity Palettes",intensityPalettes.size())); + + senderRoutines.getFocusPaletteCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Focus Palettes",focusPalettes.size())); + + senderRoutines.getColorPaletteCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Color Palettes",colorPalettes.size())); + + senderRoutines.getBeamPaletteCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Beam Palettes",beamPalettes.size())); + + senderRoutines.getCurveCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Curves",curves.size())); + + senderRoutines.getEffectCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Effects",effects.size())); + + senderRoutines.getSnapshotCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Snapshots",effects.size())); + + senderRoutines.getPixelmapCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Pixelmaps",effects.size())); + + senderRoutines.getMagicSheetCount(); + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new ObjectDataGatheredEvent("Magic Sheets",magicSheets.size())); - log.debug("PHOTON: Updating Cue Objects."); - for(int x = 0; x < cuelists.size(); x++) { - senderRoutines.getCueCount(cuelists.get(x).getCuelistNumber()); + log.debug("PHOTON: Updating Cue Objects."); + for(int x = 0; x < cuelists.size(); x++) { + senderRoutines.getCueCount(cuelists.get(x).getCuelistNumber()); + } + waitForPause(1000000000L); //Wait 1 second after last message + photonEventBus.post(new CompleteDataModelEvent()); + workingBool = false; + break; } + workingBool = false; + } public void waitForPause(long pauseTimeNano) { //Wait a set amount of time after receiving the last OSC message. @@ -205,6 +277,11 @@ public Photon() { BasicConfigurator.configure(); initializeVariables(); this.dataUtility = new PhotonDataUtilities(this); + this.executor = Executors.newFixedThreadPool(40); + this.threadsAllowed = true; + + this.photonEventBus = new AsyncEventBus(executor); + photonEventBus.register(this); printWelcomeMessage(); } diff --git a/photon/src/main/java/com/strikete/photon/events/CompleteDataModelEvent.java b/photon/src/main/java/com/strikete/photon/events/CompleteDataModelEvent.java new file mode 100644 index 0000000..907d215 --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/events/CompleteDataModelEvent.java @@ -0,0 +1,11 @@ +package com.strikete.photon.events; + +public class CompleteDataModelEvent extends GenericUpdateEvent { + + /* + * CONSTRUCTOR + */ + public CompleteDataModelEvent() { + super(); + } +} \ No newline at end of file diff --git a/photon/src/main/java/com/strikete/photon/events/CountResponseEvent.java b/photon/src/main/java/com/strikete/photon/events/CountResponseEvent.java new file mode 100644 index 0000000..33597a9 --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/events/CountResponseEvent.java @@ -0,0 +1,29 @@ +package com.strikete.photon.events; + +public class CountResponseEvent extends GenericUpdateEvent { + + /* + * VARIABLES + */ + private String type; + private int count; + + /* + * METHODS + */ + public String getType() { + return type; + } + public int getCount() { + return count; + } + + /* + * CONSTRUCTOR + */ + public CountResponseEvent(String type, int count) { + super(); + this.type = type; + this.count = count; + } +} \ No newline at end of file diff --git a/photon/src/main/java/com/strikete/photon/events/GenericUpdateEvent.java b/photon/src/main/java/com/strikete/photon/events/GenericUpdateEvent.java new file mode 100644 index 0000000..f957b6e --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/events/GenericUpdateEvent.java @@ -0,0 +1,23 @@ +package com.strikete.photon.events; + +public class GenericUpdateEvent { + + /* + * VARIABLE + */ + long timestamp; + + /* + * METHODS + */ + public long getTimestamp() { + return timestamp; + } + + /* + * CONSTRUCTOR + */ + public GenericUpdateEvent() { + this.timestamp = System.nanoTime(); + } +} \ No newline at end of file diff --git a/photon/src/main/java/com/strikete/photon/events/ObjectDataGatheredEvent.java b/photon/src/main/java/com/strikete/photon/events/ObjectDataGatheredEvent.java new file mode 100644 index 0000000..d603c9a --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/events/ObjectDataGatheredEvent.java @@ -0,0 +1,29 @@ +package com.strikete.photon.events; + +public class ObjectDataGatheredEvent extends GenericUpdateEvent { + + /* + * VARIABLES + */ + private String type; + private int count; + + /* + * METHODS + */ + public String getType() { + return type; + } + public int getCount() { + return count; + } + + /* + * CONSTRUCTOR + */ + public ObjectDataGatheredEvent(String type, int count) { + super(); + this.type = type; + this.count = count; + } +} \ No newline at end of file diff --git a/photon/src/main/java/com/strikete/photon/events/UpdateOscObjectsEvent.java b/photon/src/main/java/com/strikete/photon/events/UpdateOscObjectsEvent.java new file mode 100644 index 0000000..97fe5e3 --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/events/UpdateOscObjectsEvent.java @@ -0,0 +1,11 @@ +package com.strikete.photon.events; + +public class UpdateOscObjectsEvent extends GenericUpdateEvent { + + /* + * CONSTRUCTOR + */ + public UpdateOscObjectsEvent() { + super(); + } +} \ No newline at end of file diff --git a/photon/src/main/java/com/strikete/photon/events/VersionResponseEvent.java b/photon/src/main/java/com/strikete/photon/events/VersionResponseEvent.java new file mode 100644 index 0000000..eb57f63 --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/events/VersionResponseEvent.java @@ -0,0 +1,23 @@ +package com.strikete.photon.events; + +public class VersionResponseEvent extends GenericUpdateEvent { + + /* + * VARIABLES + */ + private String version; + + /* + * METHODS + */ + public String getVersion() { + return version; + } + + /* + * CONSTRUCTOR + */ + public VersionResponseEvent(String version) { + super(); + } +} \ No newline at end of file diff --git a/photon/src/main/java/com/strikete/photon/osc/OscInterpreter.java b/photon/src/main/java/com/strikete/photon/osc/OscInterpreter.java index 09cd119..ad00c55 100644 --- a/photon/src/main/java/com/strikete/photon/osc/OscInterpreter.java +++ b/photon/src/main/java/com/strikete/photon/osc/OscInterpreter.java @@ -111,7 +111,7 @@ public void acceptMessage(OSCMessageEvent event) { if(doArraysMatch(messageAddressArray, listenerAddressArray)) { //Compare the two arrays oscListeners.get(a).prepareConsumer(event.getMessage()); Thread thread = new Thread(oscListeners.get(a)); - thread.start(); + photon.executor.submit(thread); try { Thread.sleep(25); //Stabilizing sleep to help avoid data duplicates. diff --git a/photon/src/main/java/com/strikete/photon/photonosc/PhotonOscRoutines.java b/photon/src/main/java/com/strikete/photon/photonosc/PhotonOscRoutines.java index 93ed51f..eb56627 100644 --- a/photon/src/main/java/com/strikete/photon/photonosc/PhotonOscRoutines.java +++ b/photon/src/main/java/com/strikete/photon/photonosc/PhotonOscRoutines.java @@ -6,6 +6,8 @@ import com.illposed.osc.OSCMessage; import com.strikete.photon.Photon; +import com.strikete.photon.events.CountResponseEvent; +import com.strikete.photon.events.VersionResponseEvent; import com.strikete.photon.exceptions.ObjectNotFoundException; import com.strikete.photon.objects.BeamPalette; import com.strikete.photon.objects.Channel; @@ -43,7 +45,9 @@ public class PhotonOscRoutines { private void createVersionListener() { Consumer versionConsumer = message -> { List argList = message.getArguments(); - photon.setEosVersion(OscNumberInterpreter.oscToString(argList.get(0))); + String version = OscNumberInterpreter.oscToString(argList.get(0)); + photon.setEosVersion(version); + photon.photonEventBus.post(new VersionResponseEvent(version)); }; OscListener versionListener = new OscListener(photon, OscIncoming.RETURN_VERSION, versionConsumer, true); listeners.add(versionListener); @@ -54,16 +58,19 @@ private void createVersionListener() { */ private void performResponse(int count, String message) { - for(int b = 0; b < count; b++) { - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - // TODO Add generic Thread sleep error - e.printStackTrace(); - } - ArrayList indexParameter = new ArrayList(); - indexParameter.add(Integer.toString(b)); - photon.sender.sendOscMessage(photon.sender.parameterizeString(message, indexParameter)); + while(photon.workingBool) { + for(int b = 0; b < count; b++) { + try { + Thread.sleep(delay); + } catch (InterruptedException e) { + // TODO Add generic Thread sleep error + e.printStackTrace(); + } + ArrayList indexParameter = new ArrayList(); + indexParameter.add(Integer.toString(b)); + photon.sender.sendOscMessage(photon.sender.parameterizeString(message, indexParameter)); + } + break; } } @@ -72,6 +79,7 @@ private void createCountListeners() { Consumer patchCountConsumer = message -> { //PATCH COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Channels",count)); performResponse(count,OscOutgoing.GET_PATCH_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_PATCH_COUNT,patchCountConsumer,true)); @@ -80,6 +88,7 @@ private void createCountListeners() { List argList = message.getArguments(); int count = (Integer) argList.get(0); photon.cuelistCount = count; + photon.photonEventBus.post(new CountResponseEvent("Cuelists",count)); performResponse(count,OscOutgoing.GET_CUELIST_INFO); }; @@ -88,19 +97,23 @@ private void createCountListeners() { Consumer cueCountConsumer = message -> { //CUE COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); - for(int b = 0; b < count; b++) { - try { - Thread.sleep(delay); - } catch (InterruptedException e) { - // TODO Add generic Thread sleep error - e.printStackTrace(); + photon.photonEventBus.post(new CountResponseEvent("Cues",count)); + while(photon.workingBool) { + for(int b = 0; b < count; b++) { + try { + Thread.sleep(delay); + } catch (InterruptedException e) { + // TODO Add generic Thread sleep error + e.printStackTrace(); + } + ArrayList indexParameter = new ArrayList(); + String messageAddress = message.getAddress(); + String[] messageAddressArray = messageAddress.split("/"); + indexParameter.add(messageAddressArray[5]); + indexParameter.add(Integer.toString(b)); + photon.sender.sendOscMessage(photon.sender.parameterizeString(OscOutgoing.GET_CUE_INFO, indexParameter)); } - ArrayList indexParameter = new ArrayList(); - String messageAddress = message.getAddress(); - String[] messageAddressArray = messageAddress.split("/"); - indexParameter.add(messageAddressArray[5]); - indexParameter.add(Integer.toString(b)); - photon.sender.sendOscMessage(photon.sender.parameterizeString(OscOutgoing.GET_CUE_INFO, indexParameter)); + break; } }; listeners.add(new OscListener(photon,OscIncoming.RETURN_CUE_COUNT,cueCountConsumer,true)); @@ -108,6 +121,7 @@ private void createCountListeners() { Consumer groupCountConsumer = message -> { //GROUP COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Groups",count)); performResponse(count,OscOutgoing.GET_GROUP_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_GROUP_COUNT,groupCountConsumer,true)); @@ -115,6 +129,7 @@ private void createCountListeners() { Consumer macroCountConsumer = message -> { //MACRO COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Macros",count)); performResponse(count,OscOutgoing.GET_MACRO_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_MACRO_COUNT,macroCountConsumer,true)); @@ -122,6 +137,7 @@ private void createCountListeners() { Consumer subCountConsumer = message -> { //SUB COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Subs",count)); performResponse(count,OscOutgoing.GET_SUB_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_SUB_COUNT,subCountConsumer,true)); @@ -129,6 +145,7 @@ private void createCountListeners() { Consumer presetCountConsumer = message -> { //PRESET COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Presets",count)); performResponse(count,OscOutgoing.GET_PRESET_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_PRESET_COUNT,presetCountConsumer,true)); @@ -136,6 +153,7 @@ private void createCountListeners() { Consumer intensityPaletteCountConsumer = message -> { //INTENSITY PALETTE COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Intensity Palettes",count)); performResponse(count,OscOutgoing.GET_INTENSITY_PALETTE_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_INTENSITY_PALETTE_COUNT,intensityPaletteCountConsumer,true)); @@ -143,6 +161,7 @@ private void createCountListeners() { Consumer focusPaletteCountConsumer = message -> { //FOCUS PALETTE COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Focus Palettes",count)); performResponse(count,OscOutgoing.GET_FOCUS_PALETTE_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_FOCUS_PALETTE_COUNT,focusPaletteCountConsumer,true)); @@ -150,6 +169,7 @@ private void createCountListeners() { Consumer colorPaletteCountConsumer = message -> { //COLOR PALETTE COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Color Palettes",count)); performResponse(count,OscOutgoing.GET_COLOR_PALETTE_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_COLOR_PALETTE_COUNT,colorPaletteCountConsumer,true)); @@ -157,6 +177,7 @@ private void createCountListeners() { Consumer beamPaletteCountConsumer = message -> { //BEAM PALETTE COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Beam Palettes",count)); performResponse(count,OscOutgoing.GET_BEAM_PALETTE_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_BEAM_PALETTE_COUNT,beamPaletteCountConsumer,true)); @@ -164,6 +185,7 @@ private void createCountListeners() { Consumer curveCountConsumer = message -> { //CURVE COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Curves",count)); performResponse(count,OscOutgoing.GET_CURVE_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_CURVE_COUNT,curveCountConsumer,true)); @@ -171,6 +193,7 @@ private void createCountListeners() { Consumer effectCountConsumer = message -> { //EFFECT COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Effects",count)); performResponse(count,OscOutgoing.GET_EFFECT_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_EFFECT_COUNT,effectCountConsumer,true)); @@ -178,6 +201,7 @@ private void createCountListeners() { Consumer snapshotCountConsumer = message -> { //SNAPSHOT COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Snapshots",count)); performResponse(count,OscOutgoing.GET_SNAPSHOT_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_SNAPSHOT_COUNT,snapshotCountConsumer,true)); @@ -185,6 +209,7 @@ private void createCountListeners() { Consumer pixelmapCountConsumer = message -> { //PIXELMAP COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Pixelmaps",count)); performResponse(count,OscOutgoing.GET_PIXELMAP_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_PIXELMAP_COUNT,pixelmapCountConsumer,true)); @@ -192,6 +217,7 @@ private void createCountListeners() { Consumer magicSheetCountConsumer = message -> { //MAGIC SHEET COUNT CONSUMER List argList = message.getArguments(); int count = (Integer) argList.get(0); + photon.photonEventBus.post(new CountResponseEvent("Magic Sheets",count)); performResponse(count,OscOutgoing.GET_MAGIC_SHEET_INFO); }; listeners.add(new OscListener(photon,OscIncoming.RETURN_MAGIC_SHEET_COUNT,magicSheetCountConsumer,true)); diff --git a/photon/src/main/java/com/strikete/photon/utils/PhotonTypes.java b/photon/src/main/java/com/strikete/photon/utils/PhotonTypes.java new file mode 100644 index 0000000..d70c4ca --- /dev/null +++ b/photon/src/main/java/com/strikete/photon/utils/PhotonTypes.java @@ -0,0 +1,22 @@ +package com.strikete.photon.utils; + +public enum PhotonTypes { + + BEAM_PALETTE, + CHANNEL, + COLOR_PALETTE, + CUE, + CUELIST, + CURVE, + EFFECT, + FIXTURE, + FOCUS_PALETTE, + GROUP, + INTENSITY_PALETTE, + MACRO, + MAGIC_SHEET, + PIXELMAP, + PRESET, + SNAPSHOT, + SUB; +}