Fixed volume resetting between songs.
This commit is contained in:
parent
9ea708d20a
commit
962846f397
@ -18,6 +18,7 @@ public class Player {
|
|||||||
private Thread thread;
|
private Thread thread;
|
||||||
private Song currentSong;
|
private Song currentSong;
|
||||||
private PlayerCallbackInterface callbackInterface;
|
private PlayerCallbackInterface callbackInterface;
|
||||||
|
private int currentVolume = 100;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manages GStreamer based playback operations.
|
* Manages GStreamer based playback operations.
|
||||||
@ -40,6 +41,7 @@ public class Player {
|
|||||||
});
|
});
|
||||||
callbackThing.start();
|
callbackThing.start();
|
||||||
});
|
});
|
||||||
|
currentVolume = getVolume();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -62,6 +64,7 @@ public class Player {
|
|||||||
playBin.setURI(songFile.toURI());
|
playBin.setURI(songFile.toURI());
|
||||||
internalThread = new InternalThread();
|
internalThread = new InternalThread();
|
||||||
thread = new Thread(internalThread);
|
thread = new Thread(internalThread);
|
||||||
|
setVolume(currentVolume);
|
||||||
playBin.play();
|
playBin.play();
|
||||||
thread.start();
|
thread.start();
|
||||||
while (true) {
|
while (true) {
|
||||||
@ -115,6 +118,7 @@ public class Player {
|
|||||||
* @param volume New volume in percent.
|
* @param volume New volume in percent.
|
||||||
*/
|
*/
|
||||||
public void setVolume(int volume){
|
public void setVolume(int volume){
|
||||||
|
currentVolume = volume;
|
||||||
playBin.setVolumePercent(volume);
|
playBin.setVolumePercent(volume);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user