fixing mpd (again and again)

edited game, if time is >60 song will not change
This commit is contained in:
Lucas Pleß 2012-06-26 18:33:27 +02:00
parent e300e2325c
commit f35fc861c7
2 changed files with 29 additions and 23 deletions

View File

@ -90,7 +90,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
break; break;
case TABLE_GAME_WRONG: case TABLE_GAME_WRONG:
extraSoundControl.playJingle("block"); extraSoundControl.playJingle("block");
mpdController.playSong("crashtest", "table_game_one"); if(!startedHurrySound) {
mpdController.playSong("crashtest", "table_game_one");
}
bunti.setLampel(true,false,false); bunti.setLampel(true,false,false);
sproing = true; sproing = true;
break; break;
@ -100,7 +102,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
extraSoundControl.playJingle("jump"); extraSoundControl.playJingle("jump");
if(machine.getLastState() != Statemachine.state.TABLE_GAME_WRONG) { 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); bunti.setLampel(false, true, false);
@ -128,7 +132,9 @@ public class TheGame implements StatemachineListener, GuiEventListener, IRCEvent
guiControl.showCountDown(true); guiControl.showCountDown(true);
break; break;
case TABLE_GAME_FOUR: case TABLE_GAME_FOUR:
mpdController.playSong("crashtest", "table_game_four"); if(!startedHurrySound) {
mpdController.playSong("crashtest", "table_game_four");
}
extraSoundControl.playJingle("jump"); extraSoundControl.playJingle("jump");

View File

@ -43,10 +43,10 @@ public class MPDController implements IMPDController {
System.out.println("playSong: " + artist + " - " + title); System.out.println("playSong: " + artist + " - " + title);
if(mpd != null) { if(mpd != null) {
Runnable r = new Runnable() { /*Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
synchronized (mpd) { synchronized (mpd) { */
addToPlayListIfNeeded(artist, title); addToPlayListIfNeeded(artist, title);
try { try {
@ -76,11 +76,11 @@ public class MPDController implements IMPDController {
} catch (InterruptedException e) { } catch (InterruptedException e) {
Logger.sLog("MPD error: " + e.getMessage()); Logger.sLog("MPD error: " + e.getMessage());
} }
} /*}
} }
}; };
new Thread(r).start(); new Thread(r).start(); */
} }
} }
@ -92,10 +92,10 @@ public class MPDController implements IMPDController {
@Override @Override
public void addToPlayList(final String artist, final String title) { public void addToPlayList(final String artist, final String title) {
if(mpd != null) { if(mpd != null) {
Runnable r = new Runnable() { /*Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
synchronized (mpd) { synchronized (mpd) { */
MPDDatabase db = mpd.getMPDDatabase(); MPDDatabase db = mpd.getMPDDatabase();
MPDPlaylist playlist = mpd.getMPDPlaylist(); MPDPlaylist playlist = mpd.getMPDPlaylist();
@ -115,21 +115,21 @@ public class MPDController implements IMPDController {
} catch (MPDPlaylistException e) { } catch (MPDPlaylistException e) {
Logger.sLog("MPD error: " + e.getMessage()); Logger.sLog("MPD error: " + e.getMessage());
} }
} /*}
} }
}; };
new Thread(r).start(); new Thread(r).start(); */
} }
} }
@Override @Override
public void skipRandomStart() { public void skipRandomStart() {
if(mpd != null) { if(mpd != null) {
Runnable r = new Runnable() { /*Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
synchronized (mpd) { synchronized (mpd) {*/
MPDPlayer player = mpd.getMPDPlayer(); MPDPlayer player = mpd.getMPDPlayer();
try { try {
@ -148,11 +148,11 @@ public class MPDController implements IMPDController {
e.printStackTrace(); e.printStackTrace();
} catch (InterruptedException ignored) { } catch (InterruptedException ignored) {
} }
} /*}
} }
}; };
new Thread(r).start(); new Thread(r).start(); */
} }
} }
@ -163,10 +163,10 @@ public class MPDController implements IMPDController {
@Override @Override
public void setVolume(final int volume) { public void setVolume(final int volume) {
if(mpd != null) { if(mpd != null) {
Runnable r = new Runnable() { /*Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
synchronized (mpd) { synchronized (mpd) {*/
try { try {
mpd.getMPDPlayer().setVolume(volume); mpd.getMPDPlayer().setVolume(volume);
} catch (MPDConnectionException e) { } catch (MPDConnectionException e) {
@ -174,11 +174,11 @@ public class MPDController implements IMPDController {
} catch (MPDPlayerException e) { } catch (MPDPlayerException e) {
Logger.sLog("MPD error: " + e.getMessage()); Logger.sLog("MPD error: " + e.getMessage());
} }
} /*}
} }
}; };
new Thread(r).start(); new Thread(r).start();*/
} }
} }
@ -188,10 +188,10 @@ public class MPDController implements IMPDController {
@Override @Override
public void clearPlaylist() { public void clearPlaylist() {
if(mpd != null) { if(mpd != null) {
Runnable r = new Runnable() { /*Runnable r = new Runnable() {
@Override @Override
public void run() { public void run() {
synchronized (mpd) { synchronized (mpd) {*/
try { try {
MPDPlaylist playlist = mpd.getMPDPlaylist(); MPDPlaylist playlist = mpd.getMPDPlaylist();
playlist.clearPlaylist(); playlist.clearPlaylist();
@ -204,11 +204,11 @@ public class MPDController implements IMPDController {
} catch (MPDPlayerException e) { } catch (MPDPlayerException e) {
Logger.sLog("MPD error: " + e.getMessage()); Logger.sLog("MPD error: " + e.getMessage());
} }
} /*}
} }
}; };
new Thread(r).start(); new Thread(r).start(); */
} }
} }