Hi Karl, On Fri, 2008-05-09 at 19:58 +0000, Karl Helgason wrote: > I added software sound mixing to the gervill Project which writes to default > directaudio backend. > And thus allows true sharing of audio device (within the Java application).
This is great! Sorry for the late response. I integrated it into icedtea. But I haven't set it as default yet because I didn't have time to fully test it. I do want to have it integrated so others can play with it though. Also thanks for your AudioFloatFormatConverter.getTargetFormats() fix, I removed my own attempt of fixing that. And for integrating the dls/sf2 soundbank opening issues. Also since we now have jtreg integrated I imported all the tests so they will now all be run by default on a make check (or make jtregcheck). That found two issues. One with a test. TestRender1 accesses its test files through getResourceAsStream(), but the jtreg tag specification recommends opening files through the system property test.src so that the test can be run inside another work directory. See http://www.openjdk.org/jtreg/tag-spec.txt Patch to change this attached. The other issue is with the change that made SoftAudioProcessor (limiter, reverb, chorus, agc) more general. Since you cannot provide a Synthesizer directly to one of these classes you need a way to pass it the control rate. Unfortunately SoftSynthesizer.getControlRate() is currently protected and there is as far as I can see no other way to get the control rate. So I believe the method should be made public. A change to do this and adapt the tests to use this is attached. With these changes all tests pass. Cheers, Mark
Index: test/com/sun/media/sound/SoftSynthesizer/TestRender1.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftSynthesizer/TestRender1.java,v retrieving revision 1.1 diff -u -r1.1 TestRender1.java --- test/com/sun/media/sound/SoftSynthesizer/TestRender1.java 2 Jan 2008 12:24:16 -0000 1.1 +++ test/com/sun/media/sound/SoftSynthesizer/TestRender1.java 25 May 2008 19:07:10 -0000 @@ -29,6 +29,8 @@ import java.io.BufferedInputStream; import java.io.IOException; import java.io.InputStream; +import java.io.File; +import java.io.FileInputStream; import java.io.OutputStream; import java.util.HashMap; import java.util.Map; @@ -134,13 +136,15 @@ public static void main(String[] args) throws Exception { - InputStream sb = new BufferedInputStream(TestRender1.class - .getResourceAsStream("/ding.sf2")); + File fb = new File(System.getProperty("test.src", "."), + "ding.sf2"); + InputStream sb = new FileInputStream(fb); soundbank = MidiSystem.getSoundbank(sb); sb.close(); - InputStream si = new BufferedInputStream(TestRender1.class - .getResourceAsStream("/expresso.mid")); + File fi = new File(System.getProperty("test.src", "."), + "expresso.mid"); + InputStream si = new FileInputStream(fi); sequence = MidiSystem.getSequence(si); si.close();
Index: src/com/sun/media/sound/SoftSynthesizer.java =================================================================== RCS file: /cvs/gervill/src/com/sun/media/sound/SoftSynthesizer.java,v retrieving revision 1.31 diff -u -r1.31 SoftSynthesizer.java --- src/com/sun/media/sound/SoftSynthesizer.java 5 Mar 2008 03:35:22 -0000 1.31 +++ src/com/sun/media/sound/SoftSynthesizer.java 25 May 2008 19:12:24 -0000 @@ -331,7 +331,10 @@ return deviceid; } - protected float getControlRate() { + /** + * Returns the number of control changes per second. + */ + public float getControlRate() { return controlrate; } Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_mix.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix.java 11 Dec 2007 02:49:18 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix.java 25 May 2008 19:12:24 -0000 @@ -71,7 +71,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(true); limiter.setInput(0, in1); limiter.setInput(1, in2); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_mix_mono.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono.java 11 Dec 2007 02:49:19 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono.java 25 May 2008 19:12:24 -0000 @@ -63,7 +63,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(true); limiter.setInput(0, in1); limiter.setOutput(0, out1); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono_overdrive.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono_overdrive.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_mix_mono_overdrive.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono_overdrive.java 11 Dec 2007 02:49:17 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_mono_overdrive.java 25 May 2008 19:12:24 -0000 @@ -64,7 +64,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(true); limiter.setInput(0, in1); limiter.setOutput(0, out1); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_overdrive.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_overdrive.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_mix_overdrive.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_overdrive.java 11 Dec 2007 02:50:21 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_mix_overdrive.java 25 May 2008 19:12:24 -0000 @@ -71,7 +71,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(true); limiter.setInput(0, in1); limiter.setInput(1, in2); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_normal.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal.java 11 Dec 2007 02:50:22 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal.java 25 May 2008 19:12:24 -0000 @@ -71,7 +71,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(false); limiter.setInput(0, in1); limiter.setInput(1, in2); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal_mono.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal_mono.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_normal_mono.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal_mono.java 11 Dec 2007 02:50:23 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_normal_mono.java 25 May 2008 19:12:24 -0000 @@ -63,7 +63,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(false); limiter.setInput(0, in1); limiter.setOutput(0, out1); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_overdrive.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive.java 11 Dec 2007 02:49:50 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive.java 25 May 2008 19:12:24 -0000 @@ -71,7 +71,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(false); limiter.setInput(0, in1); limiter.setInput(1, in2); Index: test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive_mono.java =================================================================== RCS file: /cvs/gervill/test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive_mono.java,v retrieving revision 1.1 diff -u -r1.1 ProcessAudio_replace_overdrive_mono.java --- test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive_mono.java 11 Dec 2007 02:50:23 -0000 1.1 +++ test/com/sun/media/sound/SoftLimiter/ProcessAudio_replace_overdrive_mono.java 25 May 2008 19:12:24 -0000 @@ -63,7 +63,8 @@ } SoftLimiter limiter = new SoftLimiter(); - limiter.init(synth); + limiter.init(synth.getFormat().getSampleRate(), + synth.getControlRate()); limiter.setMixMode(false); limiter.setInput(0, in1); limiter.setOutput(0, out1);