From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15269 invoked by alias); 7 Jul 2007 19:20:57 -0000 Received: (qmail 15252 invoked by uid 22791); 7 Jul 2007 19:20:56 -0000 X-Spam-Check-By: sourceware.org Received: from smtp-out112.alice.it (HELO smtp-out112.alice.it) (85.37.17.112) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 07 Jul 2007 19:20:52 +0000 Received: from FBCMMO01.fbc.local ([192.168.68.195]) by smtp-out112.alice.it with Microsoft SMTPSVC(6.0.3790.1830); Sat, 7 Jul 2007 21:20:48 +0200 Received: from FBCMCL01B01.fbc.local ([192.168.69.82]) by FBCMMO01.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Sat, 7 Jul 2007 21:20:39 +0200 Received: from [192.168.0.154] ([79.12.158.24]) by FBCMCL01B01.fbc.local with Microsoft SMTPSVC(6.0.3790.1830); Sat, 7 Jul 2007 21:20:38 +0200 Subject: FYI: sound test update From: Mario Torre To: mauve-patches Cc: Mark Wielaard Content-Type: multipart/mixed; boundary="=-bFUS97CyFqu7oheYT/MD" Date: Sat, 07 Jul 2007 19:20:00 -0000 Message-Id: <1183836038.3752.33.camel@nirvana.limasoftware.net> Mime-Version: 1.0 X-Mailer: Evolution 2.10.2 (2.10.2-3.fc7) X-IsSubscribed: yes Mailing-List: contact mauve-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: mauve-patches-owner@sourceware.org X-SW-Source: 2007/txt/msg00043.txt.bz2 --=-bFUS97CyFqu7oheYT/MD Content-Type: text/plain Content-Transfer-Encoding: 7bit Content-length: 1047 This add tests for AU files. Note that under the JDK (1.6) the streaming of AU files fails for me, not sure why (not because the test is wrong!). +1 for us :) 2007-07-07 Mario Torre * gnu/testlet/javax/sound/sampled/AudioProperties.java: (test): added test for AU audio files. (testAU): new test. (getAudioStream): new support method to load sound file and return audio streams accordingly. (testWav): refactored. (processAUStream): new helper method, part of the AU test. * gnu/testlet/javax/sound/sampled/data/k3b_success1.au: * README: added k3b_success1.au to the "NOTES" section. -- Lima Software - http://www.limasoftware.net/ GNU Classpath Developer - http://www.classpath.org/ Fedora Ambassador - http://fedoraproject.org/wiki/MarioTorre Jabber: neugens@jabber.org pgp key: http://subkeys.pgp.net/ PGP Key ID: 80F240CF Fingerprint: BA39 9666 94EC 8B73 27FA FC7C 4086 63E3 80F2 40CF Please, support open standards: http://opendocumentfellowship.org/petition/ http://www.nosoftwarepatents.com/ --=-bFUS97CyFqu7oheYT/MD Content-Disposition: attachment; filename=2007-07-07-gsoc-mauve-3.patch Content-Type: text/x-patch; name=2007-07-07-gsoc-mauve-3.patch; charset=UTF-8 Content-Transfer-Encoding: 7bit Content-length: 5337 ### Eclipse Workspace Patch 1.0 #P mauve Index: README =================================================================== RCS file: /cvs/mauve/mauve/README,v retrieving revision 1.28 diff -u -r1.28 README --- README 6 Jul 2007 10:47:26 -0000 1.28 +++ README 7 Jul 2007 19:17:14 -0000 @@ -297,3 +297,5 @@ * gnu/testlet/javax/sound/sampled/data/k3b_success1.wav, GPL, k3b-1.0.1-1.fc7.2 (fedora 7) + * gnu/testlet/javax/sound/sampled/data/k3b_success1.au, GPL, + converted from k3b_success1.wav. Index: gnu/testlet/javax/sound/sampled/AudioProperties.java =================================================================== RCS file: /cvs/mauve/mauve/gnu/testlet/javax/sound/sampled/AudioProperties.java,v retrieving revision 1.1 diff -u -r1.1 AudioProperties.java --- gnu/testlet/javax/sound/sampled/AudioProperties.java 5 Jul 2007 23:04:28 -0000 1.1 +++ gnu/testlet/javax/sound/sampled/AudioProperties.java 7 Jul 2007 19:17:14 -0000 @@ -27,7 +27,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.IOException; -import java.io.InputStream; import javax.sound.sampled.AudioFormat; import javax.sound.sampled.AudioInputStream; @@ -46,6 +45,7 @@ private static final String BASE_PATH = "gnu#testlet#javax#sound#sampled#data#"; private static final String WAV = BASE_PATH + "k3b_success1.wav"; + private static final String AU = BASE_PATH + "k3b_success1.au"; protected TestHarness harness = null; @@ -53,6 +53,7 @@ { this.harness = harness; this.testWav(); + this.testAU(); } private void processWaveStream(AudioInputStream stream) @@ -69,38 +70,67 @@ this.harness.check(format.getFrameRate() == 8000.0); this.harness.check(format.getSampleSizeInBits() == 8); } + + private void processAUStream(AudioInputStream stream) + { + AudioFormat format = stream.getFormat(); - /** - * Read a wav file and check if the expected properties match - * the actual result. - */ - private void testWav() + // NOTE: we don't check for encoding, because our backend is unable + // to get the correct encoding as defined by AudioFormat.Encoding + // this is not a problem, because the encodings specified do not + // make sense in most cases. + this.harness.check(format.getFrameSize() == 2); + this.harness.check(format.getChannels() == 1); + this.harness.check(format.getSampleRate() == 8000.0); + this.harness.check(format.getFrameRate() == 8000.0); + this.harness.check(format.getSampleSizeInBits() == 16); + } + + private AudioInputStream getAudioStream(String filepath, boolean stream) + throws IOException, UnsupportedAudioFileException { - this.harness.checkPoint("testWav()"); - - File wav = null; + File file = null; try { - wav = this.harness.getResourceFile(WAV); + file = this.harness.getResourceFile(filepath); } catch (ResourceNotFoundException e1) { - this.harness.fail("ResourceNotFoundException: check the correct " + - "input file location"); - return; + throw new IOException("ResourceNotFoundException: check the correct " + + "input file location"); + } + + AudioInputStream audioInputStream = null; + if (stream) + { + audioInputStream = + AudioSystem.getAudioInputStream(new FileInputStream(file)); + } + else + { + audioInputStream = AudioSystem.getAudioInputStream(file); } + return audioInputStream; + } + + /** + * Read a wav file and check if the expected properties match + * the actual result. + */ + private void testWav() + { + this.harness.checkPoint("testWav()"); + try { this.harness.checkPoint("testWav() - FILE"); - AudioInputStream audioInputStream = - AudioSystem.getAudioInputStream(wav); + AudioInputStream audioInputStream = getAudioStream(WAV, false); processWaveStream(audioInputStream); this.harness.checkPoint("testWav() - STREAM"); - AudioInputStream audioInputStream2 = - AudioSystem.getAudioInputStream(new FileInputStream(wav)); + AudioInputStream audioInputStream2 = getAudioStream(WAV, true); processWaveStream(audioInputStream2); } @@ -111,7 +141,34 @@ } catch (IOException e) { - this.harness.fail("IOException: check the correct input file location"); + this.harness.fail(e.getMessage()); + } + } + + private void testAU() + { + this.harness.checkPoint("testAU()"); + + try + { + this.harness.checkPoint("testAU() - FILE"); + AudioInputStream audioInputStream = getAudioStream(AU, false); + + processAUStream(audioInputStream); + + this.harness.checkPoint("testAU() - STREAM"); + AudioInputStream audioInputStream2 = getAudioStream(AU, true); + + processAUStream(audioInputStream2); + } + catch (UnsupportedAudioFileException e) + { + this.harness.fail("AU files should be supported by any" + + " implementation"); + } + catch (IOException e) + { + this.harness.fail(e.getMessage()); } } } --=-bFUS97CyFqu7oheYT/MD--