From 4f8e766c422fca001decce684c2f7d3244979c2d Mon Sep 17 00:00:00 2001 From: tobias <thinkdifferent055@gmail.com> Date: Sat, 19 Nov 2016 23:18:37 +0100 Subject: [PATCH] Fixed bugs (duplicate project, setVolume NativeWin) --- .../playpad/project/ref/ProjectReferences.java | 4 ++-- .../nawin/audio/NativeAudioWinHandler.java | 16 ++++++++++------ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/PlayWallCore/src/de/tobias/playpad/project/ref/ProjectReferences.java b/PlayWallCore/src/de/tobias/playpad/project/ref/ProjectReferences.java index 67fc41d2..feabcc44 100644 --- a/PlayWallCore/src/de/tobias/playpad/project/ref/ProjectReferences.java +++ b/PlayWallCore/src/de/tobias/playpad/project/ref/ProjectReferences.java @@ -61,8 +61,8 @@ public final class ProjectReferences { } private static void duplicateFiles(ProjectReference currentProject, ProjectReference newProjectReference) throws IOException { - Path oldPath = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, currentProject.getName()); - Path newPath = ApplicationUtils.getApplication().getPath(PathType.DOCUMENTS, newProjectReference.getName()); + Path oldPath = currentProject.getProjectPath(); + Path newPath = newProjectReference.getProjectPath(); Files.copy(oldPath, newPath, StandardCopyOption.COPY_ATTRIBUTES); } diff --git a/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java index 48c0508b..5d7853e0 100644 --- a/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java +++ b/PlayWallNativeWin/src/de/tobias/playpad/nawin/audio/NativeAudioWinHandler.java @@ -32,7 +32,8 @@ public class NativeAudioWinHandler extends AudioHandler implements Soundcardable private static final int SLEEP_TIME_POSITION = 50; static { - positionThread = new Thread(() -> { + positionThread = new Thread(() -> + { while (true) { try { if (playedHandlers.isEmpty()) { @@ -136,7 +137,9 @@ public class NativeAudioWinHandler extends AudioHandler implements Soundcardable @Override public void setVolume(double volume) { - audioHandler.setVolume((float) volume); + if (audioHandler != null) { + audioHandler.setVolume((float) volume); + } } @Override @@ -146,7 +149,8 @@ public class NativeAudioWinHandler extends AudioHandler implements Soundcardable @Override public void loadMedia(Path[] paths) { - Platform.runLater(() -> { + Platform.runLater(() -> + { if (getContent().getPad().isPadVisible()) { getContent().getPad().getController().getView().showBusyView(true); } @@ -155,11 +159,11 @@ public class NativeAudioWinHandler extends AudioHandler implements Soundcardable audioHandler = new NativeAudio(); audioHandler.load(paths[0].toString()); - String name = (String) Profile.currentProfile().getProfileSettings().getAudioUserInfo() - .get(NativeAudioWinHandler.SOUND_CARD); + String name = (String) Profile.currentProfile().getProfileSettings().getAudioUserInfo().get(NativeAudioWinHandler.SOUND_CARD); audioHandler.setDevice(name); - Platform.runLater(() -> { + Platform.runLater(() -> + { durationProperty.set(Duration.millis(audioHandler.getDuration())); getContent().getPad().setStatus(PadStatus.READY); if (getContent().getPad().isPadVisible()) { -- GitLab