Mercurial > hg > ristipolku
diff game/SoundManager.java @ 192:8dbaa093c562
Improve debug message handling.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Tue, 23 Apr 2019 13:00:25 +0300 |
parents | e8eeac403e5f |
children | bd3cde4bc15c |
line wrap: on
line diff
--- a/game/SoundManager.java Thu Apr 04 12:47:29 2019 +0300 +++ b/game/SoundManager.java Tue Apr 23 13:00:25 2019 +0300 @@ -36,7 +36,7 @@ int numThreads = Math.min(maxSounds, getMaxSimultaneousSounds(playbackFormat)); - System.out.print("SMGR.SoundManager() initializing with " + numThreads +" max sounds\n"); + G.debug("SMGR.SoundManager() initializing with " + numThreads +" max sounds\n"); setDaemon(true); alive = true; @@ -62,11 +62,11 @@ DataLine.Info lineInfo = new DataLine.Info(SourceDataLine.class, playbackFormat); Mixer.Info[] info = AudioSystem.getMixerInfo(); - System.out.print("SMGR.getMaxSimultaneousSounds() mixer information:\n"); + G.debug("SMGR.getMaxSimultaneousSounds() mixer information:\n"); Mixer.Info select = null; for (Mixer.Info i : info) { - System.out.print(" - '"+i.getName()+"'\n"); + G.debug(" - '"+i.getName()+"'\n"); if (i.getName().equals("Java Sound Audio Engine")) select = i; } @@ -74,13 +74,13 @@ Mixer mixer = AudioSystem.getMixer(select); Mixer.Info i = mixer.getMixerInfo(); - System.out.print(" * selected='"+i.getName()+"'\n"); + G.debug(" * selected='"+i.getName()+"'\n"); int maxLines = mixer.getMaxLines(lineInfo); if (maxLines == AudioSystem.NOT_SPECIFIED) maxLines = 8; - System.out.print(" * maxLines="+maxLines+"\n"); + G.debug(" * maxLines="+maxLines+"\n"); return maxLines; } @@ -88,18 +88,18 @@ protected void cleanUp() { - System.out.print("SMGR.cleanUp()\n"); + G.debug("SMGR.cleanUp()\n"); // signal to unpause setPaused(false); - System.out.print("SMGR.cleanUp(): closing mixer\n"); + G.debug("SMGR.cleanUp(): closing mixer\n"); // close the mixer (stops any running sounds) Mixer mixer = AudioSystem.getMixer(null); if (mixer.isOpen()) mixer.close(); - System.out.print("SMGR.cleanUp(): leaving\n"); + G.debug("SMGR.cleanUp(): leaving\n"); } @@ -168,7 +168,7 @@ ResourceLoader res = new ResourceLoader(filename); if (res == null || res.getStream() == null) { - System.out.print("Could not load audio resource '"+ filename +"'.\n"); + G.debug("Could not load audio resource '"+ filename +"'.\n"); return null; } try { @@ -176,7 +176,7 @@ } catch (Exception ex) { - System.out.print("Could not get AudioInputStream for '"+ filename +"'\n"); + G.debug("Could not get AudioInputStream for '"+ filename +"'\n"); return null; } } @@ -223,7 +223,7 @@ public InputStream play(InputStream is) { - System.out.print("SMGR.play(is="+is+")\n"); + G.debug("SMGR.play(is="+is+")\n"); if (is != null) { runTask(new SoundPlayer(is)); @@ -251,7 +251,7 @@ SourceDataLine line; DataLine.Info lineInfo = new DataLine.Info(SourceDataLine.class, playbackFormat); - System.out.print("SMGR.threadStarted(): "+lineInfo.toString()+"\n"); + G.debug("SMGR.threadStarted(): "+lineInfo.toString()+"\n"); try { line = (SourceDataLine) AudioSystem.getLine(lineInfo); @@ -259,7 +259,7 @@ } catch (LineUnavailableException ex) { - System.out.print("SMGR.threadStarted() line unavailable!\n"); + G.debug("SMGR.threadStarted() line unavailable!\n"); // the line is unavailable - signal to end this thread Thread.currentThread().interrupt(); return; @@ -286,7 +286,7 @@ protected void threadStopped() { - System.out.print("SMGR.threadStopped()\n"); + G.debug("SMGR.threadStopped()\n"); SourceDataLine line = (SourceDataLine) localLine.get(); if (line != null) { @@ -382,11 +382,11 @@ public synchronized void close() { - System.out.print("SMGR.close()\n"); + G.debug("SMGR.close()\n"); if (alive) { - System.out.print("SMGR.close(): alive queue clear\n"); + G.debug("SMGR.close(): alive queue clear\n"); // Clear queue alive = false; queue.clear(); @@ -394,13 +394,13 @@ } cleanUp(); - System.out.print("SMGR.close(): leaving\n"); + G.debug("SMGR.close(): leaving\n"); } public void join() { - System.out.print("SMGR.join()\n"); + G.debug("SMGR.join()\n"); cleanUp(); synchronized (this)