[Jrisk-cvs] SF.net SVN: domination-code:[2521] Domination
Brought to you by:
yuranet
|
From: <yu...@us...> - 2024-04-25 23:50:26
|
Revision: 2521
http://sourceforge.net/p/domination/code/2521
Author: yuranet
Date: 2024-04-25 23:50:24 +0000 (Thu, 25 Apr 2024)
Log Message:
-----------
music works on windows
Modified Paths:
--------------
Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/GameSound.java
Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/SimpleAudio.java
Domination/swingUI/lib/midletrunner.jar
Modified: Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/GameSound.java
===================================================================
--- Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/GameSound.java 2024-04-21 12:09:37 UTC (rev 2520)
+++ Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/GameSound.java 2024-04-25 23:50:24 UTC (rev 2521)
@@ -113,7 +113,7 @@
});
}
catch (Exception ex) {
- Logger.getLogger(GameSound.class.getName()).log(Level.WARNING, "unable to load theme: " + theme, ex);
+ LOGGER.log(Level.WARNING, "unable to load theme: " + theme, ex);
}
finally {
if (currentMusicId != null) {
@@ -140,7 +140,7 @@
public void playSound(String audioId) {
- LOGGER.info("Playing sound with id: " + audioId);
+ LOGGER.fine("Playing sound with id: " + audioId);
if (soundEnabled && audioSystem != null && currentTheme != null) {
String audioFile = currentTheme.get(audioId);
@@ -152,15 +152,11 @@
public void playMusic(String audioId) {
currentMusicId = audioId;
-
- LOGGER.info("Playing music with id: " + currentMusicId);
-
playCurrentLoopedSound();
}
public void stopMusic() {
if (musicEnabled) {
- LOGGER.info("Stopping music with id: " + currentMusicId);
stopPlayingLoopedSound();
}
currentMusicId = null;
@@ -167,6 +163,7 @@
}
private void playCurrentLoopedSound() {
+ LOGGER.fine("Playing music with id: " + currentMusicId);
if (musicEnabled && audioSystem != null && currentTheme != null) {
String audioFile = currentTheme.get(currentMusicId);
if (audioFile != null) {
@@ -176,6 +173,7 @@
}
private void stopPlayingLoopedSound() {
+ LOGGER.fine("Stopping music with id: " + currentMusicId);
if (audioSystem != null && currentTheme != null) {
String audioFile = currentTheme.get(currentMusicId);
if (audioFile != null) {
Modified: Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/SimpleAudio.java
===================================================================
--- Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/SimpleAudio.java 2024-04-21 12:09:37 UTC (rev 2520)
+++ Domination/sharedUI/src_mapstore_lobby/net/yura/domination/audio/SimpleAudio.java 2024-04-25 23:50:24 UTC (rev 2521)
@@ -24,7 +24,6 @@
//Player player = Manager.createPlayer(RiskUtil.openStream(fileName), "audio/basic");
Player player = Manager.createPlayer("file:///android_asset/" + fileName);
- player.addPlayerListener(this); // TODO do we need this?
return player;
}
@@ -53,8 +52,12 @@
@Override
public void playerUpdate(Player player, String event, Object eventData) {
- // TODO do i need to do something about this?
- // do i need to close the player?
+ try {
+ player.stop();
+ }
+ catch (Exception ex) {
+ LOGGER.log(Level.WARNING, "unable to stop " + player, ex);
+ }
}
@Override
@@ -62,6 +65,10 @@
try {
Player player = currentPlayers.remove(audioFile);
if (player != null) {
+ if (player.getState() != Player.STARTED) {
+ LOGGER.log(Level.INFO, "player not started yet, will stop with listener: " + audioFile);
+ player.addPlayerListener(this);
+ }
player.stop();
}
else {
Modified: Domination/swingUI/lib/midletrunner.jar
===================================================================
(Binary files differ)
|