From mwielaard at redhat.com Thu May 1 16:33:45 2008 From: mwielaard at redhat.com (Mark Wielaard) Date: Fri, 02 May 2008 01:33:45 +0200 Subject: [Audio-engine-dev] Some small Gervill fixes In-Reply-To: <1209632920.3996.39.camel@dijkstra.wildebeest.org> References: <1209632920.3996.39.camel@dijkstra.wildebeest.org> Message-ID: <1209684825.29815.8.camel@dijkstra.wildebeest.org> Hi, Another small nit. In SoftChannel.controlChange() the controller values for least significant values (32-64) weren't reset to zero when the most significant values were set. This showed up when calling getController(). 2008-05-01 Mark Wielaard * com/sun/media/sound/SoftChannel.java (controlChange): Reset least significant controller if necessary. Let me know what you think. I added this patch to IcedTea. Cheers, Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: patch Type: text/x-patch Size: 631 bytes Desc: not available Url : http://mail.openjdk.java.net/pipermail/audio-engine-dev/attachments/20080502/199f1053/attachment.bin From kalli at midverk.is Fri May 2 09:25:39 2008 From: kalli at midverk.is (Karl Helgason) Date: Fri, 2 May 2008 16:25:39 +0000 Subject: [Audio-engine-dev] Some small Gervill fixes In-Reply-To: <1209684825.29815.8.camel@dijkstra.wildebeest.org> References: <1209632920.3996.39.camel@dijkstra.wildebeest.org>, <1209684825.29815.8.camel@dijkstra.wildebeest.org> Message-ID: <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACA@mail.midverk.is> Hi, You are correct according to the MIDI 1.0 Detailed Spec. page 12 :) Thanks for noticing this. Although LSB controls (32..64) aren't used in the synthesizer except for bank select and data entry. And your patch didn't apply for those cases, because it happened earlier in the code. Support for LSB controls could be easily added by adding more ModelConnectionBlock entries into SoftPerformer.java I am not currently filtering the control values to 0..127 because some user likes to be able to overdrive the values for example to set Volume to 255 which mean more than 100% volume (it was possible with the previous beatnik synthesizer). This could however result in unpredictable behaviors. If we want to prevent out of range values we should do that at the beginning in the controlChange method with if statement. But it is cool to get more code reviewers :) Sun is planning to add Gervill into OpenJDK 6 after JavaOne. I have added this fix into the CVS and these also: - Added: AudioFloatFormatConverter, used to convert between PCM_SIGNED, PCM_UNSIGNED, PCM_FLOAT in 8/16/24/32 bit (big/little endian), and resample using (linear/cubic/sinc...) if needed. - Added: WaveExtensibleReader, used to read WAV files using WAVE_FORMAT_EXTENSIBLE format. - Added: WaveFloatFileWriter, used to writing WAV files with PCM_FLOAT encoding. - Fix: AudioFloatConverter tests incorrectly AudioFormat frameSize against SampleSizeInBits Support for 64-byte float added, and support for 32+ bit PCM samples. SampleSizeInBits not dividable by 8 are now handled correctly. - Fix: DLSID(GUID) values incorrectly read from files in DLSSoundBank. - Fix: WaveFloatFileReader incorrectly sets framrate. - Fix: DLSSoundbank writes avgBytesPerSec incorrectly if SampleSizeInBits is not dividable by 8. - Fix: SoftChannel didn't reset concept of LSB control to 0 when MSB control value is set (according to MIDI 1.0 Detailed Spec. page 12) - Fix: SoftChannel, added check for illegal noteNumbers. If illegal notenumber was used in NoteOn/NoteOff a ArrayOutOfIndex exception was thrown. I especially proud of the new AudioFloatFormatConverter, it makes sample rate conversion available via a FormatConversionProvider. http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4916960 cheers, Karl ________________________________________ Fr?: audio-engine-dev-bounces at openjdk.java.net [audio-engine-dev-bounces at openjdk.java.net] Fyrir hönd Mark Wielaard [mwielaard at redhat.com] Sent: 1. ma? 2008 23:33 Vi?takandi: audio-engine-dev at openjdk.java.net Afrit: distro-pkg-dev at openjdk.java.net Efni: Re: [Audio-engine-dev] Some small Gervill fixes Hi, Another small nit. In SoftChannel.controlChange() the controller values for least significant values (32-64) weren't reset to zero when the most significant values were set. This showed up when calling getController(). 2008-05-01 Mark Wielaard * com/sun/media/sound/SoftChannel.java (controlChange): Reset least significant controller if necessary. Let me know what you think. I added this patch to IcedTea. Cheers, Mark No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.7/1408 - Release Date: 30.4.2008 18:10 From mark at klomp.org Sun May 4 15:30:30 2008 From: mark at klomp.org (Mark Wielaard) Date: Mon, 05 May 2008 00:30:30 +0200 Subject: [Audio-engine-dev] Some small Gervill fixes In-Reply-To: <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACA@mail.midverk.is> References: <1209632920.3996.39.camel@dijkstra.wildebeest.org> ,<1209684825.29815.8.camel@dijkstra.wildebeest.org> <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACA@mail.midverk.is> Message-ID: <1209940230.3058.16.camel@dijkstra.wildebeest.org> Hi Karl, On Fri, 2008-05-02 at 16:25 +0000, Karl Helgason wrote: > I am not currently filtering the control values to 0..127 because some > user likes to be able to overdrive the values > for example to set Volume to 255 which mean more than 100% volume (it > was possible with the previous beatnik synthesizer). > This could however result in unpredictable behaviors. > If we want to prevent out of range values we should do that at the > beginning in the controlChange method with if statement. Aha, yes, I see. If the user is allowed to "boost" a control then maybe we should just let them. Reading those "weird" values back in getController() can lead to some strangeness though. > But it is cool to get more code reviewers :) Sun is planning to add > Gervill into OpenJDK 6 after JavaOne. That would be very cool. I am playing with frinika now on top of icedtea/openjdk with gervill integrated (frinika obviously works since it already had an older gervill imported). I never knew midi could be so much fun! > I have added this fix into the CVS and these also: > > - Added: AudioFloatFormatConverter, used to convert > between PCM_SIGNED, PCM_UNSIGNED, PCM_FLOAT in 8/16/24/32 bit (big/little endian), > and resample using (linear/cubic/sinc...) if needed. > - Added: WaveExtensibleReader, used to read WAV files using WAVE_FORMAT_EXTENSIBLE format. > - Added: WaveFloatFileWriter, used to writing WAV files with PCM_FLOAT encoding. > - Fix: AudioFloatConverter tests incorrectly AudioFormat frameSize against SampleSizeInBits > Support for 64-byte float added, and support for 32+ bit PCM samples. > SampleSizeInBits not dividable by 8 are now handled correctly. > - Fix: DLSID(GUID) values incorrectly read from files in DLSSoundBank. > - Fix: WaveFloatFileReader incorrectly sets framrate. > - Fix: DLSSoundbank writes avgBytesPerSec incorrectly if SampleSizeInBits is not dividable by 8. > - Fix: SoftChannel didn't reset concept of LSB control to 0 when MSB control value is set > (according to MIDI 1.0 Detailed Spec. page 12) > - Fix: SoftChannel, added check for illegal noteNumbers. > If illegal notenumber was used in NoteOn/NoteOff > a ArrayOutOfIndex exception was thrown. > > I especially proud of the new AudioFloatFormatConverter, it makes > sample rate conversion available via a FormatConversionProvider. > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4916960 O wow, very nice. I imported the new Gervill CVS version into IcedTea. Thanks, Mark From mwielaard at redhat.com Fri May 9 10:14:28 2008 From: mwielaard at redhat.com (Mark Wielaard) Date: Fri, 09 May 2008 19:14:28 +0200 Subject: [Audio-engine-dev] Some small Gervill fixes In-Reply-To: <1209940230.3058.16.camel@dijkstra.wildebeest.org> References: <1209632920.3996.39.camel@dijkstra.wildebeest.org> ,<1209684825.29815.8.camel@dijkstra.wildebeest.org> <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACA@mail.midverk.is> <1209940230.3058.16.camel@dijkstra.wildebeest.org> Message-ID: <1210353284.20886.8.camel@dijkstra.wildebeest.org> Hi Karl, On Mon, 2008-05-05 at 00:30 +0200, Mark Wielaard wrote: > > I especially proud of the new AudioFloatFormatConverter, it makes > > sample rate conversion available via a FormatConversionProvider. > > http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4916960 > > O wow, very nice. I imported the new Gervill CVS version into IcedTea. And then I forgot to add the AudioFloatFormatConverter class to the javax.sound.sampled.spi.FormatConversionProvider file. DOH! Added that now to the icedtea-gervill.patch and imported a fresh Gervill CVS into the overlays. One small nit. AudioFloatFormatConverter.getTargetFormats() happily tells me that it will convert to lots of AudioFormats even if it doesn't actually know the given target encoding. I added a check on isConversionSupported() like the other converter methods do. 2008-05-09 Mark Wielaard * overlays/openjdk/jdk/src/share/classes/com/sun/media/sound: Import Gervill fixes from CVS. See CHANGES.txt. Check isConversionSupported() in AudioFloatFormatConverter.getTargetFormats(). * patches/icedtea-gervill.patch: Add AudioFloatFormatConverter to javax.sound.sampled.spi.FormatConversionProvider. AudioFloatFormatConverter patch against Gervill CVS attached. Cheers, Mark -------------- next part -------------- A non-text attachment was scrubbed... Name: AudioFloatFormatConverter.patch Type: text/x-patch Size: 998 bytes Desc: not available Url : http://mail.openjdk.java.net/pipermail/audio-engine-dev/attachments/20080509/c81cd5e6/attachment.bin From kalli at midverk.is Fri May 9 12:58:51 2008 From: kalli at midverk.is (Karl Helgason) Date: Fri, 9 May 2008 19:58:51 +0000 Subject: [Audio-engine-dev] Opening multiple output lines In-Reply-To: <1210294097.16656.18.camel@dijkstra.wildebeest.org> References: <475F1063.6080109@sun.com> <48191A17.3070604@redhat.com> <20080504171929.GA20060@gnu.wildebeest.org>, <1210294097.16656.18.camel@dijkstra.wildebeest.org> Message-ID: <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACD@mail.midverk.is> Hi, 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). cheers, Karl Helgason ________________________________________ Fr?: sound-dev-bounces at openjdk.java.net [sound-dev-bounces at openjdk.java.net] Fyrir hönd Mark Wielaard [mark at klomp.org] Sent: 9. ma? 2008 00:48 Vi?takandi: Thomas Fitzsimmons Afrit: sound-dev at openjdk.java.net; distro-pkg-dev at openjdk.java.net Efni: Re: Opening multiple output lines Hi, On Sun, 2008-05-04 at 19:19 +0200, Mark Wielaard wrote: > I had the same problem with a similar setup and with applications that > forget to close a line they don't use anymore (unfortunately this seems > very common). With the current directaudio backend I don't see how multiple > lines for the same hardware device could work though. So I am using a > trick to look for "sloppy" applications. If the last line opened in the > directaudio device was for the same hardware format then we silence that > one first so we can hand out a new one. This seems to work surprisingly > well. And it doesn't seem to interfere with applications that handle the > hardware formats they need explicitly. > > With gcjwebplugin and this patch we can happily play the vNES games :) > > Of course a real solution would be to import or write a better mixer > that does share lines properly. I updated the patch a little to make it all a bit more robust. It splits the locks, so there is no longer one gaint static one (I shouldn't have reused the lockNative one and made that static in the original patch). And it makes sure that all methods that require the nativeLock check the doIO inside their synchronized block and the lock around nStop() isn't released before the flag is set. ALSA can actually hang when called on a pcm you already stopped or closed. This race was already in the code, since a DataSourceLine could be asynchronously stopped or closed at any time. My patch just exposed it more easily, because DirectAudioDevice is the mixer that is now always used by defailt. 2008-05-08 Mark Wielaard * patches/icedtea-directaudio-close-trick.patch: Use new static lockLast for nOpen/nClose guarding. Make lockNative non-static again. Do all checks before native calls of doIO inside lockNative guard. Set doIO to false after nClose before dropping lockNative guard. I do think we should write a new MixerProvider based on a modern soundserver, like pulseaudio. The current DirectAudioDeviceProvider code cannot easily be extended to provide true software sound mixing. And the way it opens direct hardware alsa devices means it locks out other applications. Cheers, Mark Patch against original code (updated patch file in icedtea6). No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.10/1421 - Release Date: 7.5.2008 17:23 From mark at klomp.org Sun May 25 12:16:28 2008 From: mark at klomp.org (Mark Wielaard) Date: Sun, 25 May 2008 21:16:28 +0200 Subject: [Audio-engine-dev] Opening multiple output lines In-Reply-To: <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACD@mail.midverk.is> References: <475F1063.6080109@sun.com> <48191A17.3070604@redhat.com> <20080504171929.GA20060@gnu.wildebeest.org> ,<1210294097.16656.18.camel@dijkstra.wildebeest.org> <36EC82E93EB0AD40A4301DAD654323868CA4FB2ACD@mail.midverk.is> Message-ID: <1211742988.3166.43.camel@dijkstra.wildebeest.org> 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 -------------- next part -------------- A non-text attachment was scrubbed... Name: TestRender1-test.src.patch Type: text/x-patch Size: 1370 bytes Desc: not available Url : http://mail.openjdk.java.net/pipermail/audio-engine-dev/attachments/20080525/5beff035/attachment.bin -------------- next part -------------- A non-text attachment was scrubbed... Name: controlrate.patch Type: text/x-patch Size: 7079 bytes Desc: not available Url : http://mail.openjdk.java.net/pipermail/audio-engine-dev/attachments/20080525/5beff035/attachment-0001.bin