Skip to content

Commit 9dcfa7e

Browse files
authored
Merge pull request #40 from CodeDead/feature/gong
* Added a gong sound
2 parents f0a5ab6 + 05f7c82 commit 9dcfa7e

12 files changed

+16
-1
lines changed

src/main/java/com/codedead/opal/controller/AudioController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ public AudioController(final IAudioTimer audioTimer) throws URISyntaxException {
6666
mediaPlayers.put("drumtribal", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/tribal2.mp3")).toURI().toString())));
6767
mediaPlayers.put("football", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/football.mp3")).toURI().toString())));
6868
mediaPlayers.put("sleepy", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/sleepy.mp3")).toURI().toString())));
69+
mediaPlayers.put("gong", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/gong.mp3")).toURI().toString())));
6970

7071
mediaVolumes = new HashMap<>();
7172
for (final Map.Entry<String, MediaPlayer> entry : mediaPlayers.entrySet()) {
@@ -142,7 +143,6 @@ public void setPlayerVolume(final String key, final double newVolume) {
142143
logger.debug("Setting volume for MediaPlayer with key {} to {}", key, newVolume);
143144

144145
final MediaPlayer player = mediaPlayers.get(key);
145-
146146
if (player == null)
147147
throw new NullPointerException(String.format("MediaPlayer with key %s cannot be found!", key));
148148

src/main/java/com/codedead/opal/controller/MainWindowController.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@
3333

3434
public final class MainWindowController implements IAudioTimer {
3535

36+
@FXML
37+
private SoundPane snpGong;
3638
@FXML
3739
private SoundPane snpDrumTribal;
3840
@FXML
@@ -313,6 +315,7 @@ private void initialize() {
313315
snpCoffee.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("coffee", newValue.doubleValue() / 100));
314316
snpZoo.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("zoo", newValue.doubleValue() / 100));
315317
snpSleepy.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("sleepy", newValue.doubleValue() / 100));
318+
snpGong.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("gong", newValue.doubleValue() / 100));
316319

317320
// Audiences
318321
snpNetworkingEvent.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("networking", newValue.doubleValue() / 100));
@@ -385,6 +388,7 @@ private void openSoundPreset(final String filePath) {
385388
case "football" -> snpFootball.getSlider().setValue(entry.getValue() * 100);
386389
case "sleepy" -> snpSleepy.getSlider().setValue(entry.getValue() * 100);
387390
case "drumtribal" -> snpDrumTribal.getSlider().setValue(entry.getValue() * 100);
391+
case "gong" -> snpGong.getSlider().setValue(entry.getValue() * 100);
388392
default -> logger.info("Unknown key found: {}", entry.getKey());
389393
}
390394
}
@@ -454,6 +458,7 @@ private void resetAction() {
454458
snpFootball.getSlider().setValue(0);
455459
snpSleepy.getSlider().setValue(0);
456460
snpDrumTribal.getSlider().setValue(0);
461+
snpGong.getSlider().setValue(0);
457462
}
458463

459464
/**

src/main/resources/audio/gong.mp3

22.8 KB
Binary file not shown.

src/main/resources/images/gong.png

1.04 KB
Loading

src/main/resources/translations/OpalApplication.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ TribalFestival=Tribal festival
7373
Football=Football
7474
Sleepy=Sleepy
7575
DrumTribalFestival=Drum tribal festival
76+
Gong=Gong

src/main/resources/translations/OpalApplication_de_DE.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ TribalFestival=Stammesfest
7373
Football=Football
7474
Sleepy=Schläfrig
7575
DrumTribalFestival=Stammesfest der Trommeln
76+
Gong=Klingel

src/main/resources/translations/OpalApplication_en_US.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ TribalFestival=Tribal festival
7373
Football=Football
7474
Sleepy=Sleepy
7575
DrumTribalFestival=Drum tribal festival
76+
Gong=Gong

src/main/resources/translations/OpalApplication_es_ES.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ TribalFestival=Fiesta tribal
7373
Football=Fútbol
7474
Sleepy=Somnoliento
7575
DrumTribalFestival=Festival tribal de tambores
76+
Gong=Gongo

src/main/resources/translations/OpalApplication_fr_FR.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ TribalFestival=Fête tribale
7373
Football=Football
7474
Sleepy=Somnolent
7575
DrumTribalFestival=Fête tribale du tambour
76+
Gong=Gong

src/main/resources/translations/OpalApplication_nl_NL.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,4 @@ TribalFestival=Stammenfestival
7373
Football=Voetbal
7474
Sleepy=Slaperig
7575
DrumTribalFestival=Drumstammenfestival
76+
Gong=Gong

0 commit comments

Comments
 (0)