/** * Gets a Java output line (SourceDataLine) that can play something with * the given audio format. * * @param af The audio format. * @return A SourceDataLine * @throws LineUnavailableException */ static public SourceDataLine getAnyJavaOutputLine( final AudioFormat af ) throws LineUnavailableException { // Convert the OpenIMAJ audio format to a Java Sound audio format object final javax.sound.sampled.AudioFormat audioFormat = af.getJavaAudioFormat(); // Create info to create an output data line final DataLine.Info info = new DataLine.Info( SourceDataLine.class, audioFormat ); // Get the output line to write to using the given // sample format we just created. return (SourceDataLine) AudioSystem.getLine( info ); }
/** * Gets a Java output line (SourceDataLine) that can play something with * the given audio format. * * @param af The audio format. * @return A SourceDataLine * @throws LineUnavailableException */ static public SourceDataLine getAnyJavaOutputLine( final AudioFormat af ) throws LineUnavailableException { // Convert the OpenIMAJ audio format to a Java Sound audio format object final javax.sound.sampled.AudioFormat audioFormat = af.getJavaAudioFormat(); // Create info to create an output data line final DataLine.Info info = new DataLine.Info( SourceDataLine.class, audioFormat ); // Get the output line to write to using the given // sample format we just created. return (SourceDataLine) AudioSystem.getLine( info ); }