Skip to content

Commit cb104a3

Browse files
committed
Removed .wav file support
Removed .wav support due to issues with compiling .jar file Reconstructing Audio interfacing classes
1 parent b814fbf commit cb104a3

File tree

8 files changed

+19
-83
lines changed

8 files changed

+19
-83
lines changed

res/music/small.mp3

2.16 KB
Binary file not shown.

res/sfx/smallProjectile.wav

-9.95 KB
Binary file not shown.

src/com/redomar/game/audio/AudioEffect.java

Lines changed: 0 additions & 54 deletions
This file was deleted.

src/com/redomar/game/audio/AudioHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package com.redomar.game.audio;
22

33
import javax.sound.sampled.*;
4+
import java.io.File;
45

56

67
public class AudioHandler {
@@ -9,6 +10,14 @@ public class AudioHandler {
910
private boolean active = false;
1011

1112
public AudioHandler(String path){
13+
initiate(path);
14+
}
15+
16+
public AudioHandler(File file){
17+
initiate(file.toString());
18+
}
19+
20+
public void initiate(String path){
1221
try{
1322
AudioInputStream audioInputStream = AudioSystem.getAudioInputStream(getClass().getResourceAsStream(path));
1423
AudioFormat baseformat = audioInputStream.getFormat();

src/com/redomar/game/entities/Player.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
import com.redomar.game.Game;
44
import com.redomar.game.InputHandler;
5-
import com.redomar.game.audio.AudioEffect;
65
import com.redomar.game.entities.efx.Swim;
76
import com.redomar.game.entities.projectiles.Medium;
87
import com.redomar.game.entities.projectiles.Projectile;

src/com/redomar/game/entities/projectiles/Small.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,19 @@
11
package com.redomar.game.entities.projectiles;
22

3-
import com.redomar.game.audio.AudioEffect;
3+
import com.redomar.game.audio.AudioHandler;
44
import com.redomar.game.gfx.Colours;
55
import com.redomar.game.gfx.Screen;
66
import com.redomar.game.level.LevelHandler;
77

8+
import java.io.File;
9+
810
public class Small extends Projectile{
911

1012
public static final int FIRE_RATE = 10;
1113

14+
public AudioHandler smallSound;
15+
public File file;
16+
1217
public Small(LevelHandler level, int x, int y, double dir) {
1318
super(level, x, y, dir);
1419
range = 125 - life.nextInt(30);
@@ -18,10 +23,10 @@ public Small(LevelHandler level, int x, int y, double dir) {
1823
nx = speed * Math.cos(angle);
1924
ny = speed * Math.sin(angle);
2025

21-
//smallSound.setVolume(-15);
26+
file = new File("/music/small.mp3");
2227

23-
AudioEffect smallSound;
24-
smallSound = new AudioEffect("/sfx/smallProjectile.wav");
28+
smallSound = new AudioHandler(file);
29+
smallSound.setVolume(-15);
2530
smallSound.play();
2631
}
2732

src/com/redomar/game/menu/Menu.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package com.redomar.game.menu;
22

33
import com.redomar.game.Game;
4-
import com.redomar.game.audio.AudioEffect;
54
import com.redomar.game.audio.AudioHandler;
6-
import com.redomar.game.entities.Player;
75
import com.redomar.game.lib.Font;
86
import com.redomar.game.lib.Mouse;
97
import com.thehowtotutorial.splashscreen.JSplash;
@@ -24,7 +22,7 @@ public class Menu implements Runnable {
2422
private static final String NAME = "Menu";
2523

2624
private static boolean running = false;
27-
private static boolean selectedStart = false;
25+
private static boolean selectedStart = true;
2826
private static boolean selectedExit = false;
2927
private static boolean gameOver = false;
3028

test/com/redomar/game/audio/AudioEffectTest.java

Lines changed: 0 additions & 21 deletions
This file was deleted.

0 commit comments

Comments
 (0)