diff --git a/application/build.xml b/application/build.xml index 50f76df3..b203a70d 100644 --- a/application/build.xml +++ b/application/build.xml @@ -7,16 +7,16 @@ - + + value="OpenJDK22U-jdk_x64_windows_hotspot_22.0.2_9.zip"/> + value="OpenJDK22U-jdk_aarch64_mac_hotspot_2.0.2_9.tar.gz"/> + value="OpenJDK22U-jdk_x64_mac_hotspot_22.0.2_9.tar.gz"/> diff --git a/blue-csnd6/pom.xml b/blue-csnd6/pom.xml index 394a9ac6..abafec35 100755 --- a/blue-csnd6/pom.xml +++ b/blue-csnd6/pom.xml @@ -88,10 +88,17 @@ com.kunstmusik - CsoundJNI - 1.0.6 + csoundffm + 1.0.0-SNAPSHOT + + + github + GitHub kunstmusik Apache Maven Packages + https://maven.pkg.github.com/kunstmusik/CsoundFFM + + UTF-8 diff --git a/blue-csnd6/src/main/java/blue/csnd6/render/API6Utilities.java b/blue-csnd6/src/main/java/blue/csnd6/render/API6Utilities.java index 2ead6c6b..d4af2525 100644 --- a/blue-csnd6/src/main/java/blue/csnd6/render/API6Utilities.java +++ b/blue-csnd6/src/main/java/blue/csnd6/render/API6Utilities.java @@ -4,7 +4,7 @@ */ package blue.csnd6.render; -import com.kunstmusik.csoundjni.CsoundJNI; +import com.kunstmusik.csoundffm.Csound; /** * @@ -24,8 +24,9 @@ public static boolean isCsoundAPIAvailable() { apiAvailable = false; } else { try { - CsoundJNI.csoundInitialize(CsoundJNI.CSOUNDINIT_NO_ATEXIT | - CsoundJNI.CSOUNDINIT_NO_SIGNAL_HANDLER); + System.out.println("Csound Version Found: " + Csound.getVersion()); +// CsoundJNI.csoundInitialize(CsoundJNI.CSOUNDINIT_NO_ATEXIT | +// CsoundJNI.CSOUNDINIT_NO_SIGNAL_HANDLER); // System.loadLibrary("_jcsound6"); // csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT | // csnd6.CSOUNDINIT_NO_SIGNAL_HANDLER); diff --git a/blue-csnd6/src/main/java/blue/csnd6/render/BlueCallbackWrapper.java b/blue-csnd6/src/main/java/blue/csnd6/render/BlueCallbackWrapper.java index 2cfd4cde..e6e54d68 100644 --- a/blue-csnd6/src/main/java/blue/csnd6/render/BlueCallbackWrapper.java +++ b/blue-csnd6/src/main/java/blue/csnd6/render/BlueCallbackWrapper.java @@ -1,7 +1,8 @@ package blue.csnd6.render; -import com.kunstmusik.csoundjni.MessageCallback; +import com.kunstmusik.csoundffm.MessageCallback; import java.io.IOException; +import java.lang.foreign.MemorySegment; import org.openide.util.Exceptions; import org.openide.windows.InputOutput; @@ -30,14 +31,17 @@ public void setStringBuffer(StringBuilder buffer) { } @Override - public void callback(int attr, String msg) { + public void callback(MemorySegment csound, int attr, MemorySegment msg) { + + String msgText = msg.reinterpret(Integer.MAX_VALUE).getString(0); + if (buffer != null) { - buffer.append(msg); + buffer.append(msgText); } else if (io == null) { - System.out.print(msg); + System.out.print(msgText); System.out.flush(); } else { - io.getOut().append(msg); + io.getOut().append(msgText); } } } diff --git a/blue-csnd6/src/main/java/blue/csnd6/render/CS6DiskRendererService.java b/blue-csnd6/src/main/java/blue/csnd6/render/CS6DiskRendererService.java index 52f0df95..dc7be547 100644 --- a/blue-csnd6/src/main/java/blue/csnd6/render/CS6DiskRendererService.java +++ b/blue-csnd6/src/main/java/blue/csnd6/render/CS6DiskRendererService.java @@ -9,24 +9,8 @@ import blue.automation.Parameter; import blue.event.PlayModeListener; -import blue.score.ScoreGenerationException; -import blue.services.render.CSDRenderService; -import blue.services.render.CsdRenderResult; -import blue.services.render.DiskRenderJob; -import blue.services.render.DiskRenderService; -import blue.services.render.RenderTimeManager; -import blue.settings.PlaybackSettings; import blue.time.TempoMap; -import blue.utility.FileUtilities; -import com.kunstmusik.csoundjni.Csound; -import java.awt.Color; -import java.io.IOException; -import org.openide.util.Exceptions; -import org.openide.util.Lookup; -import org.openide.windows.IOColors; -import org.openide.windows.IOProvider; -import org.openide.windows.InputOutput; import blue.score.ScoreGenerationException; import blue.services.render.CSDRenderService; import blue.services.render.CsdRenderResult; @@ -35,7 +19,7 @@ import blue.services.render.RenderTimeManager; import blue.settings.PlaybackSettings; import blue.utility.FileUtilities; -import com.kunstmusik.csoundjni.Csound; +import com.kunstmusik.csoundffm.Csound; import java.awt.Color; import java.io.IOException; import org.openide.util.Exceptions; diff --git a/blue-csnd6/src/main/java/blue/csnd6/render/CS6RealtimeRenderService.java b/blue-csnd6/src/main/java/blue/csnd6/render/CS6RealtimeRenderService.java index 4e786435..21929453 100644 --- a/blue-csnd6/src/main/java/blue/csnd6/render/CS6RealtimeRenderService.java +++ b/blue-csnd6/src/main/java/blue/csnd6/render/CS6RealtimeRenderService.java @@ -6,7 +6,6 @@ import blue.services.render.CsdRenderResult; import blue.BlueData; -//import blue.BlueMainFrame; import blue.BlueSystem; import blue.LiveData; import blue.automation.Parameter; @@ -23,12 +22,14 @@ import blue.time.TempoMap; import blue.utility.FileUtilities; import blue.utility.TextUtilities; -import com.kunstmusik.csoundjni.Csound; +import com.kunstmusik.csoundffm.Csound; import java.awt.BorderLayout; import java.awt.Color; import java.io.File; import java.io.IOException; -import java.nio.DoubleBuffer; +import java.lang.foreign.MemorySegment; +import java.lang.foreign.ValueLayout; +import static java.lang.foreign.ValueLayout.JAVA_DOUBLE; import java.util.ArrayList; import java.util.Arrays; import java.util.Iterator; @@ -66,8 +67,6 @@ public class CS6RealtimeRenderService implements RealtimeRenderService, PlayMode private Csound csound; public CS6RealtimeRenderService() { -// csnd6.csoundInitialize(csnd6.CSOUNDINIT_NO_ATEXIT -// | csnd6.CSOUNDINIT_NO_SIGNAL_HANDLER); } @Override @@ -156,7 +155,6 @@ public void play(BlueData blueData, CsdRenderResult result, csound.stop(); csound.cleanup(); csound.setMessageCallback(null); - csound.delete(); csound = null; blueCallbackWrapper = null; return; @@ -403,7 +401,7 @@ static class APIRunnerThread implements Runnable { private double startTime; private BlueData blueData; private double[] valuesCache; - private DoubleBuffer[] channelPtrCache; + private MemorySegment[] channelPtrCache; public boolean isRunning = true; CountDownLatch latch = new CountDownLatch(1); private final List bindings; @@ -547,7 +545,7 @@ public void run() { if (value != valuesCache[i]) { valuesCache[i] = value; - channelPtrCache[i].put(0, value); + channelPtrCache[i].set(ValueLayout.JAVA_DOUBLE, 0, value); } } @@ -581,7 +579,6 @@ public void run() { csound.stop(); csound.cleanup(); csound.setMessageCallback(null); - csound.delete(); if (renderUpdatesTime) { manager.endRender(); @@ -598,7 +595,7 @@ private void createValuesCache(double currentTime) { final int size = parameters.size(); valuesCache = new double[size]; - channelPtrCache = new DoubleBuffer[size]; + channelPtrCache = new MemorySegment[size]; for (int i = 0; i < size; i++) { param = (Parameter) parameters.get(i); @@ -612,7 +609,7 @@ private void createValuesCache(double currentTime) { } channelPtrCache[i] = csound.getControlChannelPtr(varName); - channelPtrCache[i].put(0, valuesCache[i]); + channelPtrCache[i].set(JAVA_DOUBLE, 0, valuesCache[i]); } } } diff --git a/pom.xml b/pom.xml index 221267a4..0a47672d 100755 --- a/pom.xml +++ b/pom.xml @@ -16,7 +16,7 @@ org.apache.netbeans.utilities nbm-maven-plugin - 4.8 + 14.1 true ${brandingToken}