Skip to content

Commit c0556d8

Browse files
committed
source cleanup
1 parent 2697397 commit c0556d8

File tree

69 files changed

+942
-959
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+942
-959
lines changed

src/main/java/project_16x16/Audio.java

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
/**
1010
* Provides static methods for playing game audio: background music and sound
1111
* effects.
12-
*
12+
*
1313
* @author micycle1
1414
*
1515
*/
@@ -28,8 +28,7 @@ public final class Audio {
2828
public enum BGM {
2929
TEST0("first_theme.mp3"), // TODO
3030
TEST1("cyberSynthwave.mp3"), // TODO
31-
TEST2("First_level_take_1.mp3"),
32-
TEST3("Intro_Title_Pause_Screen_Take1_Loopable.mp3");
31+
TEST2("First_level_take_1.mp3"), TEST3("Intro_Title_Pause_Screen_Take1_Loopable.mp3");
3332

3433
private String filename;
3534

@@ -64,7 +63,7 @@ public String getPath() {
6463

6564
/**
6665
* Call during setup to instantiate a connection to Minim (the audio backend).
67-
*
66+
*
6867
* @param s
6968
*/
7069
public static void assignApplet(SideScroller sideScroller) {
@@ -73,17 +72,15 @@ public static void assignApplet(SideScroller sideScroller) {
7372
AudioSample sample = minim.loadSample(sfx.getPath());
7473
if (sample != null) {
7574
SFX_MAP.put(sfx, sample);
76-
}
77-
else {
75+
} else {
7876
System.err.println(sfx.getPath() + " not found.");
7977
}
8078
}
8179
for (BGM bgm : BGM.values()) {
8280
AudioPlayer audioPlayer = minim.loadFile(bgm.getPath());
8381
if (audioPlayer != null) {
8482
BGM_MAP.put(bgm, audioPlayer);
85-
}
86-
else {
83+
} else {
8784
System.err.println(bgm.getPath() + " not found.");
8885
}
8986
}
@@ -94,24 +91,23 @@ public static void assignApplet(SideScroller sideScroller) {
9491
/**
9592
* Play a sound effect once. Can be called again before the sound finishes
9693
* playing.
97-
*
94+
*
9895
* @param sound sound effect name
9996
* @see #play(SFX, float)
10097
* @see ddf.minim.AudioSample#trigger()
10198
*/
10299
public static void play(SFX sound) {
103100
if (SFX_MAP.containsKey(sound)) {
104101
SFX_MAP.get(sound).trigger();
105-
}
106-
else {
102+
} else {
107103
System.err.println(sound.getPath() + " not found.");
108104
}
109105
}
110106

111107
/**
112108
* Plays a sound effect once (does not loop). Can be called again before the
113109
* sound finishes playing. The sound effect gain is specified with this method.
114-
*
110+
*
115111
* @param sound sound effect name
116112
* @param gain gain, in decibels (where negative is quieter). Default = 0.
117113
* @see #play(SFX)
@@ -121,8 +117,7 @@ public static void play(SFX sound, float gain) {
121117
if (SFX_MAP.containsKey(sound)) {
122118
SFX_MAP.get(sound).setGain(gain);
123119
SFX_MAP.get(sound).trigger();
124-
}
125-
else {
120+
} else {
126121
System.err.println(sound.getPath() + " not found.");
127122
}
128123
}
@@ -131,7 +126,7 @@ public static void play(SFX sound, float gain) {
131126
* Plays a background music track. Only one BGM track can play at once -- this
132127
* method stops any existing BGM track if it is different. BGM tracks loop by
133128
* default.
134-
*
129+
*
135130
* @param sound BGM track
136131
* @see #play(BGM, float)
137132
*/
@@ -148,8 +143,7 @@ public static void play(BGM sound) {
148143
if (BGM_MAP.containsKey(sound)) {
149144
BGM_MAP.get(sound).setGain(gainBGM);
150145
BGM_MAP.get(sound).loop();
151-
}
152-
else {
146+
} else {
153147
System.err.println(sound.getPath() + " not found.");
154148
}
155149
}
@@ -158,7 +152,7 @@ public static void play(BGM sound) {
158152
* Plays a background music track at a specific gain (volume). Only one BGM
159153
* track can play at once -- this method stops any existing BGM track. BGM
160154
* tracks loop by default.
161-
*
155+
*
162156
* @param sound BGM track
163157
* @param gain gain, in decibels (where negative is quieter). Default = 0.
164158
* @see #play(BGM)
@@ -167,15 +161,14 @@ public static void play(BGM sound, float gain) {
167161
if (BGM_MAP.containsKey(sound)) {
168162
BGM_MAP.get(sound).setGain(gain);
169163
play(sound);
170-
}
171-
else {
164+
} else {
172165
System.err.println(sound.getPath() + " not found.");
173166
}
174167
}
175168

176169
/**
177170
* Sets gain (volume) for background music.
178-
*
171+
*
179172
* @param gain gain, in decibels (where negative is quieter). Default = 0.
180173
*/
181174
public static void setGainBGM(float gain) {
@@ -185,7 +178,7 @@ public static void setGainBGM(float gain) {
185178

186179
/**
187180
* Sets gain (volume) for sound effects.
188-
*
181+
*
189182
* @param gain gain, in decibels (where negative is quieter). Default = 0.
190183
*/
191184
public static void setGainSFX(float gain) {
@@ -212,7 +205,7 @@ public static void unMute() {
212205
/**
213206
* Stops Minim and releases all audio resources. Call when application is
214207
* closed.
215-
*
208+
*
216209
* @see Minim#stop()
217210
*/
218211
public static void exit() {

0 commit comments

Comments
 (0)