diff --git a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties index 0a16dc0489b4bb8d7d1f4db417a9b850e0695c64..79621f247fa770a2d6dcdae88b077d9fdf51bb1b 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties +++ b/PlayWall/assets/de/tobias/playpad/assets/lang/_de.properties @@ -289,4 +289,8 @@ Tooltip.Page.LeftMove=Nach links verschieben Tooltip.Page.RightMove=Nach rechts verschieben Tooltip.Page.Rename=Umbenennen Tooltip.Page.Clone=Duplizieren -Tooltip.Page.Delete=L�schen \ No newline at end of file +Tooltip.Page.Delete=L�schen + +# Audio Features +EQUALIZER=Equalizer: +SOUNDCARD=Soundkarte: \ No newline at end of file diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/audio/tinySoundSettings.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/audio/tinySoundSettings.fxml index dec8adcf9d311f4a8d8c9ab7b27f9fe00a685994..3bc628651c3be6d86bd71a62dc915fa7b1d6f0fd 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/view/audio/tinySoundSettings.fxml +++ b/PlayWall/assets/de/tobias/playpad/assets/view/audio/tinySoundSettings.fxml @@ -1,13 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> -<?import javafx.scene.control.*?> <?import java.lang.*?> +<?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> - <HBox spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children> - <Label alignment="CENTER_RIGHT" layoutX="14.0" layoutY="19.0" maxHeight="1.7976931348623157E308" prefWidth="150.0" text="%tinysound.label.soundcard" /> <ComboBox fx:id="soundCardComboBox" layoutX="118.0" layoutY="14.0" prefHeight="26.0" prefWidth="241.0" /> <Button fx:id="testButton" layoutX="372.0" layoutY="14.0" mnemonicParsing="false" onAction="#testButtonHandler" /> </children> diff --git a/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/audioTab.fxml b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/audioTab.fxml index 86cb23c1f4f1362e39a0d79c5b87ea3147c51acd..4bd1254fc09e075952d7c577831c15a24d046fe2 100644 --- a/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/audioTab.fxml +++ b/PlayWall/assets/de/tobias/playpad/assets/view/option/profile/audioTab.fxml @@ -1,10 +1,11 @@ <?xml version="1.0" encoding="UTF-8"?> +<?import javafx.geometry.*?> <?import java.lang.*?> <?import javafx.scene.control.*?> <?import javafx.scene.layout.*?> -<AnchorPane xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> +<VBox spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> <children> <HBox layoutX="14.0" layoutY="14.0" spacing="14.0"> <children> @@ -12,6 +13,9 @@ <ComboBox fx:id="audioTypeComboBox" layoutX="156.0" layoutY="14.0" prefHeight="26.0" prefWidth="226.0" /> </children> </HBox> - <AnchorPane fx:id="audioUserInfoSettings" layoutX="14.0" layoutY="53.0" prefHeight="312.0" prefWidth="617.0" AnchorPane.bottomAnchor="14.0" AnchorPane.leftAnchor="14.0" AnchorPane.rightAnchor="14.0" AnchorPane.topAnchor="53.0" /> + <VBox fx:id="options" prefHeight="200.0" prefWidth="100.0" spacing="14.0" /> </children> -</AnchorPane> + <padding> + <Insets bottom="14.0" left="14.0" right="14.0" top="14.0" /> + </padding> +</VBox> diff --git a/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandlerConnect.java b/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandlerConnect.java index bb004a440ff00caa12fc400a3ab4fb9f44cdb2eb..24e5ee44d90437d47c5a133b015ace6cb4f23757 100644 --- a/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandlerConnect.java +++ b/PlayWall/src/de/tobias/playpad/audio/ClipAudioHandlerConnect.java @@ -23,7 +23,20 @@ public class ClipAudioHandlerConnect extends AudioHandlerConnect implements Auto @Override public void close() throws Exception { - TinyAudioHandler.shutdown(); + ClipAudioHandler.shutdown(); } + @Override + public boolean isFeatureAvaiable(AudioCapability audioCapability) { + for (Class<?> clazz : ClipAudioHandler.class.getInterfaces()) { + if (clazz.equals(audioCapability.getAudioFeature())) + return true; + } + return false; + } + + @Override + public AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility) { + return null; + } } diff --git a/PlayWall/src/de/tobias/playpad/audio/JavaFXHandlerConnect.java b/PlayWall/src/de/tobias/playpad/audio/JavaFXHandlerConnect.java index baca001b6e97120e49f96f5bde06800138aded15..fb63c182d18ddb891dc3b55d9892f46954c49aa0 100644 --- a/PlayWall/src/de/tobias/playpad/audio/JavaFXHandlerConnect.java +++ b/PlayWall/src/de/tobias/playpad/audio/JavaFXHandlerConnect.java @@ -19,4 +19,18 @@ public class JavaFXHandlerConnect extends AudioHandlerConnect { public String getType() { return JavaFXAudioHandler.TYPE; } + + @Override + public boolean isFeatureAvaiable(AudioCapability audioCapability) { + for (Class<?> clazz : JavaFXAudioHandler.class.getInterfaces()) { + if (clazz.equals(audioCapability.getAudioFeature())) + return true; + } + return false; + } + + @Override + public AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility) { + return null; + } } diff --git a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java index af2517a0048ecf80ced4686990eb09bd8edf477e..8e8e8d163388f59d0c83e044316b52fddb7eb3d6 100644 --- a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java +++ b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandler.java @@ -38,7 +38,7 @@ import javazoom.jl.decoder.JavaLayerException; import kuusisto.tinysound.Music; import kuusisto.tinysound.TinySound; -public class TinyAudioHandler extends AudioHandler { +public class TinyAudioHandler extends AudioHandler implements Soundcardable { public static final String SOUND_CARD = "SoundCard"; @@ -212,7 +212,8 @@ public class TinyAudioHandler extends AudioHandler { @Override public void loadMedia(Path[] paths) { - initTinySound(); + String audioCardName = (String) Profile.currentProfile().getProfileSettings().getAudioUserInfo().get(SOUND_CARD); + initTinySound(audioCardName); unloadMedia(); Platform.runLater(() -> @@ -296,9 +297,7 @@ public class TinyAudioHandler extends AudioHandler { private static String audioCardName; - private void initTinySound() { - String audioCardName = (String) Profile.currentProfile().getProfileSettings().getAudioUserInfo().get(SOUND_CARD); - + private void initTinySound(String audioCardName) { if (TinyAudioHandler.audioCardName != null) { if (!TinyAudioHandler.audioCardName.equals(audioCardName)) { TinySound.shutdown(); @@ -332,4 +331,9 @@ public class TinyAudioHandler extends AudioHandler { executorService.shutdown(); positionThread.interrupt(); } + + @Override + public void setOutputDevice(String name) { + initTinySound(name); + } } diff --git a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandlerConnect.java b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandlerConnect.java index cf8388f1f83557cf8c9ab87b7a84c2faca1de8ee..af7bc01e9e2ffdd0281f2649c737d44fc323033f 100644 --- a/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandlerConnect.java +++ b/PlayWall/src/de/tobias/playpad/audio/TinyAudioHandlerConnect.java @@ -25,4 +25,21 @@ public class TinyAudioHandlerConnect extends AudioHandlerConnect implements Auto public void close() throws Exception { TinyAudioHandler.shutdown(); } + + @Override + public boolean isFeatureAvaiable(AudioCapability audioCapability) { + for (Class<?> clazz : TinyAudioHandler.class.getInterfaces()) { + if (clazz.equals(audioCapability.getAudioFeature())) + return true; + } + return false; + } + + @Override + public AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility) { + if (audioCapablility == AudioCapability.SOUNDCARD) { + return new TinySoundSettingsViewController(); + } + return null; + } } diff --git a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java index e83f9a002ea0c3e33e757e3d006526d0b062a5b4..d577a3a3313f4ecf2c82e5cddd2fb56fb7543e9b 100644 --- a/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java +++ b/PlayWall/src/de/tobias/playpad/viewcontroller/option/profile/AudioTabViewController.java @@ -1,8 +1,13 @@ package de.tobias.playpad.viewcontroller.option.profile; +import java.util.ArrayList; +import java.util.List; + import de.tobias.playpad.PlayPadMain; import de.tobias.playpad.PlayPadPlugin; import de.tobias.playpad.Strings; +import de.tobias.playpad.audio.AudioCapability; +import de.tobias.playpad.audio.AudioHandlerConnect; import de.tobias.playpad.audio.AudioRegistry; import de.tobias.playpad.project.Project; import de.tobias.playpad.registry.NoSuchComponentException; @@ -12,18 +17,25 @@ import de.tobias.playpad.viewcontroller.AudioHandlerViewController; import de.tobias.playpad.viewcontroller.main.IMainViewController; import de.tobias.playpad.viewcontroller.option.IProfileReloadTask; import de.tobias.playpad.viewcontroller.option.ProfileSettingsTabViewController; +import de.tobias.utils.ui.icon.FontAwesomeType; +import de.tobias.utils.ui.icon.FontIcon; import de.tobias.utils.util.Localization; import javafx.concurrent.Task; import javafx.fxml.FXML; +import javafx.geometry.Pos; +import javafx.scene.Parent; import javafx.scene.control.ComboBox; -import javafx.scene.layout.AnchorPane; +import javafx.scene.control.Label; +import javafx.scene.layout.HBox; +import javafx.scene.layout.VBox; public class AudioTabViewController extends ProfileSettingsTabViewController implements IProfileReloadTask { // Audio @FXML private ComboBox<String> audioTypeComboBox; - @FXML private AnchorPane audioUserInfoSettings; - private AudioHandlerViewController audioViewController; + @FXML private VBox options; + + private List<AudioHandlerViewController> audioViewController; private boolean changeAudioSettings; public AudioTabViewController(boolean playerActive) { @@ -31,12 +43,14 @@ public class AudioTabViewController extends ProfileSettingsTabViewController imp if (playerActive) { audioTypeComboBox.setDisable(true); - audioUserInfoSettings.setDisable(true); + options.setDisable(true); } } @Override public void init() { + audioViewController = new ArrayList<>(); + ProfileSettings profileSettings = Profile.currentProfile().getProfileSettings(); // Audio Classes @@ -44,8 +58,7 @@ public class AudioTabViewController extends ProfileSettingsTabViewController imp audioTypeComboBox.getItems().addAll(audioHandlerRegistry.getTypes()); // Listener for selection - audioTypeComboBox.getSelectionModel().selectedItemProperty().addListener((a, b, c) -> - { + audioTypeComboBox.getSelectionModel().selectedItemProperty().addListener((a, b, c) -> { if (b != null && c != null) changeAudioSettings = true; showAudioSettings(c); @@ -55,26 +68,55 @@ public class AudioTabViewController extends ProfileSettingsTabViewController imp private void showAudioSettings(String classID) { if (audioViewController != null) { - if (audioViewController.isChanged()) { + // Es gibt ein Settings View Controller der isChanged true ist + if (audioViewController.stream().filter(c -> c.isChanged()).count() > 0) { changeAudioSettings = true; } } - audioUserInfoSettings.getChildren().clear(); + options.getChildren().clear(); + AudioRegistry audioHandlerRegistry = PlayPadPlugin.getRegistryCollection().getAudioHandlers(); try { - AudioRegistry audioHandlerRegistry = PlayPadPlugin.getRegistryCollection().getAudioHandlers(); - audioViewController = audioHandlerRegistry.getComponent(classID).getAudioHandlerSettingsViewController(); + AudioHandlerConnect audio = audioHandlerRegistry.getComponent(classID); - if (audioViewController != null) { - audioUserInfoSettings.getChildren().add(audioViewController.getParent()); + for (AudioCapability audioCapability : AudioCapability.getFeatures()) { + options.getChildren().add(createCapabilityView(audio, audioCapability)); } } catch (NoSuchComponentException e) { e.printStackTrace(); - // TODO Errorhandling } } + private Parent createCapabilityView(AudioHandlerConnect audio, AudioCapability audioCapability) { + HBox masterView = new HBox(14); + VBox detailView = new VBox(14); + + Label nameLabel = new Label(Localization.getString(audioCapability.getName())); + nameLabel.setAlignment(Pos.CENTER_RIGHT); + nameLabel.setMinWidth(150); + + AudioHandlerViewController settingsViewController = null; + + Label availableLabel; + if (audio.isFeatureAvaiable(audioCapability)) { + availableLabel = new FontIcon(FontAwesomeType.CHECK); + + settingsViewController = audio.getAudioFeatureSettings(audioCapability); + } else { + availableLabel = new FontIcon(FontAwesomeType.TIMES); + } + + detailView.getChildren().add(availableLabel); + if (settingsViewController != null) { + detailView.getChildren().add(settingsViewController.getParent()); + audioViewController.add(settingsViewController); + } + + masterView.getChildren().addAll(nameLabel, detailView); + return masterView; + } + @Override public void loadSettings(Profile profile) { ProfileSettings profileSettings = profile.getProfileSettings(); @@ -93,10 +135,8 @@ public class AudioTabViewController extends ProfileSettingsTabViewController imp @Override public boolean needReload() { - if (audioViewController != null) { - if (audioViewController.isChanged()) { - changeAudioSettings = true; - } + if (audioViewController.stream().filter(c -> c.isChanged()).count() > 0) { + changeAudioSettings = true; } return changeAudioSettings; } @@ -104,6 +144,7 @@ public class AudioTabViewController extends ProfileSettingsTabViewController imp @Override public Task<Void> getTask(ProfileSettings settings, Project project, IMainViewController controller) { return new Task<Void>() { + @Override protected Void call() throws Exception { updateTitle(name()); diff --git a/PlayWallCore/src/de/tobias/playpad/audio/AudioCapability.java b/PlayWallCore/src/de/tobias/playpad/audio/AudioCapability.java new file mode 100644 index 0000000000000000000000000000000000000000..125317608174802768a73a3565090b5027fffc16 --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/audio/AudioCapability.java @@ -0,0 +1,27 @@ +package de.tobias.playpad.audio; + +public class AudioCapability { + + public static final AudioCapability EQUALIZER = new AudioCapability("EQUALIZER", Equalizable.class); + public static final AudioCapability SOUNDCARD = new AudioCapability("SOUNDCARD", Soundcardable.class); + + private String name; + private Class<? extends AudioFeature> clazz; + + private AudioCapability(String name, Class<? extends AudioFeature> clazz) { + this.name = name; + this.clazz = clazz; + } + + public String getName() { + return name; + } + + public Class<? extends AudioFeature> getAudioFeature() { + return clazz; + } + + public static AudioCapability[] getFeatures() { + return new AudioCapability[] { EQUALIZER, SOUNDCARD }; + } +} diff --git a/PlayWallCore/src/de/tobias/playpad/audio/AudioFeature.java b/PlayWallCore/src/de/tobias/playpad/audio/AudioFeature.java new file mode 100644 index 0000000000000000000000000000000000000000..7805f9ffc202c94465606069b8aed99580ecc556 --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/audio/AudioFeature.java @@ -0,0 +1,11 @@ +package de.tobias.playpad.audio; + +/** + * Flag für Audiofeature + * + * @author tobias + * + */ +public interface AudioFeature { + +} diff --git a/PlayWallCore/src/de/tobias/playpad/audio/AudioHandlerConnect.java b/PlayWallCore/src/de/tobias/playpad/audio/AudioHandlerConnect.java index 0d280a36ffd3d4af4f52975cd8cf2f4c1c577c85..122976a4f70e57b0802c04646ec55a9e6c9a3eb3 100644 --- a/PlayWallCore/src/de/tobias/playpad/audio/AudioHandlerConnect.java +++ b/PlayWallCore/src/de/tobias/playpad/audio/AudioHandlerConnect.java @@ -4,8 +4,9 @@ import de.tobias.playpad.pad.conntent.PadContent; import de.tobias.playpad.viewcontroller.AudioHandlerViewController; /** - * Audio Handler Interface zur Verwaltung einer AudioHandler Implementierung. Für Aktionen beim schließen des - * Programmes, muss der AudioHandler AutoClosable implementieren. + * Audio Handler Interface zur Verwaltung einer AudioHandler Implementierung. + * Für Aktionen beim schließen des Programmes, muss der AudioHandler + * AutoClosable implementieren. * * @author tobias * @@ -35,4 +36,23 @@ public abstract class AudioHandlerConnect { * @return Type */ public abstract String getType(); + + /** + * Prüft ob ein Feature verfügbar ist. + * + * @param audioCapability + * Feature + * @return <code>true</code> Verfügbar + */ + public abstract boolean isFeatureAvaiable(AudioCapability audioCapability); + + /** + * Gibt wenn vorhanden einen ViewController für die entsprechenden + * Einstellungen zurück. + * + * @param audioCapablility + * Audio Feature + * @return ViewController + */ + public abstract AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility); } diff --git a/PlayWallCore/src/de/tobias/playpad/audio/Equalizable.java b/PlayWallCore/src/de/tobias/playpad/audio/Equalizable.java index a0982852b0e2c4766dc3c5a1782ef0e8451744c8..d00c9d6280301a9b8a24bafc90967d7ca236ffed 100644 --- a/PlayWallCore/src/de/tobias/playpad/audio/Equalizable.java +++ b/PlayWallCore/src/de/tobias/playpad/audio/Equalizable.java @@ -2,7 +2,7 @@ package de.tobias.playpad.audio; import javafx.scene.media.AudioEqualizer; -public interface Equalizable { +public interface Equalizable extends AudioFeature { public AudioEqualizer getAudioEqualizer(); } diff --git a/PlayWallCore/src/de/tobias/playpad/audio/Peakable.java b/PlayWallCore/src/de/tobias/playpad/audio/Peakable.java new file mode 100644 index 0000000000000000000000000000000000000000..29f41ebc7f6ec0c0f2f756600773662934e7526d --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/audio/Peakable.java @@ -0,0 +1,16 @@ +package de.tobias.playpad.audio; + +import javafx.beans.property.DoubleProperty; + +public interface Peakable { + + public enum Channel { + + LEFT, + RIGHT; + } + + public DoubleProperty audioLevelProperty(Channel channel); + + public double getAudioLevel(Channel channel); +} diff --git a/PlayWallCore/src/de/tobias/playpad/audio/Soundcardable.java b/PlayWallCore/src/de/tobias/playpad/audio/Soundcardable.java new file mode 100644 index 0000000000000000000000000000000000000000..023fbdac355ee3569521fbe7a87c347466935f1d --- /dev/null +++ b/PlayWallCore/src/de/tobias/playpad/audio/Soundcardable.java @@ -0,0 +1,14 @@ +package de.tobias.playpad.audio; + +/** + * Setzt die Soundcard für die Audioimplementierung. + * + * @author tobias + * + * @since 6.0.0 + * + */ +public interface Soundcardable extends AudioFeature { + + public void setOutputDevice(String name); +} diff --git a/PlayWallNative/.gitignore b/PlayWallNative/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ae3c1726048cd06b9a143e0376ed46dd9b9a8d53 --- /dev/null +++ b/PlayWallNative/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudio$NativeAudioDelegate.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudio$NativeAudioDelegate.class deleted file mode 100644 index 94add9016c45847affc7a8504c1f1c7098ba07d7..0000000000000000000000000000000000000000 Binary files a/PlayWallNative/bin/de/tobias/playpad/NativeAudio$NativeAudioDelegate.class and /dev/null differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudio.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudio.class deleted file mode 100644 index c5f0439f799d55d65ce9dee93b08243b9b005557..0000000000000000000000000000000000000000 Binary files a/PlayWallNative/bin/de/tobias/playpad/NativeAudio.class and /dev/null differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandler.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandler.class deleted file mode 100644 index e65fdb615d0905222d4e5ac3e7e17bc396deaeb6..0000000000000000000000000000000000000000 Binary files a/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandler.class and /dev/null differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandlerConnect.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandlerConnect.class deleted file mode 100644 index bd8edabc909d978389efd81ed7a6e477b245fdcd..0000000000000000000000000000000000000000 Binary files a/PlayWallNative/bin/de/tobias/playpad/NativeAudioMacHandlerConnect.class and /dev/null differ diff --git a/PlayWallNative/bin/de/tobias/playpad/NativeAudioTest.class b/PlayWallNative/bin/de/tobias/playpad/NativeAudioTest.class deleted file mode 100644 index 3228cfd18da92c2aab164674a4ea0aaf208e1cf8..0000000000000000000000000000000000000000 Binary files a/PlayWallNative/bin/de/tobias/playpad/NativeAudioTest.class and /dev/null differ diff --git a/PlayWallNativeMac/.classpath b/PlayWallNativeMac/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..7d03288488cf3143f0a6a22231d22bac9bde9d1b --- /dev/null +++ b/PlayWallNativeMac/.classpath @@ -0,0 +1,9 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="src" path="test"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry combineaccessrules="false" kind="src" path="/PlayWallCore"/> + <classpathentry combineaccessrules="false" kind="src" path="/libUtils"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/PlayWallNativeMac/.gitignore b/PlayWallNativeMac/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ae3c1726048cd06b9a143e0376ed46dd9b9a8d53 --- /dev/null +++ b/PlayWallNativeMac/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/PlayWallNativeMac/.project b/PlayWallNativeMac/.project new file mode 100644 index 0000000000000000000000000000000000000000..da9501320a3b89805da1867b6827d4d216efe0fc --- /dev/null +++ b/PlayWallNativeMac/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>PlayWallNativeMac</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/PlayWallNativeMac/.settings/org.eclipse.jdt.core.prefs b/PlayWallNativeMac/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..3a21537071bf4118b9e1ee864cb4bc258aa48211 --- /dev/null +++ b/PlayWallNativeMac/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/PlayWallNativeMac/libNativeAudio.dylib b/PlayWallNativeMac/libNativeAudio.dylib new file mode 100644 index 0000000000000000000000000000000000000000..14afa4716652379483939e006f1d32ba3adde6bb Binary files /dev/null and b/PlayWallNativeMac/libNativeAudio.dylib differ diff --git a/PlayWallNativeMac/src/de/tobias/playpad/NativeAudio.java b/PlayWallNativeMac/src/de/tobias/playpad/NativeAudio.java new file mode 100644 index 0000000000000000000000000000000000000000..cee1d7277008783ef91cb119ce8b389791e4540e --- /dev/null +++ b/PlayWallNativeMac/src/de/tobias/playpad/NativeAudio.java @@ -0,0 +1,58 @@ +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 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 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 { + public void onFinish(int id); + + public void onPeakMeter(int id, float left, float right); + + public void onPositionChanged(int id, double position); + } +} diff --git a/PlayWallNativeMac/src/de/tobias/playpad/NativeAudioMacHandler.java b/PlayWallNativeMac/src/de/tobias/playpad/NativeAudioMacHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..066831def36afb550506bafaa2629c9e6e8f39dd --- /dev/null +++ b/PlayWallNativeMac/src/de/tobias/playpad/NativeAudioMacHandler.java @@ -0,0 +1,135 @@ +package de.tobias.playpad; + +import java.nio.file.Path; + +import de.tobias.playpad.audio.AudioHandler; +import de.tobias.playpad.audio.Peakable; +import de.tobias.playpad.pad.PadStatus; +import de.tobias.playpad.pad.conntent.PadContent; +import de.tobias.utils.util.Worker; +import javafx.application.Platform; +import javafx.beans.property.DoubleProperty; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyObjectProperty; +import javafx.beans.property.SimpleDoubleProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.util.Duration; + +public class NativeAudioMacHandler extends AudioHandler implements Peakable { + + private static int counter = 0; + + private final int id; + ObjectProperty<Duration> positionProperty; + private ObjectProperty<Duration> durationProperty; + private boolean isLoaded; + + private DoubleProperty leftPeak; + private DoubleProperty rightPeak; + + public NativeAudioMacHandler(PadContent content) { + super(content); + + id = counter++; + positionProperty = new SimpleObjectProperty<>(); + durationProperty = new SimpleObjectProperty<>(); + + leftPeak = new SimpleDoubleProperty(); + rightPeak = new SimpleDoubleProperty(); + } + + protected int getId() { + return id; + } + + @Override + public void play() { + NativeAudio.setLoop(id, getContent().getPad().getPadSettings().isLoop()); + NativeAudio.play(id); + } + + @Override + public void pause() { + NativeAudio.pause(id); + } + + @Override + public void stop() { + NativeAudio.stop(id); + } + + @Override + public Duration getPosition() { + return positionProperty.get(); + } + + @Override + public ReadOnlyObjectProperty<Duration> positionProperty() { + return positionProperty; + } + + @Override + public Duration getDuration() { + return durationProperty.get(); + } + + @Override + public ReadOnlyObjectProperty<Duration> durationProperty() { + return durationProperty; + } + + @Override + public void setVolume(double volume) { + NativeAudio.setVolume(id, volume); + + } + + @Override + public boolean isMediaLoaded() { + return isLoaded; + } + + @Override + public void loadMedia(Path[] paths) { + Platform.runLater(() -> + { + if (getContent().getPad().isPadVisible()) { + getContent().getPad().getController().getView().showBusyView(true); + } + }); + Worker.runLater(() -> + { + isLoaded = NativeAudio.load(id, paths[0].toString()); + if (isLoaded) { + Platform.runLater(() -> + { + durationProperty.set(Duration.seconds(NativeAudio.getDuration(id))); + getContent().getPad().setStatus(PadStatus.READY); + if (getContent().getPad().isPadVisible()) { + getContent().getPad().getController().getView().showBusyView(false); + } + }); + } + }); + } + + @Override + public void unloadMedia() { + NativeAudio.dispose(id); + } + + @Override + public DoubleProperty audioLevelProperty(Channel channel) { + if (channel == Channel.LEFT) { + return leftPeak; + } else if (channel == Channel.RIGHT) { + return rightPeak; + } + return null; + } + + @Override + public double getAudioLevel(Channel channel) { + return audioLevelProperty(channel).get(); + } +} diff --git a/PlayWallNativeMac/src/de/tobias/playpad/NativeAudioMacHandlerConnect.java b/PlayWallNativeMac/src/de/tobias/playpad/NativeAudioMacHandlerConnect.java new file mode 100644 index 0000000000000000000000000000000000000000..66245637d4cd9adcaee4cab2710107f6fa924809 --- /dev/null +++ b/PlayWallNativeMac/src/de/tobias/playpad/NativeAudioMacHandlerConnect.java @@ -0,0 +1,78 @@ +package de.tobias.playpad; + +import java.util.HashMap; + +import de.tobias.playpad.NativeAudio.NativeAudioDelegate; +import de.tobias.playpad.audio.AudioCapability; +import de.tobias.playpad.audio.AudioHandler; +import de.tobias.playpad.audio.AudioHandlerConnect; +import de.tobias.playpad.audio.Peakable.Channel; +import de.tobias.playpad.pad.PadStatus; +import de.tobias.playpad.pad.conntent.PadContent; +import de.tobias.playpad.viewcontroller.AudioHandlerViewController; +import javafx.util.Duration; + +public class NativeAudioMacHandlerConnect extends AudioHandlerConnect implements NativeAudioDelegate { + + private static final HashMap<Integer, NativeAudioMacHandler> handlers = new HashMap<>(); + + public NativeAudioMacHandlerConnect() { + NativeAudio.initialize(); + NativeAudio.setDelegate(this); + } + + @Override + public AudioHandler createAudioHandler(PadContent content) { + NativeAudioMacHandler nativeAudioMacHandler = new NativeAudioMacHandler(content); + handlers.put(nativeAudioMacHandler.getId(), nativeAudioMacHandler); + return nativeAudioMacHandler; + } + + @Override + public AudioHandlerViewController getAudioHandlerSettingsViewController() { + return null; + } + + @Override + public String getType() { + return "Native"; + } + + @Override + public void onFinish(int id) { + NativeAudioMacHandler nativeAudioMacHandler = handlers.get(id); + if (nativeAudioMacHandler != null) { + PadContent content = nativeAudioMacHandler.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)); + } + } + + @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); + } + } + + @Override + public boolean isFeatureAvaiable(AudioCapability audioCapability) { + return false; + } + + @Override + public AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility) { + return null; + } +} diff --git a/PlayWallNativeMac/src/de/tobias/playpad/Waveform.java b/PlayWallNativeMac/src/de/tobias/playpad/Waveform.java new file mode 100644 index 0000000000000000000000000000000000000000..f01873a01df7c0f3e1eb998941e3bd73b63519f6 --- /dev/null +++ b/PlayWallNativeMac/src/de/tobias/playpad/Waveform.java @@ -0,0 +1,7 @@ +package de.tobias.playpad; + +public class Waveform { + + public static native float[] createWaveform(String path); + +} diff --git a/PlayWallNativeMac/src/de/tobias/playpad/view/WaveformView.java b/PlayWallNativeMac/src/de/tobias/playpad/view/WaveformView.java new file mode 100644 index 0000000000000000000000000000000000000000..25029d49df5806ebd6ac9bbeba23d7941aeb091c --- /dev/null +++ b/PlayWallNativeMac/src/de/tobias/playpad/view/WaveformView.java @@ -0,0 +1,39 @@ +package de.tobias.playpad.view; + +import javafx.scene.paint.Color; +import javafx.scene.shape.LineTo; +import javafx.scene.shape.MoveTo; +import javafx.scene.shape.Path; + +public class WaveformView extends Path { + + public WaveformView(float[] data) { + getElements().add(new MoveTo(0, 0)); + + double width2 = data.length / 1200.0; + int width = data.length / 10000; + System.out.println(data.length); + System.out.println(width); + + int i = 0; + for (i = 0; i < data.length; i += width) { + if (i < data.length) { + LineTo lineTo = new LineTo(i / width2, data[i] * 50.0); + MoveTo moveTo = new MoveTo(i / width2, data[i] * 50.0); + + getElements().addAll(lineTo, moveTo); + } + } + for (; i >= 0; i -= width) { + if (i >= 0 && i < data.length) { + LineTo lineTo = new LineTo(i / width2, -data[i] * 50.0); + MoveTo moveTo = new MoveTo(i / width2, -data[i] * 50.0); + + getElements().addAll(lineTo, moveTo); + } + } + getElements().add(new LineTo(0, 0)); + getElements().add(new MoveTo(0, 0)); + setFill(Color.BLACK); + } +} diff --git a/PlayWallNative/bin/de_tobias_playpad_NativeAudio.h b/PlayWallNativeMac/src/de_tobias_playpad_NativeAudio.h similarity index 100% rename from PlayWallNative/bin/de_tobias_playpad_NativeAudio.h rename to PlayWallNativeMac/src/de_tobias_playpad_NativeAudio.h diff --git a/PlayWallNativeMac/src/de_tobias_playpad_Waveform.h b/PlayWallNativeMac/src/de_tobias_playpad_Waveform.h new file mode 100644 index 0000000000000000000000000000000000000000..9d0e45dcb853ff654b6c6e50ca73a8d9fc6ac183 --- /dev/null +++ b/PlayWallNativeMac/src/de_tobias_playpad_Waveform.h @@ -0,0 +1,29 @@ +/* DO NOT EDIT THIS FILE - it is machine generated */ +#include <jni.h> +/* Header for class de_tobias_playpad_Waveform */ + +#ifndef _Included_de_tobias_playpad_Waveform +#define _Included_de_tobias_playpad_Waveform +#ifdef __cplusplus +extern "C" { +#endif +/* + * Class: de_tobias_playpad_Waveform + * Method: initialize + * Signature: ()V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_Waveform_initialize + (JNIEnv *, jclass); + +/* + * Class: de_tobias_playpad_Waveform + * Method: createWaveform + * Signature: (Ljava/lang/String;)V + */ +JNIEXPORT void JNICALL Java_de_tobias_playpad_Waveform_createWaveform + (JNIEnv *, jclass, jstring); + +#ifdef __cplusplus +} +#endif +#endif diff --git a/PlayWallNativeMac/test/de/tobias/playpad/NativeAudioTest.java b/PlayWallNativeMac/test/de/tobias/playpad/NativeAudioTest.java new file mode 100644 index 0000000000000000000000000000000000000000..0fe58a6cf60fba757ed8d1a7938d11149af87b5c --- /dev/null +++ b/PlayWallNativeMac/test/de/tobias/playpad/NativeAudioTest.java @@ -0,0 +1,20 @@ +package de.tobias.playpad; + +public class NativeAudioTest { + + public static void main(String[] args) { + System.load("/Users/tobias/Documents/Programmieren/Java/git/PlayWall/PlayWallNative/libNativeAudio.dylib"); + + NativeAudio.load(0, "/Users/tobias/Downloads/03%20Hymn%20For%20The%20Weekend.mp3.wav"); + System.out.println(NativeAudio.getDuration(0)); + NativeAudio.play(0); + + while (true) { + try { + Thread.sleep(100); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + } +} diff --git a/PlayWallNativeMac/test/de/tobias/playpad/WaveformTest.java b/PlayWallNativeMac/test/de/tobias/playpad/WaveformTest.java new file mode 100644 index 0000000000000000000000000000000000000000..704d8b6eb7971ccaf75343790d49ffb86f45199f --- /dev/null +++ b/PlayWallNativeMac/test/de/tobias/playpad/WaveformTest.java @@ -0,0 +1,38 @@ +package de.tobias.playpad; + +import de.tobias.playpad.view.WaveformView; +import javafx.application.Application; +import javafx.scene.Scene; +import javafx.scene.image.ImageView; +import javafx.scene.image.WritableImage; +import javafx.scene.layout.VBox; +import javafx.stage.Stage; + +public class WaveformTest extends Application { + + public static void main(String[] args) { + System.load("/Users/tobias/Documents/Programmieren/Java/git/PlayWall/PlayWallNative/libNativeAudio.dylib"); + + launch(args); + } + + @Override + public void start(Stage primaryStage) throws Exception { + float[] data = Waveform.createWaveform("/Users/tobias/Music/iTunes/iTunes Media/Music/Coldplay/Mylo Xyloto/04 Charlie Brown.mp3"); + float[] data2 = Waveform.createWaveform("/Users/tobias/Downloads/TNT-Loop.wav"); + WaveformView view = new WaveformView(data); + WaveformView view2 = new WaveformView(data2); + + WritableImage image = new WritableImage(1200, 150); + view.snapshot(null, image); + WritableImage image2 = new WritableImage(1200, 150); + view2.snapshot(null, image2); + + VBox root = new VBox(new ImageView(image), new ImageView(image2)); + Scene scene = new Scene(root); + + primaryStage.setScene(scene); + primaryStage.show(); + } + +} diff --git a/PlayWallNativeWin/.classpath b/PlayWallNativeWin/.classpath new file mode 100644 index 0000000000000000000000000000000000000000..709ee3891c7490ab21accfb7f66c61054b14fbe7 --- /dev/null +++ b/PlayWallNativeWin/.classpath @@ -0,0 +1,13 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="src" path="src"/> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/Plugins"/> + <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/YML"/> + <classpathentry kind="lib" path="j4n/jni4net.j-0.8.8.0.jar"/> + <classpathentry kind="lib" path="j4n/NativeAudio.j4n.jar"/> + <classpathentry combineaccessrules="false" kind="src" path="/PlayWallCore"/> + <classpathentry combineaccessrules="false" kind="src" path="/libUtils"/> + <classpathentry combineaccessrules="false" kind="src" path="/Updater"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/PlayWallNativeWin/.gitignore b/PlayWallNativeWin/.gitignore new file mode 100644 index 0000000000000000000000000000000000000000..ae3c1726048cd06b9a143e0376ed46dd9b9a8d53 --- /dev/null +++ b/PlayWallNativeWin/.gitignore @@ -0,0 +1 @@ +/bin/ diff --git a/PlayWallNativeWin/.project b/PlayWallNativeWin/.project new file mode 100644 index 0000000000000000000000000000000000000000..f859d19b4ac27ba37188d2fb96f24ea765eccd5f --- /dev/null +++ b/PlayWallNativeWin/.project @@ -0,0 +1,17 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>PlayWallNativeWin</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/PlayWallNativeWin/.settings/org.eclipse.jdt.core.prefs b/PlayWallNativeWin/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000000000000000000000000000000000..bb35fa0a87b032ee9d0b128004c1edbd464f07bf --- /dev/null +++ b/PlayWallNativeWin/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,11 @@ +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 +org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve +org.eclipse.jdt.core.compiler.compliance=1.8 +org.eclipse.jdt.core.compiler.debug.lineNumber=generate +org.eclipse.jdt.core.compiler.debug.localVariable=generate +org.eclipse.jdt.core.compiler.debug.sourceFile=generate +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.8 diff --git a/PlayWallNativeWin/MANIFEST.MF b/PlayWallNativeWin/MANIFEST.MF new file mode 100644 index 0000000000000000000000000000000000000000..eeb2a06cb316a736ee9a6705b198d6a0156eed29 --- /dev/null +++ b/PlayWallNativeWin/MANIFEST.MF @@ -0,0 +1,2 @@ +Manifest-Version: 1.0 +Class-Path: . nawin/jni4net.j-0.8.8.0.jar nawin/NativeAudio.j4n.jar diff --git a/PlayWallNativeWin/j4n/NAudio.dll b/PlayWallNativeWin/j4n/NAudio.dll new file mode 100644 index 0000000000000000000000000000000000000000..9dd5ae7de34d2bc2dcf934eb027fa60d20237c3d Binary files /dev/null and b/PlayWallNativeWin/j4n/NAudio.dll differ diff --git a/PlayWallNativeWin/j4n/NativeAudio.dll b/PlayWallNativeWin/j4n/NativeAudio.dll new file mode 100644 index 0000000000000000000000000000000000000000..66fd392f1b50cfdbf9d1e538c930a588e829ed79 Binary files /dev/null and b/PlayWallNativeWin/j4n/NativeAudio.dll differ diff --git a/PlayWallNativeWin/j4n/NativeAudio.j4n.dll b/PlayWallNativeWin/j4n/NativeAudio.j4n.dll new file mode 100644 index 0000000000000000000000000000000000000000..027e55fe7f081795f015ee94eebc9343253ce83f Binary files /dev/null and b/PlayWallNativeWin/j4n/NativeAudio.j4n.dll differ diff --git a/PlayWallNativeWin/j4n/NativeAudio.j4n.jar b/PlayWallNativeWin/j4n/NativeAudio.j4n.jar new file mode 100644 index 0000000000000000000000000000000000000000..7c16f4dcfe164f54f971cea054c321b18743aafa Binary files /dev/null and b/PlayWallNativeWin/j4n/NativeAudio.j4n.jar differ diff --git a/PlayWallNativeWin/j4n/NativeAudio.proxygen.xml b/PlayWallNativeWin/j4n/NativeAudio.proxygen.xml new file mode 100644 index 0000000000000000000000000000000000000000..8e339777e6fbcaf610050cca93491a9dfdabd518 --- /dev/null +++ b/PlayWallNativeWin/j4n/NativeAudio.proxygen.xml @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="utf-8"?> +<jni4net-proxygen xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://jni4net.sf.net/0.8.8.0/toolConfig.xsd"> + <TargetDirJvm>.\jvm</TargetDirJvm> + <TargetDirClr>.\clr</TargetDirClr> + <AssemblyReference Assembly="NativeAudio.dll" Generate="true" /> +</jni4net-proxygen> \ No newline at end of file diff --git a/PlayWallNativeWin/j4n/build.cmd b/PlayWallNativeWin/j4n/build.cmd new file mode 100644 index 0000000000000000000000000000000000000000..93c3e641600b8a6f4a57703ad63cb7c157bcdc3d --- /dev/null +++ b/PlayWallNativeWin/j4n/build.cmd @@ -0,0 +1,21 @@ +@echo off +if not exist target mkdir target +if not exist target\classes mkdir target\classes + + +echo compile classes +javac -nowarn -d target\classes -sourcepath jvm -cp "d:\programmieren\git-java\playwall\playwallnativewin\j4n\jni4net.j-0.8.8.0.jar"; "jvm\nativeaudio\LoopStream.java" "jvm\nativeaudio\NativeAudio.java" +IF %ERRORLEVEL% NEQ 0 goto end + + +echo NativeAudio.j4n.jar +jar cvf NativeAudio.j4n.jar -C target\classes "nativeaudio\LoopStream.class" -C target\classes "nativeaudio\NativeAudio.class" > nul +IF %ERRORLEVEL% NEQ 0 goto end + + +echo NativeAudio.j4n.dll +csc /nologo /warn:0 /t:library /out:NativeAudio.j4n.dll /recurse:clr\*.cs /reference:"D:\Programmieren\Git-Java\PlayWall\PlayWallNativeWin\j4n\NativeAudio.dll" /reference:"D:\Programmieren\Git-Java\PlayWall\PlayWallNativeWin\j4n\NAudio.dll" /reference:"D:\Programmieren\Git-Java\PlayWall\PlayWallNativeWin\j4n\jni4net.n-0.8.8.0.dll" +IF %ERRORLEVEL% NEQ 0 goto end + + +:end diff --git a/PlayWallNativeWin/j4n/clr/nativeaudio/LoopStream.generated.cs b/PlayWallNativeWin/j4n/clr/nativeaudio/LoopStream.generated.cs new file mode 100644 index 0000000000000000000000000000000000000000..cf1228582af0be39daa9c6762b55c7506df0e570 --- /dev/null +++ b/PlayWallNativeWin/j4n/clr/nativeaudio/LoopStream.generated.cs @@ -0,0 +1,89 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by jni4net. See http://jni4net.sourceforge.net/ +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace NativeAudio { + + + #region Component Designer generated code + public partial class LoopStream_ { + + public static global::java.lang.Class _class { + get { + return global::NativeAudio.@__LoopStream.staticClass; + } + } + } + #endregion + + #region Component Designer generated code + [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::NativeAudio.LoopStream), typeof(global::NativeAudio.LoopStream_))] + [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::NativeAudio.LoopStream), typeof(global::NativeAudio.LoopStream_))] + internal sealed partial class @__LoopStream : global::java.lang.Object { + + internal new static global::java.lang.Class staticClass; + + private @__LoopStream(global::net.sf.jni4net.jni.JNIEnv @__env) : + base(@__env) { + } + + private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) { + global::NativeAudio.@__LoopStream.staticClass = @__class; + } + + private static global::System.Collections.Generic.List<global::net.sf.jni4net.jni.JNINativeMethod> @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) { + global::System.Type @__type = typeof(__LoopStream); + global::System.Collections.Generic.List<global::net.sf.jni4net.jni.JNINativeMethod> methods = new global::System.Collections.Generic.List<global::net.sf.jni4net.jni.JNINativeMethod>(); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getEnableLooping", "EnableLooping0", "()Z")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "setEnableLooping", "EnableLooping1", "(Z)V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "__ctorLoopStream0", "__ctorLoopStream0", "(Lnet/sf/jni4net/inj/IClrProxy;Lsystem/io/Stream;)V")); + return methods; + } + + private static bool EnableLooping0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()Z + // ()Z + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + bool @__return = default(bool); + try { + global::NativeAudio.LoopStream @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.LoopStream>(@__env, @__obj); + @__return = ((bool)(@__real.EnableLooping)); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + return @__return; + } + + private static void EnableLooping1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, bool value) { + // (Z)V + // (Z)V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.LoopStream @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.LoopStream>(@__env, @__obj); + @__real.EnableLooping = value; + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static void @__ctorLoopStream0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__class, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle sourceStream) { + // (Lsystem/io/Stream;)V + // (LNAudio/Wave/WaveStream;)V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.LoopStream @__real = new global::NativeAudio.LoopStream(global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NAudio.Wave.WaveStream>(@__env, sourceStream)); + global::net.sf.jni4net.utils.Convertor.InitProxy(@__env, @__obj, @__real); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper { + + public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) { + return new global::NativeAudio.@__LoopStream(@__env); + } + } + } + #endregion +} diff --git a/PlayWallNativeWin/j4n/clr/nativeaudio/NativeAudio.generated.cs b/PlayWallNativeWin/j4n/clr/nativeaudio/NativeAudio.generated.cs new file mode 100644 index 0000000000000000000000000000000000000000..ea98eeed7f0c8d0a291dcdbab386ce7a7c5f7e44 --- /dev/null +++ b/PlayWallNativeWin/j4n/clr/nativeaudio/NativeAudio.generated.cs @@ -0,0 +1,206 @@ +//------------------------------------------------------------------------------ +// <auto-generated> +// This code was generated by jni4net. See http://jni4net.sourceforge.net/ +// Runtime Version:4.0.30319.42000 +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </auto-generated> +//------------------------------------------------------------------------------ + +namespace NativeAudio { + + + #region Component Designer generated code + public partial class NativeAudio_ { + + public static global::java.lang.Class _class { + get { + return global::NativeAudio.@__NativeAudio.staticClass; + } + } + } + #endregion + + #region Component Designer generated code + [global::net.sf.jni4net.attributes.JavaProxyAttribute(typeof(global::NativeAudio.NativeAudio), typeof(global::NativeAudio.NativeAudio_))] + [global::net.sf.jni4net.attributes.ClrWrapperAttribute(typeof(global::NativeAudio.NativeAudio), typeof(global::NativeAudio.NativeAudio_))] + internal sealed partial class @__NativeAudio : global::java.lang.Object { + + internal new static global::java.lang.Class staticClass; + + private @__NativeAudio(global::net.sf.jni4net.jni.JNIEnv @__env) : + base(@__env) { + } + + private static void InitJNI(global::net.sf.jni4net.jni.JNIEnv @__env, java.lang.Class @__class) { + global::NativeAudio.@__NativeAudio.staticClass = @__class; + } + + private static global::System.Collections.Generic.List<global::net.sf.jni4net.jni.JNINativeMethod> @__Init(global::net.sf.jni4net.jni.JNIEnv @__env, global::java.lang.Class @__class) { + global::System.Type @__type = typeof(__NativeAudio); + global::System.Collections.Generic.List<global::net.sf.jni4net.jni.JNINativeMethod> methods = new global::System.Collections.Generic.List<global::net.sf.jni4net.jni.JNINativeMethod>(); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "load", "load0", "(Ljava/lang/String;)Z")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "play", "play1", "()V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "pause", "pause2", "()V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "stop", "stop3", "()V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getDuration", "getDuration4", "()D")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getPosition", "getPosition5", "()D")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "isPlaying", "isPlaying6", "()Z")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "setVolume", "setVolume7", "(F)V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "setLoop", "setLoop8", "(Z)V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "setDevice", "setDevice9", "(Ljava/lang/String;)V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "getDevices", "getDevices10", "()[Ljava/lang/String;")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "unload", "unload11", "()V")); + methods.Add(global::net.sf.jni4net.jni.JNINativeMethod.Create(@__type, "__ctorNativeAudio0", "__ctorNativeAudio0", "(Lnet/sf/jni4net/inj/IClrProxy;)V")); + return methods; + } + + private static bool load0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle path) { + // (Ljava/lang/String;)Z + // (LSystem/String;)Z + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + bool @__return = default(bool); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__return = ((bool)(@__real.load(global::net.sf.jni4net.utils.Convertor.StrongJ2CString(@__env, path)))); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + return @__return; + } + + private static void play1(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()V + // ()V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.play(); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static void pause2(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()V + // ()V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.pause(); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static void stop3(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()V + // ()V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.stop(); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static double getDuration4(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()D + // ()D + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + double @__return = default(double); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__return = ((double)(@__real.getDuration())); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + return @__return; + } + + private static double getPosition5(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()D + // ()D + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + double @__return = default(double); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__return = ((double)(@__real.getPosition())); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + return @__return; + } + + private static bool isPlaying6(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()Z + // ()Z + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + bool @__return = default(bool); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__return = ((bool)(@__real.isPlaying())); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + return @__return; + } + + private static void setVolume7(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, float volume) { + // (F)V + // (F)V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.setVolume(volume); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static void setLoop8(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, bool loop) { + // (Z)V + // (Z)V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.setLoop(loop); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static void setDevice9(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj, global::net.sf.jni4net.utils.JniLocalHandle name) { + // (Ljava/lang/String;)V + // (LSystem/String;)V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.setDevice(global::net.sf.jni4net.utils.Convertor.StrongJ2CString(@__env, name)); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static global::net.sf.jni4net.utils.JniHandle getDevices10(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__class) { + // ()[Ljava/lang/String; + // ()[LSystem/String; + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + global::net.sf.jni4net.utils.JniHandle @__return = default(global::net.sf.jni4net.utils.JniHandle); + try { + @__return = global::net.sf.jni4net.utils.Convertor.ArrayStrongC2JString(@__env, global::NativeAudio.NativeAudio.getDevices()); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + return @__return; + } + + private static void unload11(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()V + // ()V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = global::net.sf.jni4net.utils.Convertor.StrongJp2C<global::NativeAudio.NativeAudio>(@__env, @__obj); + @__real.unload(); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + private static void @__ctorNativeAudio0(global::System.IntPtr @__envp, global::net.sf.jni4net.utils.JniLocalHandle @__class, global::net.sf.jni4net.utils.JniLocalHandle @__obj) { + // ()V + // ()V + global::net.sf.jni4net.jni.JNIEnv @__env = global::net.sf.jni4net.jni.JNIEnv.Wrap(@__envp); + try { + global::NativeAudio.NativeAudio @__real = new global::NativeAudio.NativeAudio(); + global::net.sf.jni4net.utils.Convertor.InitProxy(@__env, @__obj, @__real); + }catch (global::System.Exception __ex){@__env.ThrowExisting(__ex);} + } + + new internal sealed class ContructionHelper : global::net.sf.jni4net.utils.IConstructionHelper { + + public global::net.sf.jni4net.jni.IJvmProxy CreateProxy(global::net.sf.jni4net.jni.JNIEnv @__env) { + return new global::NativeAudio.@__NativeAudio(@__env); + } + } + } + #endregion +} diff --git a/PlayWallNativeWin/j4n/generate.bat b/PlayWallNativeWin/j4n/generate.bat new file mode 100644 index 0000000000000000000000000000000000000000..f7636d55f59799fde55275cadbf2e0e004a3c39e --- /dev/null +++ b/PlayWallNativeWin/j4n/generate.bat @@ -0,0 +1 @@ +proxygen.exe NativeAudio.dll -wd . \ No newline at end of file diff --git a/PlayWallNativeWin/j4n/jni4net.j-0.8.8.0.jar b/PlayWallNativeWin/j4n/jni4net.j-0.8.8.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..922c2ad94d8c7a0a75f3613450819eb02e6d2757 Binary files /dev/null and b/PlayWallNativeWin/j4n/jni4net.j-0.8.8.0.jar differ diff --git a/PlayWallNativeWin/j4n/jni4net.n-0.8.8.0.dll b/PlayWallNativeWin/j4n/jni4net.n-0.8.8.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..2c7dc61711aea95d4a9d27f72ee9b540625ec0da Binary files /dev/null and b/PlayWallNativeWin/j4n/jni4net.n-0.8.8.0.dll differ diff --git a/PlayWallNativeWin/j4n/jni4net.n.w32.v40-0.8.8.0.dll b/PlayWallNativeWin/j4n/jni4net.n.w32.v40-0.8.8.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..e90e34defd278af539cd5d40a44f5d5f6b3b983d Binary files /dev/null and b/PlayWallNativeWin/j4n/jni4net.n.w32.v40-0.8.8.0.dll differ diff --git a/PlayWallNativeWin/j4n/jni4net.n.w64.v40-0.8.8.0.dll b/PlayWallNativeWin/j4n/jni4net.n.w64.v40-0.8.8.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..6ff98f1eca73982a4d293447484864290d2d2170 Binary files /dev/null and b/PlayWallNativeWin/j4n/jni4net.n.w64.v40-0.8.8.0.dll differ diff --git a/PlayWallNativeWin/j4n/jvm/nativeaudio/LoopStream.java b/PlayWallNativeWin/j4n/jvm/nativeaudio/LoopStream.java new file mode 100644 index 0000000000000000000000000000000000000000..e11a08759b9cfef51fba8e8931747e57d5fb0409 --- /dev/null +++ b/PlayWallNativeWin/j4n/jvm/nativeaudio/LoopStream.java @@ -0,0 +1,45 @@ +// ------------------------------------------------------------------------------ +// <autogenerated> +// This code was generated by jni4net. See http://jni4net.sourceforge.net/ +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </autogenerated> +// ------------------------------------------------------------------------------ + +package nativeaudio; + +@net.sf.jni4net.attributes.ClrType +public class LoopStream extends system.io.Stream { + + //<generated-proxy> + private static system.Type staticType; + + protected LoopStream(net.sf.jni4net.inj.INJEnv __env, long __handle) { + super(__env, __handle); + } + + @net.sf.jni4net.attributes.ClrConstructor("(LNAudio/Wave/WaveStream;)V") + public LoopStream(system.io.Stream sourceStream) { + super(((net.sf.jni4net.inj.INJEnv)(null)), 0); + nativeaudio.LoopStream.__ctorLoopStream0(this, sourceStream); + } + + @net.sf.jni4net.attributes.ClrMethod("(Lsystem/io/Stream;)V") + private native static void __ctorLoopStream0(net.sf.jni4net.inj.IClrProxy thiz, system.io.Stream sourceStream); + + @net.sf.jni4net.attributes.ClrMethod("()Z") + public native boolean getEnableLooping(); + + @net.sf.jni4net.attributes.ClrMethod("(Z)V") + public native void setEnableLooping(boolean value); + + public static system.Type typeof() { + return nativeaudio.LoopStream.staticType; + } + + private static void InitJNI(net.sf.jni4net.inj.INJEnv env, system.Type staticType) { + nativeaudio.LoopStream.staticType = staticType; + } + //</generated-proxy> +} diff --git a/PlayWallNativeWin/j4n/jvm/nativeaudio/NativeAudio.java b/PlayWallNativeWin/j4n/jvm/nativeaudio/NativeAudio.java new file mode 100644 index 0000000000000000000000000000000000000000..ffd1aef71ce846ebd29eabbde1dccc280081003f --- /dev/null +++ b/PlayWallNativeWin/j4n/jvm/nativeaudio/NativeAudio.java @@ -0,0 +1,75 @@ +// ------------------------------------------------------------------------------ +// <autogenerated> +// This code was generated by jni4net. See http://jni4net.sourceforge.net/ +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// </autogenerated> +// ------------------------------------------------------------------------------ + +package nativeaudio; + +@net.sf.jni4net.attributes.ClrType +public class NativeAudio extends system.Object { + + //<generated-proxy> + private static system.Type staticType; + + protected NativeAudio(net.sf.jni4net.inj.INJEnv __env, long __handle) { + super(__env, __handle); + } + + @net.sf.jni4net.attributes.ClrConstructor("()V") + public NativeAudio() { + super(((net.sf.jni4net.inj.INJEnv)(null)), 0); + nativeaudio.NativeAudio.__ctorNativeAudio0(this); + } + + @net.sf.jni4net.attributes.ClrMethod("()V") + private native static void __ctorNativeAudio0(net.sf.jni4net.inj.IClrProxy thiz); + + @net.sf.jni4net.attributes.ClrMethod("(LSystem/String;)Z") + public native boolean load(java.lang.String path); + + @net.sf.jni4net.attributes.ClrMethod("()V") + public native void play(); + + @net.sf.jni4net.attributes.ClrMethod("()V") + public native void pause(); + + @net.sf.jni4net.attributes.ClrMethod("()V") + public native void stop(); + + @net.sf.jni4net.attributes.ClrMethod("()D") + public native double getDuration(); + + @net.sf.jni4net.attributes.ClrMethod("()D") + public native double getPosition(); + + @net.sf.jni4net.attributes.ClrMethod("()Z") + public native boolean isPlaying(); + + @net.sf.jni4net.attributes.ClrMethod("(F)V") + public native void setVolume(float volume); + + @net.sf.jni4net.attributes.ClrMethod("(Z)V") + public native void setLoop(boolean loop); + + @net.sf.jni4net.attributes.ClrMethod("(LSystem/String;)V") + public native void setDevice(java.lang.String name); + + @net.sf.jni4net.attributes.ClrMethod("()[LSystem/String;") + public native static java.lang.String[] getDevices(); + + @net.sf.jni4net.attributes.ClrMethod("()V") + public native void unload(); + + public static system.Type typeof() { + return nativeaudio.NativeAudio.staticType; + } + + private static void InitJNI(net.sf.jni4net.inj.INJEnv env, system.Type staticType) { + nativeaudio.NativeAudio.staticType = staticType; + } + //</generated-proxy> +} diff --git a/PlayWallNativeWin/j4n/proxygen.exe b/PlayWallNativeWin/j4n/proxygen.exe new file mode 100644 index 0000000000000000000000000000000000000000..816db4ef246603f6313670c111e4de0957905d56 Binary files /dev/null and b/PlayWallNativeWin/j4n/proxygen.exe differ diff --git a/PlayWallNativeWin/j4n/proxygen.exe.config b/PlayWallNativeWin/j4n/proxygen.exe.config new file mode 100644 index 0000000000000000000000000000000000000000..88c3d408ec7ed3687fcf214d01aa502f4bd0e89f --- /dev/null +++ b/PlayWallNativeWin/j4n/proxygen.exe.config @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="utf-8" ?> +<configuration> + <startup> + <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> + <supportedRuntime version="v2.0.50727"/> + </startup> +</configuration> \ No newline at end of file diff --git a/PlayWallNativeWin/j4n/target/classes/nativeaudio/LoopStream.class b/PlayWallNativeWin/j4n/target/classes/nativeaudio/LoopStream.class new file mode 100644 index 0000000000000000000000000000000000000000..cbde588f149720bb84608ad2bcc8ae43d1ac4250 Binary files /dev/null and b/PlayWallNativeWin/j4n/target/classes/nativeaudio/LoopStream.class differ diff --git a/PlayWallNativeWin/j4n/target/classes/nativeaudio/NativeAudio.class b/PlayWallNativeWin/j4n/target/classes/nativeaudio/NativeAudio.class new file mode 100644 index 0000000000000000000000000000000000000000..95dcb66bfa41ce732ba8934419c2def276b6ae7a Binary files /dev/null and b/PlayWallNativeWin/j4n/target/classes/nativeaudio/NativeAudio.class differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinPlugin.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinPlugin.java new file mode 100644 index 0000000000000000000000000000000000000000..15c41b1901399365f4dd11536445f9b73fd73355 --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinPlugin.java @@ -0,0 +1,7 @@ +package de.tobias.playpad.nawin; + +import de.tobias.playpad.plugin.AdvancedPlugin; + +public interface NativeAudioWinPlugin extends AdvancedPlugin { + +} diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinPluginImpl.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinPluginImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..4d49e1dd889bcd824b7483d834c1e47508342948 --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinPluginImpl.java @@ -0,0 +1,99 @@ +package de.tobias.playpad.nawin; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import de.tobias.playpad.PlayPadPlugin; +import de.tobias.playpad.audio.AudioRegistry; +import de.tobias.playpad.nawin.audio.NativeAudioWinHandlerConnect; +import de.tobias.playpad.plugin.Module; +import de.tobias.updater.client.Updatable; +import de.tobias.utils.application.App; +import de.tobias.utils.application.ApplicationUtils; +import de.tobias.utils.application.container.PathType; +import de.tobias.utils.util.IOUtils; +import de.tobias.utils.util.OS; +import net.sf.jni4net.Bridge; +import net.xeoh.plugins.base.annotations.PluginImplementation; +import net.xeoh.plugins.base.annotations.events.PluginLoaded; +import net.xeoh.plugins.base.annotations.events.Shutdown; + +@PluginImplementation +public class NativeAudioWinPluginImpl implements NativeAudioWinPlugin { + + private static final String ASSETS = "de/tobias/playpad/nawin/assets/"; + + private static final String NAME = "NativeAudioWin"; + private static final String IDENTIFIER = "de.tobias.playpad.nawin.NativeAudioWinPluginImpl"; + + private Module module; + private Updatable updatable; + + @PluginLoaded + public void onLoaded(NativeAudioWinPlugin plugin) { + module = new Module(NAME, IDENTIFIER); + updatable = new NativeAudioWinUpdater(); + + try { + prepareBridging(); + bridgeCsharp(); + + if (OS.isWindows()) { + AudioRegistry registry = PlayPadPlugin.getRegistryCollection().getAudioHandlers(); + registry.registerComponent(new NativeAudioWinHandlerConnect(), "NativeWin", module); + } + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void prepareBridging() throws IOException { + App app = ApplicationUtils.getApplication(); + if (!app.isDebug()) { + Path resourceFolder = app.getPath(PathType.LIBRARY, "nawin"); + 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"); + } + } + + private void copyResource(Path resourceFolder, String packageName, String file) throws IOException { + IOUtils.copy(getClass().getClassLoader().getResourceAsStream(packageName + file), resourceFolder.resolve(file)); + System.out.println("Copied: " + file); + } + + private void bridgeCsharp() throws IOException { + Bridge.setVerbose(true); + Bridge.init(); + + App app = ApplicationUtils.getApplication(); + Path resourceFolder = app.getPath(PathType.LIBRARY, "nawin"); + + Bridge.LoadAndRegisterAssemblyFrom(resourceFolder.resolve("NativeAudio.j4n.dll").toFile()); + } + + @Shutdown + public void onShutdown() { + + } + + @Override + public Module getModule() { + return module; + } + + @Override + public Updatable getUpdatable() { + return updatable; + } +} diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinUpdater.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinUpdater.java new file mode 100644 index 0000000000000000000000000000000000000000..eb30fc50e412031a03cd7c5f5955319a4700dfb5 --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/NativeAudioWinUpdater.java @@ -0,0 +1,79 @@ +package de.tobias.playpad.nawin; + +import java.io.IOException; +import java.net.URL; +import java.nio.file.Path; + +import org.bukkit.configuration.file.FileConfiguration; +import org.bukkit.configuration.file.YamlConfiguration; + +import de.tobias.updater.client.Updatable; +import de.tobias.updater.client.UpdateChannel; +import de.tobias.utils.application.App; +import de.tobias.utils.application.ApplicationUtils; +import de.tobias.utils.application.container.PathType; + +public class NativeAudioWinUpdater implements Updatable { + + private int newBuild; + private String newVersion; + private URL remotePath; + + private String localFileName; + private String name; + + @Override + public int getCurrentBuild() { + return 1; + } + + @Override + public String getCurrentVersion() { + return "1.0"; + } + + @Override + public int getNewBuild() { + return newBuild; + } + + @Override + public String getNewVersion() { + return newVersion; + } + + @Override + public void loadInformation(UpdateChannel channel) throws IOException { + App app = ApplicationUtils.getMainApplication(); + URL url = new URL(app.getInfo().getUpdateURL() + "/" + channel + "/plugins.yml"); + FileConfiguration config = YamlConfiguration.loadConfiguration(url.openStream()); + + newBuild = config.getInt("plugins.nawin.build"); + newVersion = config.getString("plugins.nawin.version"); + remotePath = new URL(config.getString("plugins.nawin.url")); + localFileName = config.getString("plugins.nawin.filename"); + name = config.getString("plugins.nawin.name"); + + } + + @Override + public boolean isUpdateAvailable() { + return getCurrentBuild() < getNewBuild(); + } + + @Override + public URL getDownloadPath() { + return remotePath; + } + + @Override + public Path getLocalPath() { + return ApplicationUtils.getApplication().getPath(PathType.LIBRARY, localFileName); + } + + @Override + public String name() { + return name; + } + +} diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NAudio.dll b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NAudio.dll new file mode 100644 index 0000000000000000000000000000000000000000..9dd5ae7de34d2bc2dcf934eb027fa60d20237c3d Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NAudio.dll differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.dll b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.dll new file mode 100644 index 0000000000000000000000000000000000000000..01b901940ded1b6a40154d503aa62e7708484392 Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.dll differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.j4n.dll b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.j4n.dll new file mode 100644 index 0000000000000000000000000000000000000000..027e55fe7f081795f015ee94eebc9343253ce83f Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.j4n.dll differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.j4n.jar b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.j4n.jar new file mode 100644 index 0000000000000000000000000000000000000000..7c16f4dcfe164f54f971cea054c321b18743aafa Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/NativeAudio.j4n.jar differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/Test-Sound.wav b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/Test-Sound.wav new file mode 100644 index 0000000000000000000000000000000000000000..1a627d7c84165c6131c47134b1ca1f4fcb0bf3be Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/Test-Sound.wav differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.j-0.8.8.0.jar b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.j-0.8.8.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..922c2ad94d8c7a0a75f3613450819eb02e6d2757 Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.j-0.8.8.0.jar differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n-0.8.8.0.dll b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n-0.8.8.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..2c7dc61711aea95d4a9d27f72ee9b540625ec0da Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n-0.8.8.0.dll differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n.w32.v40-0.8.8.0.dll b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n.w32.v40-0.8.8.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..e90e34defd278af539cd5d40a44f5d5f6b3b983d Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n.w32.v40-0.8.8.0.dll differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n.w64.v40-0.8.8.0.dll b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n.w64.v40-0.8.8.0.dll new file mode 100644 index 0000000000000000000000000000000000000000..6ff98f1eca73982a4d293447484864290d2d2170 Binary files /dev/null and b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/jni4net.n.w64.v40-0.8.8.0.dll differ diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/nawinSettings.fxml b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/nawinSettings.fxml new file mode 100644 index 0000000000000000000000000000000000000000..3bc628651c3be6d86bd71a62dc915fa7b1d6f0fd --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/assets/nawinSettings.fxml @@ -0,0 +1,12 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<?import java.lang.*?> +<?import javafx.scene.control.*?> +<?import javafx.scene.layout.*?> + +<HBox spacing="14.0" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1"> + <children> + <ComboBox fx:id="soundCardComboBox" layoutX="118.0" layoutY="14.0" prefHeight="26.0" prefWidth="241.0" /> + <Button fx:id="testButton" layoutX="372.0" layoutY="14.0" mnemonicParsing="false" onAction="#testButtonHandler" /> + </children> +</HBox> diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioSettingsViewController.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioSettingsViewController.java new file mode 100644 index 0000000000000000000000000000000000000000..21665a0bf7d79d134bded2f8755dfb411c68a9cf --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioSettingsViewController.java @@ -0,0 +1,112 @@ +package de.tobias.playpad.nawin.audio; + +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.Path; + +import de.tobias.playpad.settings.Profile; +import de.tobias.playpad.viewcontroller.AudioHandlerViewController; +import de.tobias.utils.application.ApplicationUtils; +import de.tobias.utils.application.container.PathType; +import de.tobias.utils.ui.icon.FontAwesomeType; +import de.tobias.utils.ui.icon.FontIcon; +import de.tobias.utils.util.IOUtils; +import de.tobias.utils.util.Worker; +import javafx.application.Platform; +import javafx.event.ActionEvent; +import javafx.fxml.FXML; +import javafx.scene.control.Button; +import javafx.scene.control.ComboBox; +import nativeaudio.NativeAudio; + +public class NativeAudioSettingsViewController extends AudioHandlerViewController { + + @FXML private ComboBox<String> soundCardComboBox; + @FXML private Button testButton; + + private boolean isChanged; + + private NativeAudio audioPlayer; + + public NativeAudioSettingsViewController() { + super("nawinSettings", "de/tobias/playpad/nawin/assets/", null); + + testButton.setGraphic(new FontIcon(FontAwesomeType.PLAY)); + + soundCardComboBox.getItems().setAll(NativeAudio.getDevices()); + + String name = (String) Profile.currentProfile().getProfileSettings().getAudioUserInfo() + .get(NativeAudioWinHandler.SOUND_CARD); + for (String info : NativeAudio.getDevices()) { + if (info.equals(name)) { + soundCardComboBox.getSelectionModel().select(info); + break; + } + } + + // ersten Auswählen wenn keiner ausgewählt ist, damit keine Probleme + // auftreten da keiene Soundkarte ausgewäht ist + if (soundCardComboBox.getSelectionModel().getSelectedItem() == null) { + soundCardComboBox.getSelectionModel().selectFirst(); + } + + soundCardComboBox.getSelectionModel().selectedItemProperty().addListener((a, b, c) -> { + if (audioPlayer != null) { + audioPlayer.stop(); + audioPlayer = null; + testButton.setGraphic(new FontIcon(FontAwesomeType.PLAY)); + } + + isChanged = true; + Profile.currentProfile().getProfileSettings().getAudioUserInfo().put(NativeAudioWinHandler.SOUND_CARD, c); + }); + } + + @FXML + private void testButtonHandler(ActionEvent event) { + Path file = ApplicationUtils.getApplication().getPath(PathType.RESOURCES, "Test-Sound.wav"); + if (Files.notExists(file)) { + InputStream iStr = getClass().getClassLoader() + .getResourceAsStream("de/tobias/playpad/nawin/assets/Test-Sound.wav"); + try { + Files.createDirectories(file.getParent()); + IOUtils.copy(iStr, file); + } catch (IOException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + if (audioPlayer == null) { + audioPlayer = new NativeAudio(); + audioPlayer.load(file.toString()); + audioPlayer.setDevice(soundCardComboBox.getValue()); + } + if (audioPlayer.isPlaying()) { + audioPlayer.stop(); + audioPlayer = null; + testButton.setGraphic(new FontIcon(FontAwesomeType.PLAY)); + } else { + audioPlayer.play(); + Worker.runLater(() -> { + while (audioPlayer != null && audioPlayer.isPlaying()) { + try { + Thread.sleep(50); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } + if (audioPlayer != null) + audioPlayer.stop(); + Platform.runLater(() -> testButton.setGraphic(new FontIcon(FontAwesomeType.PLAY))); + }); + testButton.setGraphic(new FontIcon(FontAwesomeType.STOP)); + } + } + + @Override + public boolean isChanged() { + return isChanged; + } +} diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java new file mode 100644 index 0000000000000000000000000000000000000000..48c0508bcda7f0318cb90b64976c4725881eb146 --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java @@ -0,0 +1,182 @@ +package de.tobias.playpad.nawin.audio; + +import java.nio.file.Path; +import java.util.ArrayList; +import java.util.ConcurrentModificationException; +import java.util.Iterator; +import java.util.List; + +import de.tobias.playpad.audio.AudioHandler; +import de.tobias.playpad.audio.Soundcardable; +import de.tobias.playpad.pad.Pad; +import de.tobias.playpad.pad.PadStatus; +import de.tobias.playpad.pad.conntent.PadContent; +import de.tobias.playpad.settings.Profile; +import javafx.application.Platform; +import javafx.beans.property.ObjectProperty; +import javafx.beans.property.ReadOnlyObjectProperty; +import javafx.beans.property.SimpleObjectProperty; +import javafx.util.Duration; +import nativeaudio.NativeAudio; + +public class NativeAudioWinHandler extends AudioHandler implements Soundcardable { + + public static final String SOUND_CARD = "SoundCard"; + + private NativeAudio audioHandler; + private ObjectProperty<Duration> durationProperty; + private ObjectProperty<Duration> positionProperty; + + private static Thread positionThread; + private static List<NativeAudioWinHandler> playedHandlers = new ArrayList<>(); + private static final int SLEEP_TIME_POSITION = 50; + + static { + positionThread = new Thread(() -> { + while (true) { + try { + if (playedHandlers.isEmpty()) { + synchronized (positionThread) { + positionThread.wait(); + } + } + + for (Iterator<NativeAudioWinHandler> iterator = playedHandlers.iterator(); iterator.hasNext();) { + NativeAudioWinHandler handler = iterator.next(); + Pad pad = handler.getContent().getPad(); + + if (handler.audioHandler != null) { + if (!handler.audioHandler.isPlaying()) { + if (!pad.getPadSettings().isLoop()) { + System.out.println("Stop"); + pad.setEof(true); + + // Remove from Loop and Stop + iterator.remove(); + Platform.runLater(() -> pad.setStatus(PadStatus.STOP)); + } + } + } + + Duration position = Duration.millis(handler.audioHandler.getPosition()); + + // Update der Zeit + Platform.runLater(() -> handler.positionProperty.set(position)); + } + + Thread.sleep(SLEEP_TIME_POSITION); + } catch (InterruptedException e) {} catch (ConcurrentModificationException e) {} catch (Exception e) { + e.printStackTrace(); + } + } + }); + + positionThread.start(); + } + + public NativeAudioWinHandler(PadContent content) { + super(content); + durationProperty = new SimpleObjectProperty<>(); + positionProperty = new SimpleObjectProperty<>(); + } + + @Override + public void play() { + audioHandler.setLoop(getContent().getPad().getPadSettings().isLoop()); + + audioHandler.play(); + + boolean start = false; + if (playedHandlers.isEmpty()) { + start = true; + } + + if (!playedHandlers.contains(this)) + playedHandlers.add(this); + if (start) { + synchronized (positionThread) { + positionThread.notify(); + } + } + } + + @Override + public void pause() { + audioHandler.pause(); + if (playedHandlers.contains(this)) + playedHandlers.remove(this); + } + + @Override + public void stop() { + audioHandler.stop(); + if (playedHandlers.contains(this)) + playedHandlers.remove(this); + } + + @Override + public Duration getPosition() { + return positionProperty.get(); + } + + @Override + public ReadOnlyObjectProperty<Duration> positionProperty() { + return positionProperty; + } + + @Override + public Duration getDuration() { + return durationProperty.get(); + } + + @Override + public ReadOnlyObjectProperty<Duration> durationProperty() { + return durationProperty; + } + + @Override + public void setVolume(double volume) { + audioHandler.setVolume((float) volume); + } + + @Override + public boolean isMediaLoaded() { + return audioHandler != null; + } + + @Override + public void loadMedia(Path[] paths) { + Platform.runLater(() -> { + if (getContent().getPad().isPadVisible()) { + getContent().getPad().getController().getView().showBusyView(true); + } + }); + if (audioHandler == null) + audioHandler = new NativeAudio(); + audioHandler.load(paths[0].toString()); + + String name = (String) Profile.currentProfile().getProfileSettings().getAudioUserInfo() + .get(NativeAudioWinHandler.SOUND_CARD); + audioHandler.setDevice(name); + + Platform.runLater(() -> { + durationProperty.set(Duration.millis(audioHandler.getDuration())); + getContent().getPad().setStatus(PadStatus.READY); + if (getContent().getPad().isPadVisible()) { + getContent().getPad().getController().getView().showBusyView(false); + } + }); + } + + @Override + public void unloadMedia() { + audioHandler.unload(); + audioHandler = null; + } + + @Override + public void setOutputDevice(String name) { + audioHandler.setDevice(name); + } + +} diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandlerConnect.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandlerConnect.java new file mode 100644 index 0000000000000000000000000000000000000000..57239777045fb95a608f912e6719ea4fde6eb935 --- /dev/null +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandlerConnect.java @@ -0,0 +1,42 @@ +package de.tobias.playpad.nawin.audio; + +import de.tobias.playpad.audio.AudioCapability; +import de.tobias.playpad.audio.AudioHandler; +import de.tobias.playpad.audio.AudioHandlerConnect; +import de.tobias.playpad.pad.conntent.PadContent; +import de.tobias.playpad.viewcontroller.AudioHandlerViewController; + +public class NativeAudioWinHandlerConnect extends AudioHandlerConnect { + + @Override + public AudioHandler createAudioHandler(PadContent content) { + return new NativeAudioWinHandler(content); + } + + @Override + public AudioHandlerViewController getAudioHandlerSettingsViewController() { + return null; + } + + @Override + public String getType() { + return "NativeWin"; + } + + @Override + public boolean isFeatureAvaiable(AudioCapability audioCapability) { + for (Class<?> clazz : NativeAudioWinHandler.class.getInterfaces()) { + if (clazz.equals(audioCapability.getAudioFeature())) + return true; + } + return false; + } + + @Override + public AudioHandlerViewController getAudioFeatureSettings(AudioCapability audioCapablility) { + if (audioCapablility == AudioCapability.SOUNDCARD) { + return new NativeAudioSettingsViewController(); + } + return null; + } +}