mirror of
https://github.com/2OOP/pism.git
synced 2026-02-04 10:54:51 +00:00
"Fixed double sound bug"
This commit is contained in:
@@ -143,7 +143,7 @@ public final class OptionsMenu extends Menu {
|
|||||||
.addPostEvent(AudioEvents.GetCurrentVolume.class)
|
.addPostEvent(AudioEvents.GetCurrentVolume.class)
|
||||||
.onResponse(AudioEvents.GetCurrentVolumeReponse.class, event -> {
|
.onResponse(AudioEvents.GetCurrentVolumeReponse.class, event -> {
|
||||||
volumeSlider.setValue(event.currentVolume() * 100);
|
volumeSlider.setValue(event.currentVolume() * 100);
|
||||||
}).asyncPostEvent();
|
}, true).asyncPostEvent();
|
||||||
volumeSlider.setShowTickLabels(true);
|
volumeSlider.setShowTickLabels(true);
|
||||||
volumeSlider.setShowTickMarks(true);
|
volumeSlider.setShowTickMarks(true);
|
||||||
volumeSlider.setMajorTickUnit(25);
|
volumeSlider.setMajorTickUnit(25);
|
||||||
@@ -160,11 +160,8 @@ public final class OptionsMenu extends Menu {
|
|||||||
|
|
||||||
if (now - lastPlayed[0] >= cooldown) {
|
if (now - lastPlayed[0] >= cooldown) {
|
||||||
lastPlayed[0] = now;
|
lastPlayed[0] = now;
|
||||||
|
// new EventFlow().addPostEvent(new AudioEvents.clickButton())
|
||||||
int value = newVal.intValue();
|
// .asyncPostEvent(); // TODO: creates double sound bug, WHYYY????
|
||||||
valueLabel.setText(String.valueOf(value));
|
|
||||||
|
|
||||||
new EventFlow().addPostEvent(new AudioEvents.PlayEffect("soft-button-click.wav", false)).asyncPostEvent();
|
|
||||||
}
|
}
|
||||||
valueLabel.setText(String.valueOf(newVal.intValue()));
|
valueLabel.setText(String.valueOf(newVal.intValue()));
|
||||||
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(newVal.doubleValue()/100.0))
|
new EventFlow().addPostEvent(new AudioEvents.ChangeVolume(newVal.doubleValue()/100.0))
|
||||||
|
|||||||
@@ -128,6 +128,7 @@ public class SoundManager {
|
|||||||
mediaPlayer.play();
|
mediaPlayer.play();
|
||||||
activeMusic.add(mediaPlayer);
|
activeMusic.add(mediaPlayer);
|
||||||
logger.info("Playing background music: {}", ma.getFile().getName());
|
logger.info("Playing background music: {}", ma.getFile().getName());
|
||||||
|
logger.info("Background music next in line: {}", backgroundMusicQueue.peek().getFile().getName());
|
||||||
}
|
}
|
||||||
|
|
||||||
private long playSound(String audioFileName, boolean loop) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
private long playSound(String audioFileName, boolean loop) throws UnsupportedAudioFileException, LineUnavailableException, IOException {
|
||||||
@@ -150,7 +151,7 @@ public class SoundManager {
|
|||||||
clip.start();
|
clip.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
logger.info("Playing sound: {}", asset.getFile().getName());
|
logger.debug("Playing sound: {}", asset.getFile().getName());
|
||||||
|
|
||||||
// Generate id for clip
|
// Generate id for clip
|
||||||
long clipId = idGenerator.nextId();
|
long clipId = idGenerator.nextId();
|
||||||
|
|||||||
Reference in New Issue
Block a user