diff --git a/PlayWallCore/src/main/java/de/tobias/playpad/plugin/ModernPluginManager.java b/PlayWallCore/src/main/java/de/tobias/playpad/plugin/ModernPluginManager.java index 86c43e0334b7b16282832025ddd064b1fe18890c..3b4d46b736b63d24b97dde97dc4b16c5b80d9606 100644 --- a/PlayWallCore/src/main/java/de/tobias/playpad/plugin/ModernPluginManager.java +++ b/PlayWallCore/src/main/java/de/tobias/playpad/plugin/ModernPluginManager.java @@ -53,7 +53,6 @@ public class ModernPluginManager { if (Files.notExists(path)) { throw new IOException("File not found: " + path); } - loadFile(path); } public void loadFile(Path path) { diff --git a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/NativeAudio.java b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/NativeAudio.java deleted file mode 100644 index 02a96550a1897d625f2a276284b94f98bb8dccd4..0000000000000000000000000000000000000000 --- a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/NativeAudio.java +++ /dev/null @@ -1,62 +0,0 @@ -package de.tobias.playpad; - -public class NativeAudio { - - public static native void initialize(); - - public static native void play(int id); - - public static native void pause(int id); - - public static native void stop(int id); - - public static native void seek(int id, double duration); - - public static native void setLoop(int id, boolean loop); - - public static native double getVolume(int id); - - public static native void setVolume(int id, double volume); - - public static native boolean load(int id, String path); - - public static native void dispose(int id); - - public static native double getDuration(int id); - - public static native double getPosition(int id); - - public static native void setRate(int id, double rate); - - public static void onPeakMeter(int id, float left, float right) { - if (delegate != null) { - delegate.onPeakMeter(id, left, right); - } - } - - public static void onPositionChanged(int id, double position) { - if (delegate != null) { - delegate.onPositionChanged(id, position); - } - } - - public static void onFinish(int id) { - if (delegate != null) { - delegate.onFinish(id); - } - } - - private static NativeAudioDelegate delegate; - - public static void setDelegate(NativeAudioDelegate delegate) { - NativeAudio.delegate = delegate; - } - - public interface NativeAudioDelegate { - void onFinish(int id); - - void onPeakMeter(int id, float left, float right); - - void onPositionChanged(int id, double position); - } -} diff --git a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/AVAudioPlayerBridge.java b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/AVAudioPlayerBridge.java new file mode 100644 index 0000000000000000000000000000000000000000..10dfd45c3115c73d284249510433a10488b2fbca --- /dev/null +++ b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/AVAudioPlayerBridge.java @@ -0,0 +1,85 @@ +package de.tobias.playpad.audio.mac; + +public class AVAudioPlayerBridge { + + private long nativePointer; + + private long getNativePointer() { + return nativePointer; + } + + private void setNativePointer(long nativePointer) { + this.nativePointer = nativePointer; + } + + + static { + System.out.println("static init start"); + initialize(); + System.out.println("static init end"); + } + + private static native void initialize(); + + public AVAudioPlayerBridge() { + init(); + } + + private native void init(); + + public native void play(); + + public native void pause(); + + public native void stop(); + + public native void seek(double duration); + + public native void setLoop(boolean loop); + + public native double getVolume(); + + public native void setVolume(double volume); + + public native boolean load(String path); + + public native void dispose(); + + public native double getDuration(); + + public native double getPosition(); + + public native void setRate(double rate); + + public void onPeakMeter(float left, float right) { + if (delegate != null) { + delegate.onPeakMeter(this, left, right); + } + } + + public void onPositionChanged(double position) { + if (delegate != null) { + delegate.onPositionChanged(this, position); + } + } + + public void onFinish() { + if (delegate != null) { + delegate.onFinish(this); + } + } + + private static NativeAudioDelegate delegate; + + public static void setDelegate(NativeAudioDelegate delegate) { + AVAudioPlayerBridge.delegate = delegate; + } + + public interface NativeAudioDelegate { + void onFinish(AVAudioPlayerBridge bridge); + + void onPeakMeter(AVAudioPlayerBridge bridge, float left, float right); + + void onPositionChanged(AVAudioPlayerBridge bridge, double position); + } +} diff --git a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandler.java b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandler.java index 8b21e7ea5a05ed6a7f8bdf9f0b2f757519cded67..9a33317061549c6b3af503d6f21f7fd6218ce46a 100644 --- a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandler.java +++ b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandler.java @@ -1,7 +1,6 @@ package de.tobias.playpad.audio.mac; import de.thecodelabs.utils.threading.Worker; -import de.tobias.playpad.NativeAudio; import de.tobias.playpad.audio.AudioHandler; import de.tobias.playpad.audio.Peakable; import de.tobias.playpad.pad.PadStatus; @@ -15,9 +14,6 @@ import java.nio.file.Path; public class NativeAudioMacHandler extends AudioHandler implements Peakable, Seekable { - private static int counter = 0; - - private final int id; ObjectProperty<Duration> positionProperty; private ObjectProperty<Duration> durationProperty; private boolean isLoaded; @@ -25,10 +21,13 @@ public class NativeAudioMacHandler extends AudioHandler implements Peakable, See private DoubleProperty leftPeak; private DoubleProperty rightPeak; + private AVAudioPlayerBridge bridge; + NativeAudioMacHandler(PadContent content) { super(content); - id = counter++; + bridge = new AVAudioPlayerBridge(); + positionProperty = new SimpleObjectProperty<>(); durationProperty = new SimpleObjectProperty<>(); @@ -36,29 +35,29 @@ public class NativeAudioMacHandler extends AudioHandler implements Peakable, See rightPeak = new SimpleDoubleProperty(); } - int getId() { - return id; + AVAudioPlayerBridge getBridge() { + return bridge; } @Override public void play() { - NativeAudio.setLoop(id, getContent().getPad().getPadSettings().isLoop()); - NativeAudio.play(id); + bridge.setLoop(getContent().getPad().getPadSettings().isLoop()); + bridge.play(); } @Override public void pause() { - NativeAudio.pause(id); + bridge.pause(); } @Override public void stop() { - NativeAudio.stop(id); + bridge.stop(); } @Override public void seekToStart() { - NativeAudio.seek(id, 0); + bridge.seek(0); } @Override @@ -83,7 +82,7 @@ public class NativeAudioMacHandler extends AudioHandler implements Peakable, See @Override public void setVolume(double volume) { - NativeAudio.setVolume(id, volume); + bridge.setVolume(volume); } @Override @@ -95,11 +94,11 @@ public class NativeAudioMacHandler extends AudioHandler implements Peakable, See public void loadMedia(Path[] paths) { Worker.runLater(() -> { - isLoaded = NativeAudio.load(id, paths[0].toString()); + isLoaded = bridge.load(paths[0].toString()); if (isLoaded) { Platform.runLater(() -> { - durationProperty.set(Duration.seconds(NativeAudio.getDuration(id))); + durationProperty.set(Duration.seconds(bridge.getDuration())); getContent().getPad().setStatus(PadStatus.READY); if (getContent().getPad().isPadVisible()) { getContent().getPad().getController().getView().showBusyView(false); @@ -112,7 +111,7 @@ public class NativeAudioMacHandler extends AudioHandler implements Peakable, See @Override public void unloadMedia() { - NativeAudio.dispose(id); + bridge.dispose(); } @Override diff --git a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandlerFactory.java b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandlerFactory.java index a3331f5d0c2be0e796d90f618576efe1a0666c6a..45fd6cb2db9e71c85fa44e5682a631dbab02f9ed 100644 --- a/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandlerFactory.java +++ b/PlayWallPluginNativeAudio/src/main/java/de/tobias/playpad/audio/mac/NativeAudioMacHandlerFactory.java @@ -1,7 +1,6 @@ package de.tobias.playpad.audio.mac; -import de.tobias.playpad.NativeAudio; -import de.tobias.playpad.NativeAudio.NativeAudioDelegate; +import de.tobias.playpad.audio.mac.AVAudioPlayerBridge.NativeAudioDelegate; import de.tobias.playpad.audio.AudioCapability; import de.tobias.playpad.audio.AudioHandler; import de.tobias.playpad.audio.AudioHandlerFactory; @@ -11,51 +10,56 @@ import de.tobias.playpad.pad.content.PadContent; import de.tobias.playpad.viewcontroller.AudioHandlerViewController; import javafx.util.Duration; -import java.util.HashMap; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; public class NativeAudioMacHandlerFactory extends AudioHandlerFactory implements NativeAudioDelegate { - private static final HashMap<Integer, NativeAudioMacHandler> handlers = new HashMap<>(); + private List<NativeAudioMacHandler> handlers = new ArrayList<>(); + + private Optional<NativeAudioMacHandler> getHandlerByBridge(AVAudioPlayerBridge bridge) { + return handlers.stream().filter(handler -> handler.getBridge().equals(bridge)).findFirst(); + } public NativeAudioMacHandlerFactory(String type) { super(type); - NativeAudio.initialize(); - NativeAudio.setDelegate(this); + AVAudioPlayerBridge.setDelegate(this); } @Override public AudioHandler createAudioHandler(PadContent content) { NativeAudioMacHandler nativeAudioMacHandler = new NativeAudioMacHandler(content); - handlers.put(nativeAudioMacHandler.getId(), nativeAudioMacHandler); + handlers.add(nativeAudioMacHandler); return nativeAudioMacHandler; } @Override - public void onFinish(int id) { - NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id); - if (nativeAudioMacHandler != null) { - PadContent content = nativeAudioMacHandler.getContent(); + public void onFinish(AVAudioPlayerBridge bridge) { + Optional<NativeAudioMacHandler> nativeAudioMacHandler = getHandlerByBridge(bridge); + nativeAudioMacHandler.ifPresent(handler -> { + PadContent content = handler.getContent(); if (content != null) { content.getPad().setStatus(PadStatus.STOP); } - } + }); } @Override - public void onPositionChanged(int id, double position) { - NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id); - if (nativeAudioMacHandler != null) { - nativeAudioMacHandler.positionProperty.set(Duration.seconds(position)); - } + public void onPositionChanged(AVAudioPlayerBridge bridge, double position) { + Optional<NativeAudioMacHandler> nativeAudioMacHandler = getHandlerByBridge(bridge); + nativeAudioMacHandler.ifPresent(audioMacHandler -> { + audioMacHandler.positionProperty.set(Duration.seconds(position)); + }); } @Override - public void onPeakMeter(int id, float left, float right) { - NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id); - if (nativeAudioMacHandler != null) { - nativeAudioMacHandler.audioLevelProperty(Channel.LEFT).set(left); - nativeAudioMacHandler.audioLevelProperty(Channel.RIGHT).set(right); - } + public void onPeakMeter(AVAudioPlayerBridge bridge, float left, float right) { + Optional<NativeAudioMacHandler> nativeAudioMacHandler = getHandlerByBridge(bridge); + nativeAudioMacHandler.ifPresent(handler -> { + handler.audioLevelProperty(Channel.LEFT).set(left); + handler.audioLevelProperty(Channel.RIGHT).set(right); + }); } @Override diff --git a/PlayWallPluginNativeAudio/src/main/java/de_tobias_playpad_NativeAudio.h b/PlayWallPluginNativeAudio/src/main/java/de_tobias_playpad_NativeAudio.h deleted file mode 100644 index 8fc9cbeafba845527ae8224317934e7bd364ff9b..0000000000000000000000000000000000000000 --- a/PlayWallPluginNativeAudio/src/main/java/de_tobias_playpad_NativeAudio.h +++ /dev/null @@ -1,117 +0,0 @@ -/* DO NOT EDIT THIS FILE - it is machine generated */ -#include <jni.h> -/* Header for class de_tobias_playpad_NativeAudio */ - -#ifndef _Included_de_tobias_playpad_NativeAudio -#define _Included_de_tobias_playpad_NativeAudio -#ifdef __cplusplus -extern "C" { -#endif -/* - * Class: de_tobias_playpad_NativeAudio - * Method: initialize - * Signature: ()V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_initialize - (JNIEnv *, jclass); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: play - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_play - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: pause - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_pause - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: stop - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_stop - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: seek - * Signature: (ID)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_seek - (JNIEnv *, jclass, jint, jdouble); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: setLoop - * Signature: (IZ)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_setLoop - (JNIEnv *, jclass, jint, jboolean); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: getVolume - * Signature: (I)D - */ -JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_NativeAudio_getVolume - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: setVolume - * Signature: (ID)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_setVolume - (JNIEnv *, jclass, jint, jdouble); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: load - * Signature: (ILjava/lang/String;)Z - */ -JNIEXPORT jboolean JNICALL Java_de_tobias_playpad_NativeAudio_load - (JNIEnv *, jclass, jint, jstring); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: dispose - * Signature: (I)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_dispose - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: getDuration - * Signature: (I)D - */ -JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_NativeAudio_getDuration - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: getPosition - * Signature: (I)D - */ -JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_NativeAudio_getPosition - (JNIEnv *, jclass, jint); - -/* - * Class: de_tobias_playpad_NativeAudio - * Method: setRate - * Signature: (ID)V - */ -JNIEXPORT void JNICALL Java_de_tobias_playpad_NativeAudio_setRate - (JNIEnv *, jclass, jint, jdouble); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/PlayWallPluginNativeAudio/src/main/java/de_tobias_playpad_audio_mac_AVAudioPlayerBridge.h b/PlayWallPluginNativeAudio/src/main/java/de_tobias_playpad_audio_mac_AVAudioPlayerBridge.h new file mode 100644 index 0000000000000000000000000000000000000000..755158d75fa147d5222abf4134764a19bad7ad64 --- /dev/null +++ b/PlayWallPluginNativeAudio/src/main/java/de_tobias_playpad_audio_mac_AVAudioPlayerBridge.h @@ -0,0 +1,125 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class de_tobias_playpad_audio_mac_AVAudioPlayerBridge */ + +#ifndef _Included_de_tobias_playpad_audio_mac_AVAudioPlayerBridge +#define _Included_de_tobias_playpad_audio_mac_AVAudioPlayerBridge +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: initialize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_initialize + (JNIEnv *, jclass); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: init + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_init + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: play + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_play + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: pause + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_pause + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: stop + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_stop + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: seek + * Signature: (D)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_seek + (JNIEnv *, jobject, jdouble); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: setLoop + * Signature: (Z)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_setLoop + (JNIEnv *, jobject, jboolean); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: getVolume + * Signature: ()D + */ +JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_getVolume + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: setVolume + * Signature: (D)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_setVolume + (JNIEnv *, jobject, jdouble); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: load + * Signature: (Ljava/lang/String;)Z + */ +JNIEXPORT jboolean JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_load + (JNIEnv *, jobject, jstring); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: dispose + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_dispose + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: getDuration + * Signature: ()D + */ +JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_getDuration + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: getPosition + * Signature: ()D + */ +JNIEXPORT jdouble JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_getPosition + (JNIEnv *, jobject); + +/* + * Class: de_tobias_playpad_audio_mac_AVAudioPlayerBridge + * Method: setRate + * Signature: (D)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_audio_mac_AVAudioPlayerBridge_setRate + (JNIEnv *, jobject, jdouble); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/PlayWallPluginNativeAudio/src/main/resources/mac/libNativeAudio.dylib b/PlayWallPluginNativeAudio/src/main/resources/mac/libNativeAudio.dylib index a43034c35b242f6dea535e34e3ff888df27d31d6..262f9b8506783c5ed2d22ce93436bb63a0df1bf7 100755 Binary files a/PlayWallPluginNativeAudio/src/main/resources/mac/libNativeAudio.dylib and b/PlayWallPluginNativeAudio/src/main/resources/mac/libNativeAudio.dylib differ diff --git a/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/NativeAudioPluginImpl.scala b/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/NativeAudioPluginImpl.scala index b0f1c648759287bc3bc0dca996c058ac14995dee..470aba79e624b0311d5b37eeac0ddc12ecf97184 100644 --- a/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/NativeAudioPluginImpl.scala +++ b/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/NativeAudioPluginImpl.scala @@ -10,7 +10,7 @@ import de.tobias.playpad.plugin.loader.{MacAudioImplLoader, WindowsAudioImplLoad */ class NativeAudioPluginImpl extends PlayPadPluginStub with PluginArtifact { - private val NAME = "NativeAudioMac" + private val NAME = "NativeAudio" private val IDENTIFIER = "de.tobias.playwall.plugin.nativeaudio" private var module: Module = _ diff --git a/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/loader/WindowsAudioImplLoader.scala b/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/loader/WindowsAudioImplLoader.scala index f490fb40b11bc5337283adb1cca6411c28ff4a83..ee51382340b07af89bd772bd080f21cd2c4e8f51 100644 --- a/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/loader/WindowsAudioImplLoader.scala +++ b/PlayWallPluginNativeAudio/src/main/scala/de/tobias/playpad/plugin/loader/WindowsAudioImplLoader.scala @@ -14,6 +14,17 @@ import net.sf.jni4net.Bridge */ class WindowsAudioImplLoader extends AudioModuleLoader { + val resources = Array( + "jni4net.j-0.8.8.0.jar", + "jni4net.n-0.8.8.0.dll", + "jni4net.n.w32.v40-0.8.8.0.dll", + "jni4net.n.w64.v40-0.8.8.0.dll", + "NativeAudio.dll", + "NativeAudio.j4n.dll", + "NativeAudio.j4n.jar", + "NAudio.dll" + ) + private val ASSETS = "win/" override def preInit(): Unit = { @@ -23,19 +34,13 @@ class WindowsAudioImplLoader extends AudioModuleLoader { if (!app.isDebug) { if (Files.notExists(resourceFolder)) Files.createDirectories(resourceFolder) - copyResource(resourceFolder, ASSETS, "jni4net.j-0.8.8.0.jar") - copyResource(resourceFolder, ASSETS, "jni4net.n-0.8.8.0.dll") - copyResource(resourceFolder, ASSETS, "jni4net.n.w32.v40-0.8.8.0.dll") - copyResource(resourceFolder, ASSETS, "jni4net.n.w64.v40-0.8.8.0.dll") - copyResource(resourceFolder, ASSETS, "NativeAudio.dll") - copyResource(resourceFolder, ASSETS, "NativeAudio.j4n.dll") - copyResource(resourceFolder, ASSETS, "NativeAudio.j4n.jar") - copyResource(resourceFolder, ASSETS, "NAudio.dll") + + resources.foreach(copyResource(resourceFolder, ASSETS, _)) } - Bridge.setVerbose(app isDebug) - Bridge.init(resourceFolder toFile) - Bridge.LoadAndRegisterAssemblyFrom(resourceFolder.resolve("NativeAudio.j4n.dll") toFile) + Bridge.setVerbose(app.isDebug) + Bridge.init(resourceFolder.toFile) + Bridge.LoadAndRegisterAssemblyFrom(resourceFolder.resolve("NativeAudio.j4n.dll").toFile) } override def init(module: Module): Unit = {