Skip to content

Commit

Permalink
add simple sfx for opening and closing apps
Browse files Browse the repository at this point in the history
  • Loading branch information
einaskoi committed May 13, 2026
1 parent 1df6c53 commit f1cc617
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

public class AudioManager {

private AudioManager instance = new AudioManager();
private static AudioManager instance = new AudioManager();
private Map<SoundEffect, AudioClip> sounds = new EnumMap<>(SoundEffect.class);
private double volume = 1.0;

Expand All @@ -25,7 +25,7 @@ public AudioManager() {
}
}

public AudioManager getInstance() {
public static AudioManager getInstance() {
return instance;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

public enum SoundEffect {

OPEN_APP("/Audio/mouse_click.wav"),
CLOSE_APP("/Audio/mouse_click.wav");
OPEN_APP("/Audio/open_app.wav"),
CLOSE_APP("/Audio/close_app.wav");

private String path;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package edu.ntnu.idi.idatt2003.gruppe42.Controller;

import edu.ntnu.idi.idatt2003.gruppe42.Audio.AudioManager;
import edu.ntnu.idi.idatt2003.gruppe42.Audio.SoundEffect;
import edu.ntnu.idi.idatt2003.gruppe42.Model.App;
import edu.ntnu.idi.idatt2003.gruppe42.View.Popup;
import java.util.List;
Expand All @@ -12,6 +14,7 @@
public final class PopupsController {

private final List<Popup> popups;
private AudioManager audioManager = AudioManager.getInstance();

public PopupsController(List<Popup> popups) {
this.popups = popups;
Expand All @@ -35,6 +38,7 @@ public boolean show(App type) {
popup.getRoot().autosize();
popup.getRoot().toFront();
});
audioManager.play(SoundEffect.OPEN_APP);
return true;
}

Expand All @@ -43,6 +47,7 @@ public boolean hide(Popup popup) {
return false;
}
popup.getRoot().setVisible(false);
audioManager.play(SoundEffect.CLOSE_APP);
return true;
}

Expand Down
Binary file added src/main/resources/Audio/close_app.wav
Binary file not shown.
Binary file added src/main/resources/Audio/open_app.wav
Binary file not shown.

0 comments on commit f1cc617

Please sign in to comment.