From 962846f397c0a5118a0d8d1e3f2d1819aa538790 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Thu, 25 Feb 2016 20:28:10 +0000 Subject: [PATCH] Fixed volume resetting between songs. --- src/main/java/musicplayer/Player.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/musicplayer/Player.java b/src/main/java/musicplayer/Player.java index 123086f..c8a4160 100644 --- a/src/main/java/musicplayer/Player.java +++ b/src/main/java/musicplayer/Player.java @@ -18,6 +18,7 @@ public class Player { private Thread thread; private Song currentSong; private PlayerCallbackInterface callbackInterface; + private int currentVolume = 100; /** * Manages GStreamer based playback operations. @@ -40,6 +41,7 @@ public class Player { }); callbackThing.start(); }); + currentVolume = getVolume(); } /** @@ -62,6 +64,7 @@ public class Player { playBin.setURI(songFile.toURI()); internalThread = new InternalThread(); thread = new Thread(internalThread); + setVolume(currentVolume); playBin.play(); thread.start(); while (true) { @@ -115,6 +118,7 @@ public class Player { * @param volume New volume in percent. */ public void setVolume(int volume){ + currentVolume = volume; playBin.setVolumePercent(volume); }