Skip to content

add simple sfx for opening and closing apps #95

Merged
merged 1 commit into from
May 13, 2026
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.