From mboxrd@z Thu Jan 1 00:00:00 1970 From: Steffen Sauder Subject: DMX6fire / ice1712: Long initialization time for playback with Java Date: Sun, 02 Nov 2003 23:12:05 +0100 Sender: alsa-devel-admin@lists.sourceforge.net Message-ID: <3FA58135.8050907@gmx.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050903040908060900080908" Return-path: Errors-To: alsa-devel-admin@lists.sourceforge.net List-Help: List-Post: List-Subscribe: , List-Unsubscribe: , List-Archive: To: alsa-devel@lists.sourceforge.net List-Id: alsa-devel@alsa-project.org This is a multi-part message in MIME format. --------------050903040908060900080908 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hello, I am working on an audio-application with java 1.4, and I noticed that with the current alsa-release the time neccessary to initialize my Terratec DMX6fire card for playback (in oss emulation mode) increased a lot since older versions. I wrote a small program to measure the time it takes for simply starting the playback of a wav/aiff file. I noticed that the 0.9.8 release uses a _lot_ more time on the AudioSystem.getMixerInfo() call (which searches for all available devices) than older versions. I also noticed that the times differ a lot for different JDKs, so here are the results for the sun-jdk-1.4.2.01, blackdown-jdk-1.4.1 and ibm-jdk-1.4.1 with the different alsa-driver versions. alsa-driver 0.9.2 - 0.9.3a: sun: 3.2- 3.3 sec bdn: 1.9- 2.0 sec ibm: 0.7- 0.8 sec alsa-driver 0.9.3b - 0.9.7: sun: 6.2- 6.3 sec bdn: 13.7-13.8 sec ibm: 3.7- 3.9 sec alsa-driver 0.9.8: sun: 48.0-48.5 sec bdn: 24.7-24.8 sec ibm: 13.7-13.8 sec alsa-driver cvs-nov-02: sun: 20.7-20.9 sec bdn: 24.8-24.9 sec ibm: 13.8-13.9 sec So things got worse between 0.9.3a and .b (the same moment the mplayer-oss-emulation-delay problem occured!) and 0.9.7 and 0.9.8. Current CVS version is working a bit better for sun's jdk, but not for the others. I did not try different alsa-lib versions (used 0.9.2 all the time) - don't know if this would make any difference. I attached the source code of the small programm, its syntax is: java AudioTest AUDIOFILE [DEVICE_NO] where DEVICE_NO is the index of the java-mixer-device to be used (they get listed if you start it without the second parameter) Gruss, Steffen --------------050903040908060900080908 Content-Type: text/plain; name="AudioTest.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="AudioTest.java" import javax.sound.sampled.*; /** * * @author fali */ public class AudioTest { /** Creates a new instance of AudioTest */ public AudioTest() { } private static void playAudioFile(String fileName, int device) throws UnsupportedAudioFileException, LineUnavailableException, java.io.IOException { long beginTime = System.currentTimeMillis(); System.out.println("checking for available devices on this system..."); Mixer.Info[] mixerInfos = AudioSystem.getMixerInfo(); for (int i=0; i=0) { bytesRead = audioInputStream.read(buf); if (bytesRead>0) { sourceDataLine.write(buf, 0, bytesRead); } } sourceDataLine.stop(); sourceDataLine.close(); audioInputStream.close(); } public static void main(String[] args) { try { if (args.length==0) { System.err.println("first argument has to be an audio file."); System.exit(-1); } String fileName = args[0]; int device = 0; if (args.length==2) { device = Integer.parseInt(args[1]); } playAudioFile(fileName, device); } catch (Exception e) { e.printStackTrace(); } } } --------------050903040908060900080908-- ------------------------------------------------------- This SF.net email is sponsored by: SF.net Giveback Program. Does SourceForge.net help you be more productive? Does it help you create better code? SHARE THE LOVE, and help us help YOU! Click Here: http://sourceforge.net/donate/