|
1 | 1 | package com.novation.launchpadProMk3; |
2 | 2 |
|
3 | 3 | import com.bitwig.extension.api.opensoundcontrol.OscConnection; |
| 4 | +import com.bitwig.extension.api.opensoundcontrol.OscInvalidArgumentTypeException; |
4 | 5 | import com.bitwig.extension.api.util.midi.ShortMidiMessage; |
5 | 6 | import com.bitwig.extension.callback.ShortMidiMessageReceivedCallback; |
6 | 7 | import com.bitwig.extension.controller.ControllerExtension; |
|
9 | 10 | import com.bitwig.extensions.framework.Layer; |
10 | 11 | import com.bitwig.extensions.framework.Layers; |
11 | 12 |
|
| 13 | +import java.io.IOException; |
12 | 14 | import java.util.ArrayList; |
13 | 15 | import java.util.List; |
14 | 16 | import java.util.concurrent.CompletableFuture; |
@@ -70,13 +72,40 @@ public void init() { |
70 | 72 | midiIn.setMidiCallback((ShortMidiMessageReceivedCallback) this::onMidi0); |
71 | 73 | midiOut = host.getMidiOutPort(0); |
72 | 74 |
|
73 | | - SettableBooleanValue SendOSC = host.getPreferences().getBooleanSetting("Send OSC", "OSC", false); |
| 75 | + Preferences prefs = host.getPreferences(); |
| 76 | + SettableRangedValue OscPortSetting = prefs.getNumberSetting("Port", "OSC", 8000, 100000, 1, "", 12345); |
| 77 | + SettableStringValue OscAddressSetting = prefs.getStringSetting("Address", "OSC", 15, "10.0.0.255"); |
| 78 | + Signal SignalTest = prefs.getSignalSetting("Send Message", "OSC", "Test"); |
| 79 | + SettableBooleanValue SendOSC = prefs.getBooleanSetting("Send OSC", "OSC", false); |
| 80 | + |
74 | 81 | if (SendOSC.get() == true) { |
75 | | - gridOSCconnection = host.getOscModule().connectToUdpServer("255.255.255.255", 12345, |
| 82 | + gridOSCconnection = host.getOscModule().connectToUdpServer(OscAddressSetting.get(), |
| 83 | + (int) OscPortSetting.getRaw(), |
76 | 84 | host.getOscModule().createAddressSpace()); |
77 | 85 | } else { |
78 | 86 | gridOSCconnection = null; |
79 | 87 | } |
| 88 | + |
| 89 | + Object testArg = "sending!"; |
| 90 | + // connection.startBundle(); |
| 91 | + try { |
| 92 | + gridOSCconnection.sendMessage("/RHBitwig", testArg); |
| 93 | + } catch (IOException e) { |
| 94 | + // throw new RuntimeException(e); |
| 95 | + host.println("No Connection!!"); |
| 96 | + } |
| 97 | + |
| 98 | + SignalTest.addSignalObserver(() -> { |
| 99 | + Object o = "1"; |
| 100 | + try { |
| 101 | + gridOSCconnection.sendMessage("Bitwig Test Message", o); |
| 102 | + } catch (IOException e) { |
| 103 | + // throw new RuntimeException(e); |
| 104 | + host.println("No Connection!!"); |
| 105 | + } |
| 106 | + }); |
| 107 | + |
| 108 | + |
80 | 109 |
|
81 | 110 | noteInput = midiIn.createNoteInput("MIDI", "80????", "90????", "A0????", "D0????"); |
82 | 111 | noteInput.setShouldConsumeEvents(false); |
|
0 commit comments