Fixed volume resetting between songs.

This commit is contained in:
neviyn 2016-02-25 20:28:10 +00:00
parent 9ea708d20a
commit 962846f397

View File

@ -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);
}