/** Does any clean up before closing. */ protected void cleanUp() { // signal to unpause setPaused(false); // close the mixer (stops any running sounds) Mixer mixer = AudioSystem.getMixer(null); if (mixer.isOpen()) { mixer.close(); } }
/** * Gets the maximum number of simultaneous sounds with the specified AudioFormat that the default * mixer can play. */ public static int getMaxSimultaneousSounds(AudioFormat playbackFormat) { DataLine.Info lineInfo = new DataLine.Info(SourceDataLine.class, playbackFormat); Mixer mixer = AudioSystem.getMixer(null); return mixer.getMaxLines(lineInfo); }