Skip to content

Commit

Permalink
Merge pull request #33 from CodeDead/feature/audience-sounds
Browse files Browse the repository at this point in the history
Feature/audience sounds
  • Loading branch information
CodeDead committed May 27, 2022
2 parents b64fb10 + 66883b9 commit 56f880c
Show file tree
Hide file tree
Showing 16 changed files with 81 additions and 2 deletions.
Expand Up @@ -62,6 +62,9 @@ public AudioController(final IAudioTimer audioTimer) throws URISyntaxException {
mediaPlayers.put("zen", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/zen.mp3")).toURI().toString())));
mediaPlayers.put("coffee", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/coffee.mp3")).toURI().toString())));
mediaPlayers.put("zoo", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/zoo.mp3")).toURI().toString())));
mediaPlayers.put("networking", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/networking.mp3")).toURI().toString())));
mediaPlayers.put("tribal", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/tribal.mp3")).toURI().toString())));
mediaPlayers.put("football", new MediaPlayer(new Media(Objects.requireNonNull(getClass().getResource("/audio/football.mp3")).toURI().toString())));

mediaVolumes = new HashMap<>();
for (final Map.Entry<String, MediaPlayer> entry : mediaPlayers.entrySet()) {
Expand Down
Expand Up @@ -34,6 +34,12 @@

public final class MainWindowController implements IAudioTimer {

@FXML
private SoundPane snpFootball;
@FXML
private SoundPane snpTribal;
@FXML
private SoundPane snpNetworkingEvent;
@FXML
private SoundPane snpZoo;
@FXML
Expand Down Expand Up @@ -301,6 +307,11 @@ private void initialize() {
snpCoffee.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("coffee", newValue.doubleValue() / 100));
snpZoo.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("zoo", newValue.doubleValue() / 100));

// Audiences
snpNetworkingEvent.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("networking", newValue.doubleValue() / 100));
snpTribal.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("tribal", newValue.doubleValue() / 100));
snpFootball.getSlider().valueProperty().addListener((observableValue, oldValue, newValue) -> audioController.setPlayerVolume("football", newValue.doubleValue() / 100));

mniTimerEnabled.setOnAction(e ->
{
if (mniTimerEnabled.isSelected()) {
Expand Down Expand Up @@ -363,6 +374,9 @@ private void openSoundPreset(final String filePath) {
case "zen" -> snpZen.getSlider().setValue(entry.getValue() * 100);
case "coffee" -> snpCoffee.getSlider().setValue(entry.getValue() * 100);
case "zoo" -> snpZoo.getSlider().setValue(entry.getValue() * 100);
case "networking" -> snpNetworkingEvent.getSlider().setValue(entry.getValue() * 100);
case "tribal" -> snpTribal.getSlider().setValue(entry.getValue() * 100);
case "football" -> snpFootball.getSlider().setValue(entry.getValue() * 100);
default -> logger.info("Unknown key found: {}", entry.getKey());
}
}
Expand Down Expand Up @@ -427,6 +441,9 @@ private void resetAction() {
snpZen.getSlider().setValue(0);
snpCoffee.getSlider().setValue(0);
snpZoo.getSlider().setValue(0);
snpNetworkingEvent.getSlider().setValue(0);
snpTribal.getSlider().setValue(0);
snpFootball.getSlider().setValue(0);
}

/**
Expand Down
Binary file added src/main/resources/audio/football.mp3
Binary file not shown.
Binary file added src/main/resources/audio/networking.mp3
Binary file not shown.
Binary file added src/main/resources/audio/tribal.mp3
Binary file not shown.
Binary file added src/main/resources/images/football.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/networking.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/main/resources/images/tribal.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/main/resources/translations/OpalApplication.properties
Expand Up @@ -67,3 +67,7 @@ Frogs=Frogs
Zen=Zen
Coffee=Coffee
Zoo=Zoo
Audiences=Audiences
NetworkingEvent=Networking event
TribalFestival=Tribal festival
Football=Football
@@ -1,4 +1,4 @@
About=Über
About=Über
AboutText=Opal wurde erstellt von: DeadLine\n\nAudio: ZapSplat.com\nBilder: Remix Icon\nDesign: Modena\nÜbersetzung: github.com/uDEV2019\nVersion: 1.0.2\n\nCopyright © 2022 CodeDead
AboutWindowError=Über-Dialog konnte nicht geöffnet werden!
AboutWindowTitle=Opal - Über
Expand Down Expand Up @@ -67,3 +67,7 @@ Frogs=Frösche
Zen=Zen
Coffee=Kaffee
Zoo=Zoo
Audiences=Publikum
NetworkingEvent=Netzwerkveranstaltung
TribalFestival=Stammesfest
Football=Football
Expand Up @@ -67,3 +67,7 @@ Frogs=Frogs
Zen=Zen
Coffee=Coffee
Zoo=Zoo
Audiences=Audiences
NetworkingEvent=Networking event
TribalFestival=Tribal festival
Football=Football
Expand Up @@ -67,3 +67,7 @@ Frogs=Ranas
Zen=Zen
Coffee=Café
Zoo=Zoo
Audiences=Audiencias
NetworkingEvent=Evento de redes
TribalFestival=Fiesta tribal
Football=Fútbol
Expand Up @@ -67,3 +67,7 @@ Frogs=Crapauds
Zen=Zen
Coffee=Café
Zoo=Zoo
Audiences=Publics
NetworkingEvent=Événement de réseautage
TribalFestival=Fête tribale
Football=Football
Expand Up @@ -67,3 +67,7 @@ Frogs=Kikkers
Zen=Zen
Coffee=Koffie
Zoo=Zoo
Audiences=Publiek
NetworkingEvent=Netwerkbijeenkomst
TribalFestival=Stammenfestival
Football=Voetbal
Expand Up @@ -67,3 +67,7 @@ Frogs=Лягушки
Zen=дзен
Coffee=Кофе
Zoo=Зоопарк
Audiences=Аудитории
NetworkingEvent=Сетевое мероприятие
TribalFestival=Племенной фестиваль
Football=Футбол
33 changes: 32 additions & 1 deletion src/main/resources/windows/MainWindow.fxml
Expand Up @@ -73,6 +73,8 @@
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
<RowConstraints/>
</rowConstraints>

<columnConstraints>
Expand Down Expand Up @@ -169,7 +171,7 @@
image="/images/coffee.png"/>
</GridPane>

<Label GridPane.rowIndex="4" GridPane.columnIndex="1" text="%Other">
<Label GridPane.rowIndex="4" GridPane.columnIndex="1" text="%Audiences">
<font>
<Font name="System Bold" size="14"/>
</font>
Expand All @@ -180,6 +182,35 @@

<GridPane GridPane.rowIndex="5" GridPane.columnIndex="1"
style="-fx-background-color: white;-fx-background-radius: 10px;">
<rowConstraints>
<RowConstraints vgrow="ALWAYS"/>
<RowConstraints vgrow="ALWAYS"/>
<RowConstraints vgrow="ALWAYS"/>
</rowConstraints>

<columnConstraints>
<ColumnConstraints hgrow="ALWAYS"/>
</columnConstraints>

<SoundPane fx:id="snpNetworkingEvent" GridPane.rowIndex="0" volume="0" name="%NetworkingEvent"
image="/images/networking.png"/>
<SoundPane fx:id="snpTribal" GridPane.rowIndex="1" volume="0" name="%TribalFestival"
image="/images/tribal.png"/>
<SoundPane fx:id="snpFootball" GridPane.rowIndex="2" volume="0" name="%Football"
image="/images/football.png"/>
</GridPane>

<Label GridPane.rowIndex="6" GridPane.columnIndex="1" text="%Other">
<font>
<Font name="System Bold" size="14"/>
</font>
<GridPane.margin>
<Insets left="5" right="5" bottom="10" top="10"/>
</GridPane.margin>
</Label>

<GridPane GridPane.rowIndex="7" GridPane.columnIndex="1"
style="-fx-background-color: white;-fx-background-radius: 10px;">
<GridPane.margin>
<Insets bottom="10"/>
</GridPane.margin>
Expand Down

0 comments on commit 56f880c

Please sign in to comment.