From f35fc861c758970c270eaaa3d22f291a52ce0199 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20Ple=C3=9F?= Date: Tue, 26 Jun 2012 18:33:27 +0200 Subject: [PATCH] fixing mpd (again and again) edited game, if time is >60 song will not change --- src/de/ctdo/crashtest/game/TheGame.java | 12 ++++-- src/de/ctdo/crashtest/mpd/MPDController.java | 40 ++++++++++---------- 2 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/de/ctdo/crashtest/game/TheGame.java b/src/de/ctdo/crashtest/game/TheGame.java index 9c10fd3..2664f68 100644 --- a/src/de/ctdo/crashtest/game/TheGame.java +++ b/src/de/ctdo/crashtest/game/TheGame.java @@ -90,7 +90,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent break; case TABLE_GAME_WRONG: extraSoundControl.playJingle("block"); - mpdController.playSong("crashtest", "table_game_one"); + if(!startedHurrySound) { + mpdController.playSong("crashtest", "table_game_one"); + } bunti.setLampel(true,false,false); sproing = true; break; @@ -100,7 +102,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent extraSoundControl.playJingle("jump"); if(machine.getLastState() != Statemachine.state.TABLE_GAME_WRONG) { - mpdController.playSong("crashtest", "table_game_one"); + if(!startedHurrySound) { + mpdController.playSong("crashtest", "table_game_one"); + } } bunti.setLampel(false, true, false); @@ -128,7 +132,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent guiControl.showCountDown(true); break; case TABLE_GAME_FOUR: - mpdController.playSong("crashtest", "table_game_four"); + if(!startedHurrySound) { + mpdController.playSong("crashtest", "table_game_four"); + } extraSoundControl.playJingle("jump"); diff --git a/src/de/ctdo/crashtest/mpd/MPDController.java b/src/de/ctdo/crashtest/mpd/MPDController.java index ed0213d..7ae6a25 100644 --- a/src/de/ctdo/crashtest/mpd/MPDController.java +++ b/src/de/ctdo/crashtest/mpd/MPDController.java @@ -43,10 +43,10 @@ public class MPDController implements IMPDController { System.out.println("playSong: " + artist + " - " + title); if(mpd != null) { - Runnable r = new Runnable() { + /*Runnable r = new Runnable() { @Override public void run() { - synchronized (mpd) { + synchronized (mpd) { */ addToPlayListIfNeeded(artist, title); try { @@ -76,11 +76,11 @@ public class MPDController implements IMPDController { } catch (InterruptedException e) { Logger.sLog("MPD error: " + e.getMessage()); } - } + /*} } }; - new Thread(r).start(); + new Thread(r).start(); */ } } @@ -92,10 +92,10 @@ public class MPDController implements IMPDController { @Override public void addToPlayList(final String artist, final String title) { if(mpd != null) { - Runnable r = new Runnable() { + /*Runnable r = new Runnable() { @Override public void run() { - synchronized (mpd) { + synchronized (mpd) { */ MPDDatabase db = mpd.getMPDDatabase(); MPDPlaylist playlist = mpd.getMPDPlaylist(); @@ -115,21 +115,21 @@ public class MPDController implements IMPDController { } catch (MPDPlaylistException e) { Logger.sLog("MPD error: " + e.getMessage()); } - } + /*} } }; - new Thread(r).start(); + new Thread(r).start(); */ } } @Override public void skipRandomStart() { if(mpd != null) { - Runnable r = new Runnable() { + /*Runnable r = new Runnable() { @Override public void run() { - synchronized (mpd) { + synchronized (mpd) {*/ MPDPlayer player = mpd.getMPDPlayer(); try { @@ -148,11 +148,11 @@ public class MPDController implements IMPDController { e.printStackTrace(); } catch (InterruptedException ignored) { } - } + /*} } }; - new Thread(r).start(); + new Thread(r).start(); */ } } @@ -163,10 +163,10 @@ public class MPDController implements IMPDController { @Override public void setVolume(final int volume) { if(mpd != null) { - Runnable r = new Runnable() { + /*Runnable r = new Runnable() { @Override public void run() { - synchronized (mpd) { + synchronized (mpd) {*/ try { mpd.getMPDPlayer().setVolume(volume); } catch (MPDConnectionException e) { @@ -174,11 +174,11 @@ public class MPDController implements IMPDController { } catch (MPDPlayerException e) { Logger.sLog("MPD error: " + e.getMessage()); } - } + /*} } }; - new Thread(r).start(); + new Thread(r).start();*/ } } @@ -188,10 +188,10 @@ public class MPDController implements IMPDController { @Override public void clearPlaylist() { if(mpd != null) { - Runnable r = new Runnable() { + /*Runnable r = new Runnable() { @Override public void run() { - synchronized (mpd) { + synchronized (mpd) {*/ try { MPDPlaylist playlist = mpd.getMPDPlaylist(); playlist.clearPlaylist(); @@ -204,11 +204,11 @@ public class MPDController implements IMPDController { } catch (MPDPlayerException e) { Logger.sLog("MPD error: " + e.getMessage()); } - } + /*} } }; - new Thread(r).start(); + new Thread(r).start(); */ } }