SoundController refactoring.

- Added enum classes SoundEffect and HitSound.
- Added a SoundComponent interface for sound effects and hit sounds, and extended playSound() and playHitSound() methods to play any SoundComponent.
- Moved features related to sample sets to the HitSound class, and rewrote sample sets as an internal enum class.

Signed-off-by: Jeffrey Han <itdelatrisu@gmail.com>
This commit is contained in:
Jeffrey Han
2015-01-07 19:29:51 -05:00
parent 3127571886
commit 1e806bc9c6
17 changed files with 365 additions and 219 deletions

View File

@@ -19,12 +19,13 @@
package itdelatrisu.opsu.states;
import itdelatrisu.opsu.MenuButton;
import itdelatrisu.opsu.MusicController;
import itdelatrisu.opsu.Opsu;
import itdelatrisu.opsu.OsuFile;
import itdelatrisu.opsu.OsuGroupNode;
import itdelatrisu.opsu.SoundController;
import itdelatrisu.opsu.Utils;
import itdelatrisu.opsu.audio.MusicController;
import itdelatrisu.opsu.audio.SoundController;
import itdelatrisu.opsu.audio.SoundEffect;
import java.text.SimpleDateFormat;
import java.util.Date;
@@ -355,14 +356,14 @@ public class MainMenu extends BasicGameState {
logoTimer = 0;
playButton.getImage().setAlpha(0f);
exitButton.getImage().setAlpha(0f);
SoundController.playSound(SoundController.SOUND_MENUHIT);
SoundController.playSound(SoundEffect.MENUHIT);
}
}
// other button actions (if visible)
else if (logoClicked) {
if (logo.contains(x, y) || playButton.contains(x, y)) {
SoundController.playSound(SoundController.SOUND_MENUHIT);
SoundController.playSound(SoundEffect.MENUHIT);
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
} else if (exitButton.contains(x, y)) {
Options.saveOptions();
@@ -385,9 +386,9 @@ public class MainMenu extends BasicGameState {
logoTimer = 0;
playButton.getImage().setAlpha(0f);
exitButton.getImage().setAlpha(0f);
SoundController.playSound(SoundController.SOUND_MENUHIT);
SoundController.playSound(SoundEffect.MENUHIT);
} else {
SoundController.playSound(SoundController.SOUND_MENUHIT);
SoundController.playSound(SoundEffect.MENUHIT);
game.enterState(Opsu.STATE_SONGMENU, new FadeOutTransition(Color.black), new FadeInTransition(Color.black));
}
break;