From kalli at midverk.is Sun Feb 3 11:04:44 2008 From: kalli at midverk.is (Karl Helgason) Date: Sun, 3 Feb 2008 19:04:44 +0000 Subject: [Audio-engine-dev] Gervill 0.8 just released Message-ID: <36EC82E93EB0AD40A4301DAD654323868C9B0EC675@mail.midverk.is> Hi, Version 0.8 has just been released, and can be downloaded here: http://sourceforge.net/project/showfiles.php?group_id=175084&package_id=246500&release_id=573635 Gervill project page at java.net is: http://gervill.dev.java.net/ Change log: - Fix: Active Sense Messages where incorrectly handled. JTreg test: SoftReceiver/Send_ActiveSense.java - Fix: SoftAudioPusher doesn't longer try to prevent blocking. - Added: SoftJitterCorrector added to fix jitter on long buffers. regards, Karl Helgason From alex.menkov at sun.com Mon Feb 4 07:24:31 2008 From: alex.menkov at sun.com (Alex Menkov) Date: Mon, 04 Feb 2008 18:24:31 +0300 Subject: [Audio-engine-dev] Development freeze (Was: Gervill 0.8 just released) In-Reply-To: <36EC82E93EB0AD40A4301DAD654323868C9B0EC675@mail.midverk.is> References: <36EC82E93EB0AD40A4301DAD654323868C9B0EC675@mail.midverk.is> Message-ID: <47A72E2F.8070905@sun.com> Hi everybody, With the recent 0.8 version of Gervill I want to announce development freeze for the project. After testing stage Gervill will be integrated into open-jdk as replacement for the current software synthesizer. All other encumbered code in JavaSound will also be dropped (OSS mixer for Linux, .GM soundbank reader, RMF file reader, RMF sequencer), so JavaSound becomes completely open. Due new synthesizer implementation is a big code change, I want to ask the list members to take part in the testing of it with different midi applications (developed by you or just used by you) to minimize risk to introduce new bugs into open-jdk codebase. Code reviews are also welcome. If you find some issues in the code (bugs while testing or notes from code review) please send the reports to the list. Regards Alex Karl Helgason wrote: > Hi, > > Version 0.8 has just been released, and can be downloaded here: > http://sourceforge.net/project/showfiles.php?group_id=175084&package_id=246500&release_id=573635 > > Gervill project page at java.net is: > http://gervill.dev.java.net/ > > Change log: > - Fix: Active Sense Messages where incorrectly handled. > JTreg test: SoftReceiver/Send_ActiveSense.java > - Fix: SoftAudioPusher doesn't longer try to prevent blocking. > - Added: SoftJitterCorrector added to fix jitter on long buffers. > > regards, > Karl Helgason > _______________________________________________ > audio-engine-dev mailing list > audio-engine-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev From kalli at midverk.is Wed Feb 6 06:40:09 2008 From: kalli at midverk.is (Karl Helgason) Date: Wed, 6 Feb 2008 14:40:09 +0000 Subject: [Audio-engine-dev] Bug in RealTimeSequencer when used with Gervill Message-ID: <36EC82E93EB0AD40A4301DAD654323868C9B0EC67A@mail.midverk.is> I found a bug in RealTimeSequencer when used with Gervill. The doAutoConnect opens Gervill synthesizer explicitly when it is supposed to open Gervill implicitly. Here is the code that reproduced the bug: // When we call MidiSystem.getSequencer() // a instance of RealTimeSequencer is created // that is connected to Gervill Receiver opened implicitly Sequencer seqr = MidiSystem.getSequencer(); seqr.open(); // When we call seqr.close the Receiver is also closed and // hence the gervill synthesizer is also closed because the // receiver was opened implicitly. seqr.close(); // Here is the bug, RealTimeSequencer tries to auto connect // again, but opens the Gervill synthesizer explicitly // before it tries to get instance of Receiver opened implicitly. seqr.open(); // Gervill synthesizer is never closed // when we finally call seqr.close, // because it was opened explicitly above. seqr.close(); -------------------------------------- The error lies here below: The doAutoConnect performs synth.open(); before it tries to get Receiver opened implicity by calling getReceiverReferenceCounting. private void doAutoConnect() { if (Printer.trace) Printer.trace(">> RealTimeSequencer: doAutoConnect()"); Receiver rec = null; // first try to connect to the default synthesizer // IMPORTANT: this code needs to be synch'ed with // MidiSystem.getReceiver(boolean), because the same // algorithm needs to be used! try { Synthesizer synth = MidiSystem.getSynthesizer(); synth.open(); if (synth instanceof ReferenceCountingDevice) { rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting(); if (synth.getClass().toString().contains("com.sun.media.sound.MixerSynth") && (synth.getDefaultSoundbank() == null)) { // don't use this receiver if no soundbank available rec = null; synth.close(); } } else { rec = synth.getReceiver(); } } catch (Exception e) { // something went wrong with synth } if (rec == null) { // then try to connect to the default Receiver try { rec = MidiSystem.getReceiver(); } catch (Exception e) { // something went wrong. Nothing to do then! } } if (rec != null) { autoConnectedReceiver = rec; try { getTransmitter().setReceiver(rec); } catch (Exception e) {} } if (Printer.trace) Printer.trace("<< RealTimeSequencer: doAutoConnect() succeeded"); } ------------------------ Here is a example of corrected RealTimeSequencer. It now works like MidiSystem.getSequencer(boolean). e.g. is now correctly synch'ed with MidiSystem.getReceiver(boolean). private void doAutoConnect() { if (Printer.trace) Printer.trace(">> RealTimeSequencer: doAutoConnect()"); Receiver rec = null; // first try to connect to the default synthesizer // IMPORTANT: this code needs to be synch'ed with // MidiSystem.getReceiver(boolean), because the same // algorithm needs to be used! try { Synthesizer synth = MidiSystem.getSynthesizer(); if (synth instanceof ReferenceCountingDevice) { rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting(); if (synth.getClass().toString().contains("com.sun.media.sound.MixerSynth") && (synth.getDefaultSoundbank() == null)) { // don't use this receiver if no soundbank available rec = null; synth.close(); } } else { synth.open(); try { rec = synth.getReceiver(); } finally { // make sure that the synth is properly closed if (rec == null) { synth.close(); } } } } catch (Exception e) { // something went wrong with synth } if (rec == null) { // then try to connect to the default Receiver try { rec = MidiSystem.getReceiver(); } catch (Exception e) { // something went wrong. Nothing to do then! } } if (rec != null) { autoConnectedReceiver = rec; try { getTransmitter().setReceiver(rec); } catch (Exception e) {} } if (Printer.trace) Printer.trace("<< RealTimeSequencer: doAutoConnect() succeeded"); } From info at xenoage.com Wed Feb 6 09:08:10 2008 From: info at xenoage.com (Andreas Wenger) Date: Wed, 06 Feb 2008 18:08:10 +0100 Subject: [Audio-engine-dev] Possible bugs Message-ID: <47A9E97A.7070806@xenoage.com> Hi, I'm no experienced Java Sound user, so please forgive me if the following "bugs" are not caused by Gervill but my own program. I tried to integrate Gervill into my program Xenoage Player, which is a free MIDI player for MusicXML files, http://www.xenoage.com/player/ First: This works: > sequencer = MidiSystem.getSequencer(); > synthesizer = MidiSystem.getSynthesizer(); But this fails (works perfectly with old Java Sound): > sequencer = MidiSystem.getSequencer(false); > synthesizer = MidiSystem.getSynthesizer(); > Transmitter seqTransmitter = sequencer.getTransmitter(); > seqTransmitter.setReceiver(synthesizer.getReceiver()); with > java.lang.NullPointerException > at com.sun.media.sound.SoftReceiver.(Unknown Source) > at com.sun.media.sound.SoftSynthesizer.getReceiver(Unknown Source) > at com.xenoage.player.Player.(Player.java:79) Line 79 is "seqTransmitter.setReceiver(synthesizer.getReceiver());" Second: This is the way I change the playback volume (maybe this is bad code, but it was the only way it worked for me with old Java Sound): > MidiChannel[] channels = synthesizer.getChannels(); > //... > for (int i = 0; i < channels.length; i++) > { > channels[i].controlChange(7, (int) (volume * max)); > } This doesn't change the volume, while old Java Sound does. If it helps, code is available by SVN, see the website. If these are no bugs, please forgive me ;-) Bye, Andi From kalli at midverk.is Wed Feb 6 11:21:20 2008 From: kalli at midverk.is (Karl Helgason) Date: Wed, 6 Feb 2008 19:21:20 +0000 Subject: [Audio-engine-dev] Possible bugs In-Reply-To: <47A9E97A.7070806@xenoage.com> References: <47A9E97A.7070806@xenoage.com> Message-ID: <36EC82E93EB0AD40A4301DAD654323868C9B0EC67B@mail.midverk.is> Hi, First: I can confirm this is a bug. Calling getReceiver before opening the synthesizer results in NullPointerException. This is not supposed to happen. Thanks for noticing this. Second: I tried our way to change volume, and it does work with Gervill. Please explain better how it failed. I uploaded updated version of gervill with this bug fixed: Please download "gervill-0.8-fix1.jar" from: https://gervill.dev.java.net/servlets/ProjectDocumentList?folderID=0 and let me know how this works. regards, Karl ________________________________________ Fr?: audio-engine-dev-bounces at openjdk.java.net [audio-engine-dev-bounces at openjdk.java.net] Fyrir hönd Andreas Wenger [info at xenoage.com] Sent: 6. febr?ar 2008 17:08 Vi?takandi: audio-engine-dev at openjdk.java.net Efni: [Audio-engine-dev] Possible bugs Hi, I'm no experienced Java Sound user, so please forgive me if the following "bugs" are not caused by Gervill but my own program. I tried to integrate Gervill into my program Xenoage Player, which is a free MIDI player for MusicXML files, http://www.xenoage.com/player/ First: This works: > sequencer = MidiSystem.getSequencer(); > synthesizer = MidiSystem.getSynthesizer(); But this fails (works perfectly with old Java Sound): > sequencer = MidiSystem.getSequencer(false); > synthesizer = MidiSystem.getSynthesizer(); > Transmitter seqTransmitter = sequencer.getTransmitter(); > seqTransmitter.setReceiver(synthesizer.getReceiver()); with > java.lang.NullPointerException > at com.sun.media.sound.SoftReceiver.(Unknown Source) > at com.sun.media.sound.SoftSynthesizer.getReceiver(Unknown Source) > at com.xenoage.player.Player.(Player.java:79) Line 79 is "seqTransmitter.setReceiver(synthesizer.getReceiver());" Second: This is the way I change the playback volume (maybe this is bad code, but it was the only way it worked for me with old Java Sound): > MidiChannel[] channels = synthesizer.getChannels(); > //... > for (int i = 0; i < channels.length; i++) > { > channels[i].controlChange(7, (int) (volume * max)); > } This doesn't change the volume, while old Java Sound does. If it helps, code is available by SVN, see the website. If these are no bugs, please forgive me ;-) Bye, Andi _______________________________________________ audio-engine-dev mailing list audio-engine-dev at openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.20/1261 - Release Date: 5.2.2008 20:57 From info at xenoage.com Thu Feb 7 00:56:20 2008 From: info at xenoage.com (Andreas Wenger) Date: Thu, 07 Feb 2008 09:56:20 +0100 Subject: [Audio-engine-dev] Re: Possible bugs In-Reply-To: <36EC82E93EB0AD40A4301DAD654323868C9B0EC67B@mail.midverk.is> References: <47A9E97A.7070806@xenoage.com> <36EC82E93EB0AD40A4301DAD654323868C9B0EC67B@mail.midverk.is> Message-ID: <47AAC7B4.7070501@xenoage.com> Hi Karl, gervill-0.8-fix1.jar fixed both problems. Volume did not work, because I could only test Gervill with > sequencer = MidiSystem.getSequencer(); > synthesizer = MidiSystem.getSynthesizer(); When using the now perfectly working > sequencer = MidiSystem.getSequencer(false); > synthesizer = MidiSystem.getSynthesizer(); > Transmitter seqTransmitter = sequencer.getTransmitter(); > seqTransmitter.setReceiver(synthesizer.getReceiver()); volume changes too (no idea why this is necessary, but it's the same with old Java Sound. Perhaps anybody can tell me? This is how I get the channels: MidiChannel[] channels = synthesizer.getChannels();) BTW, another thing I don't understand is the following (but same thing in old Java Sound). Many sites tell me, that volume control is between 0 and 127, see e.g. http://www.musicmarkup.info/midi/control.html In fact I get max volume with 255, min with 0. Here is my complete setVolume method. > /** > * Sets the volume. > * @param volume value between 0 (silent) and 1 (loud) > */ > public void setVolume(float volume) > { > this.volume = volume; > MidiChannel[] channels = synthesizer.getChannels(); > > //TODO: should be 127 (some websites say this) > //but 255 is the real max volume! > int max = 255; > > for (int i = 0; i < channels.length; i++) > { > channels[i].controlChange(7, (int) (volume * max)); > } > } Did I already mention that Gervill is just GREAT?! Keep on your brilliant work! :-) Andi Karl Helgason schrieb: > Hi, > > First: > > I can confirm this is a bug. > > Calling getReceiver before opening the synthesizer results in NullPointerException. > This is not supposed to happen. Thanks for noticing this. > > Second: > > I tried our way to change volume, and it does work with Gervill. > Please explain better how it failed. > > I uploaded updated version of gervill with this bug fixed: > Please download "gervill-0.8-fix1.jar" from: > https://gervill.dev.java.net/servlets/ProjectDocumentList?folderID=0 > and let me know how this works. > > regards, > Karl > > ________________________________________ > Fr?: audio-engine-dev-bounces at openjdk.java.net [audio-engine-dev-bounces at openjdk.java.net] Fyrir hönd Andreas Wenger [info at xenoage.com] > Sent: 6. febr?ar 2008 17:08 > Vi?takandi: audio-engine-dev at openjdk.java.net > Efni: [Audio-engine-dev] Possible bugs > > Hi, > > > I'm no experienced Java Sound user, so please forgive me if the following > "bugs" are not caused by Gervill but my own program. > > I tried to integrate Gervill into my program Xenoage Player, which > is a free MIDI player for MusicXML files, http://www.xenoage.com/player/ > > > First: > > This works: > >> sequencer = MidiSystem.getSequencer(); >> synthesizer = MidiSystem.getSynthesizer(); >> > But this fails (works perfectly with old Java Sound): > > >> sequencer = MidiSystem.getSequencer(false); >> synthesizer = MidiSystem.getSynthesizer(); >> Transmitter seqTransmitter = sequencer.getTransmitter(); >> seqTransmitter.setReceiver(synthesizer.getReceiver()); >> > with > >> java.lang.NullPointerException >> at com.sun.media.sound.SoftReceiver.(Unknown Source) >> at com.sun.media.sound.SoftSynthesizer.getReceiver(Unknown Source) >> at com.xenoage.player.Player.(Player.java:79) >> > Line 79 is "seqTransmitter.setReceiver(synthesizer.getReceiver());" > > > Second: > > This is the way I change the playback volume (maybe this is bad code, > but it was the only way it worked for me with old Java Sound): > > >> MidiChannel[] channels = synthesizer.getChannels(); >> //... >> for (int i = 0; i < channels.length; i++) >> { >> channels[i].controlChange(7, (int) (volume * max)); >> } >> > This doesn't change the volume, while old Java Sound does. > > > If it helps, code is available by SVN, see the website. > If these are no bugs, please forgive me ;-) > > Bye, > > > Andi > > > > > > _______________________________________________ > audio-engine-dev mailing list > audio-engine-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.19.20/1261 - Release Date: 5.2.2008 20:57 > > From kalli at midverk.is Thu Feb 7 03:56:42 2008 From: kalli at midverk.is (Karl Helgason) Date: Thu, 7 Feb 2008 11:56:42 +0000 Subject: [Audio-engine-dev] Possible bugs In-Reply-To: <47AAC7B4.7070501@xenoage.com> References: <47A9E97A.7070806@xenoage.com> <36EC82E93EB0AD40A4301DAD654323868C9B0EC67B@mail.midverk.is>, <47AAC7B4.7070501@xenoage.com> Message-ID: <36EC82E93EB0AD40A4301DAD654323868C9B0EC67F@mail.midverk.is> Hi Andi, I glad to hear that gervill-0.8-fix1.jar fixed those problems. The reason volume did not work for you is that the statements: sequencer = MidiSystem.getSequencer(); synthesizer = MidiSystem.getSynthesizer(); returns different instance of Gervill Synthesizer. This mean that volume change on for example synthesizer object won't affect playback on the sequencer object. In Gervill the midi volume 127 means that the signal is not affected. And 64 means that signal is attenuated by12 dB, while midi volume 256 will amplify the signal by 12 dB. So by specifying 256 as maximum volume you are overdriving the output. regards, Karl ________________________________________ Fr?: audio-engine-dev-bounces at openjdk.java.net [audio-engine-dev-bounces at openjdk.java.net] Fyrir hönd Andreas Wenger [info at xenoage.com] Sent: 7. febr?ar 2008 08:56 Vi?takandi: audio-engine-dev at openjdk.java.net Efni: [Audio-engine-dev] Re: Possible bugs Hi Karl, gervill-0.8-fix1.jar fixed both problems. Volume did not work, because I could only test Gervill with > sequencer = MidiSystem.getSequencer(); > synthesizer = MidiSystem.getSynthesizer(); When using the now perfectly working > sequencer = MidiSystem.getSequencer(false); > synthesizer = MidiSystem.getSynthesizer(); > Transmitter seqTransmitter = sequencer.getTransmitter(); > seqTransmitter.setReceiver(synthesizer.getReceiver()); volume changes too (no idea why this is necessary, but it's the same with old Java Sound. Perhaps anybody can tell me? This is how I get the channels: MidiChannel[] channels = synthesizer.getChannels();) BTW, another thing I don't understand is the following (but same thing in old Java Sound). Many sites tell me, that volume control is between 0 and 127, see e.g. http://www.musicmarkup.info/midi/control.html In fact I get max volume with 255, min with 0. Here is my complete setVolume method. > /** > * Sets the volume. > * @param volume value between 0 (silent) and 1 (loud) > */ > public void setVolume(float volume) > { > this.volume = volume; > MidiChannel[] channels = synthesizer.getChannels(); > > //TODO: should be 127 (some websites say this) > //but 255 is the real max volume! > int max = 255; > > for (int i = 0; i < channels.length; i++) > { > channels[i].controlChange(7, (int) (volume * max)); > } > } Did I already mention that Gervill is just GREAT?! Keep on your brilliant work! :-) Andi Karl Helgason schrieb: > Hi, > > First: > > I can confirm this is a bug. > > Calling getReceiver before opening the synthesizer results in NullPointerException. > This is not supposed to happen. Thanks for noticing this. > > Second: > > I tried our way to change volume, and it does work with Gervill. > Please explain better how it failed. > > I uploaded updated version of gervill with this bug fixed: > Please download "gervill-0.8-fix1.jar" from: > https://gervill.dev.java.net/servlets/ProjectDocumentList?folderID=0 > and let me know how this works. > > regards, > Karl > > ________________________________________ > Fr?: audio-engine-dev-bounces at openjdk.java.net [audio-engine-dev-bounces at openjdk.java.net] Fyrir hönd Andreas Wenger [info at xenoage.com] > Sent: 6. febr?ar 2008 17:08 > Vi?takandi: audio-engine-dev at openjdk.java.net > Efni: [Audio-engine-dev] Possible bugs > > Hi, > > > I'm no experienced Java Sound user, so please forgive me if the following > "bugs" are not caused by Gervill but my own program. > > I tried to integrate Gervill into my program Xenoage Player, which > is a free MIDI player for MusicXML files, http://www.xenoage.com/player/ > > > First: > > This works: > >> sequencer = MidiSystem.getSequencer(); >> synthesizer = MidiSystem.getSynthesizer(); >> > But this fails (works perfectly with old Java Sound): > > >> sequencer = MidiSystem.getSequencer(false); >> synthesizer = MidiSystem.getSynthesizer(); >> Transmitter seqTransmitter = sequencer.getTransmitter(); >> seqTransmitter.setReceiver(synthesizer.getReceiver()); >> > with > >> java.lang.NullPointerException >> at com.sun.media.sound.SoftReceiver.(Unknown Source) >> at com.sun.media.sound.SoftSynthesizer.getReceiver(Unknown Source) >> at com.xenoage.player.Player.(Player.java:79) >> > Line 79 is "seqTransmitter.setReceiver(synthesizer.getReceiver());" > > > Second: > > This is the way I change the playback volume (maybe this is bad code, > but it was the only way it worked for me with old Java Sound): > > >> MidiChannel[] channels = synthesizer.getChannels(); >> //... >> for (int i = 0; i < channels.length; i++) >> { >> channels[i].controlChange(7, (int) (volume * max)); >> } >> > This doesn't change the volume, while old Java Sound does. > > > If it helps, code is available by SVN, see the website. > If these are no bugs, please forgive me ;-) > > Bye, > > > Andi > > > > > > _______________________________________________ > audio-engine-dev mailing list > audio-engine-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev > > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.19.20/1261 - Release Date: 5.2.2008 20:57 > > _______________________________________________ audio-engine-dev mailing list audio-engine-dev at openjdk.java.net http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.20/1261 - Release Date: 5.2.2008 20:57 From alex.menkov at sun.com Thu Feb 7 07:21:30 2008 From: alex.menkov at sun.com (Alex Menkov) Date: Thu, 07 Feb 2008 18:21:30 +0300 Subject: [Audio-engine-dev] Bug in RealTimeSequencer when used with Gervill In-Reply-To: <36EC82E93EB0AD40A4301DAD654323868C9B0EC67A@mail.midverk.is> References: <36EC82E93EB0AD40A4301DAD654323868C9B0EC67A@mail.midverk.is> Message-ID: <47AB21FA.80903@sun.com> Karl, Yes, it's real mis-synchronization of the code. I've created a CR for the bug. I'm going to update the code along with RealTimeSequencer code cleaning (removing obsolete references to Beatnik code). Regards Alex Karl Helgason wrote: > I found a bug in RealTimeSequencer when used with Gervill. > The doAutoConnect opens Gervill synthesizer explicitly > when it is supposed to open Gervill implicitly. > > Here is the code that reproduced the bug: > > // When we call MidiSystem.getSequencer() > // a instance of RealTimeSequencer is created > // that is connected to Gervill Receiver opened implicitly > Sequencer seqr = MidiSystem.getSequencer(); > seqr.open(); > > // When we call seqr.close the Receiver is also closed and > // hence the gervill synthesizer is also closed because the > // receiver was opened implicitly. > seqr.close(); > > // Here is the bug, RealTimeSequencer tries to auto connect > // again, but opens the Gervill synthesizer explicitly > // before it tries to get instance of Receiver opened implicitly. > seqr.open(); > > // Gervill synthesizer is never closed > // when we finally call seqr.close, > // because it was opened explicitly above. > seqr.close(); > > -------------------------------------- > The error lies here below: > The doAutoConnect performs synth.open(); > before it tries to get Receiver opened implicity > by calling getReceiverReferenceCounting. > > private void doAutoConnect() { > if (Printer.trace) Printer.trace(">> RealTimeSequencer: doAutoConnect()"); > Receiver rec = null; > // first try to connect to the default synthesizer > // IMPORTANT: this code needs to be synch'ed with > // MidiSystem.getReceiver(boolean), because the same > // algorithm needs to be used! > try { > Synthesizer synth = MidiSystem.getSynthesizer(); > synth.open(); > if (synth instanceof ReferenceCountingDevice) { > rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting(); > if (synth.getClass().toString().contains("com.sun.media.sound.MixerSynth") > && (synth.getDefaultSoundbank() == null)) { > // don't use this receiver if no soundbank available > rec = null; > synth.close(); > } > } else { > rec = synth.getReceiver(); > } > } catch (Exception e) { > // something went wrong with synth > } > if (rec == null) { > // then try to connect to the default Receiver > try { > rec = MidiSystem.getReceiver(); > } catch (Exception e) { > // something went wrong. Nothing to do then! > } > } > if (rec != null) { > autoConnectedReceiver = rec; > try { > getTransmitter().setReceiver(rec); > } catch (Exception e) {} > } > if (Printer.trace) Printer.trace("<< RealTimeSequencer: doAutoConnect() succeeded"); > } > > ------------------------ > Here is a example of corrected RealTimeSequencer. > It now works like MidiSystem.getSequencer(boolean). > e.g. is now correctly synch'ed with MidiSystem.getReceiver(boolean). > > > private void doAutoConnect() { > if (Printer.trace) Printer.trace(">> RealTimeSequencer: doAutoConnect()"); > Receiver rec = null; > // first try to connect to the default synthesizer > // IMPORTANT: this code needs to be synch'ed with > // MidiSystem.getReceiver(boolean), because the same > // algorithm needs to be used! > try { > Synthesizer synth = MidiSystem.getSynthesizer(); > if (synth instanceof ReferenceCountingDevice) { > rec = ((ReferenceCountingDevice) synth).getReceiverReferenceCounting(); > if (synth.getClass().toString().contains("com.sun.media.sound.MixerSynth") > && (synth.getDefaultSoundbank() == null)) { > // don't use this receiver if no soundbank available > rec = null; > synth.close(); > } > } else { > synth.open(); > try { > rec = synth.getReceiver(); > } finally { > // make sure that the synth is properly closed > if (rec == null) { > synth.close(); > } > } > } > } catch (Exception e) { > // something went wrong with synth > } > if (rec == null) { > // then try to connect to the default Receiver > try { > rec = MidiSystem.getReceiver(); > } catch (Exception e) { > // something went wrong. Nothing to do then! > } > } > if (rec != null) { > autoConnectedReceiver = rec; > try { > getTransmitter().setReceiver(rec); > } catch (Exception e) {} > } > if (Printer.trace) Printer.trace("<< RealTimeSequencer: doAutoConnect() succeeded"); > } > _______________________________________________ > audio-engine-dev mailing list > audio-engine-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev From alex.menkov at sun.com Thu Feb 14 09:45:06 2008 From: alex.menkov at sun.com (Alex Menkov) Date: Thu, 14 Feb 2008 20:45:06 +0300 Subject: [Audio-engine-dev] SoftSynthesizer exceptions Message-ID: <47B47E22.7060604@sun.com> Hi, This is some notes about exception in SoftSynthesizer class. 1) SoftSynthesizer throws IllegalStateException from a number of methods when it is not open. Old synthesizer implementation does not throw such exception, so the behavior may cause compatibility problems in some applications (for example JSInfo from jsresources.org - it calls getChannels() to discover how many channels a synthesizer supports). Although IllegalStateException is not required to be declared in "throws" list of a method, it should be explicitly described in spec (see Receiver.send for example). The methods which throw IllegalStateException: getChannels(); getVoiceStatus(); loadInstrument(Instrument instrument); unloadInstrument(Instrument instrument); remapInstrument(Instrument from, Instrument to); getAvailableInstruments(); getLoadedInstruments(); loadAllInstruments(Soundbank soundbank); unloadAllInstruments(Soundbank soundbank); loadInstruments(Soundbank soundbank, Patch[] patchList); unloadInstruments(Soundbank soundbank, Patch[] patchList); getMicrosecondPosition(); getReceivers(); also the exception can be thrown by loadSamples (called from loadAllInstruments(Soundbank soundbank) and loadInstrument(Instrument instrument); this are the cases when loadAllInstruments/loadInstrument should return "false" - see 2) ), from ModelByteBuffer class methods and from SoftMidiAudioFileReader.getAudioInputStream(Sequence seq) (called from other SoftMidiAudioFileReader methods) 2) a number of methods (instrument loading/unloading) should throw IllegalArgumentException if the instrument (or sounbank) is unsupported (in our case instrument is not instance of ModelInstrument). "false" (for methods which returns boolean) means that instrument is supported, but could not be loaded by some reason. The methods are: loadInstrument(Instrument instrument); unloadInstrument(Instrument instrument); remapInstrument(Instrument from, Instrument to); loadAllInstruments(Soundbank soundbank); unloadAllInstruments(Soundbank soundbank); loadInstruments(Soundbank soundbank, Patch[] patchList); unloadInstruments(Soundbank soundbank, Patch[] patchList); Regards Alex From alex.menkov at sun.com Thu Feb 14 09:49:09 2008 From: alex.menkov at sun.com (Alex Menkov) Date: Thu, 14 Feb 2008 20:49:09 +0300 Subject: [Audio-engine-dev] SotfSynthesizer.remapInstrument Message-ID: <47B47F15.3080105@sun.com> Hi again, Karl, did you see that Synthesizer.remapInstrument() spec has been changed in Java6? It look like you used spec from 1.5. new spec is: boolean remapInstrument(Instrument from, Instrument to) Remaps an instrument. Instrument to takes the place of instrument from. For example, if from was located at bank number 2, program number 11, remapping causes that bank and program location to be occupied instead by to. If the function succeeds, instrument from is unloaded. To cancel the remapping reload instrument from by invoking one of loadInstrument(javax.sound.midi.Instrument), loadInstruments(javax.sound.midi.Soundbank, javax.sound.midi.Patch[]) or loadAllInstruments(javax.sound.midi.Soundbank). Parameters: from - the Instrument object to be replaced to - the Instrument object to be used in place of the old instrument, it should be loaded into the synthesizer Returns: true if the instrument succeessfully remapped, false if feature is not implemented by synthesizer Throws: IllegalArgumentException - if instrument from or instrument to aren't supported by synthesizer or if instrument to is not loaded NullPointerException - if from or to parameters have null value Regards Alex From alex.menkov at sun.com Thu Feb 14 10:08:59 2008 From: alex.menkov at sun.com (Alex Menkov) Date: Thu, 14 Feb 2008 21:08:59 +0300 Subject: [Audio-engine-dev] SoftSynthesizer: getChannels() and getVoiceStatus() Message-ID: <47B483BB.2010304@sun.com> SoftSynthesizer.getChannels() returns internal channels array. If somebody modify the array it may causes failures. It should return copy of the array. SoftSynthesizer.getVoiceStatus() returns "internal" tempVoiceStatusArray array. This may causes sharing violation. also it make impossible to do something like: VoiceStatus[] voices1 = synth.getVoiceStatus(); VoiceStatus[] voices2 = synth.getVoiceStatus(); Regards Alex From kalli at midverk.is Mon Feb 18 08:48:29 2008 From: kalli at midverk.is (Karl Helgason) Date: Mon, 18 Feb 2008 16:48:29 +0000 Subject: [Audio-engine-dev] Gervill 0.9 just released Message-ID: <36EC82E93EB0AD40A4301DAD654323868CA062F3FE@mail.midverk.is> Hi, Version 0.9 has just been released, and can be downloaded here: http://sourceforge.net/project/showfiles.php?group_id=175084&package_id=246500&release_id=577578 Gervill project page at java.net is: http://gervill.dev.java.net/ Change log: - Fix: JTreg SoftSynthesizer\ImplicitOpenClose.java did not test correctly. - Fix: SoftSynthesizer.isSoundbankSupported now only returns false if there is any instrument which is not supported. - Fix: SoftSynthesizer.remapInstrument did not work correctly. - Fix: SoftSynthesizer.loadInstrument SoftSynthesizer.loadInstruments SoftSynthesizer.loadAllInstruments SoftSynthesizer.unloadInstrument SoftSynthesizer.unloadInstruments SoftSynthesizer.unloadAllInstruments SoftSynthesizer.getAvailableInstruments SoftSynthesizer.getLoadedInstruments now throws IllegalArgumentException if instrument is not supported and false if instrument can't be loaded for some other reason. - Fix: SoftSynthesizer.getReceivers() SoftSynthesizer.getMicrosecondPosition() SoftSynthesizer.getVoiceStatus() SoftSynthesizer.getChannels() SoftMidiAudioFileReader.getAudioInputStream(Sequence seq) now no longer throw IllegalStateException. - Fix: SoftSynthesizer.getChannels() and SoftSynthesizer.getVoiceStatus() now no longer return internal array. - Fix: CPU spiking caused by denormal floats in SoftReverb. - Fix: Calling getReceiver before opening the synthesizer results in NullPointerException. JTreg test added: SoftSynthesizer/GetReceiver2 - Fix: Removed checksum check on BULK TUNING DUMP (NON-REAL-TIME) Because MIDI Tuning Spec was ambigous about how to calculate the checksum and different programs tested calculated different checksum. JTreg test SoftTuning/Load1 fixed. regards, Karl Helgason From alex.menkov at sun.com Fri Feb 22 01:59:47 2008 From: alex.menkov at sun.com (Alex Menkov) Date: Fri, 22 Feb 2008 12:59:47 +0300 Subject: [Audio-engine-dev] Gervill 0.9 just released In-Reply-To: <36EC82E93EB0AD40A4301DAD654323868CA062F3FE@mail.midverk.is> References: <36EC82E93EB0AD40A4301DAD654323868CA062F3FE@mail.midverk.is> Message-ID: <47BE9D13.6020607@sun.com> Hi everybody! With version 0.9 all reported issues has been fixed. I'm going to start integration Gervill into openJDK6 (dropping encumbered code) next Tuesday, February 26. After completion of the integration into openJDK6, the same thing will be done with openJDK7. If somebody is still in progress with testing/reviewing please let us know. Regards Alex Karl Helgason wrote: > Hi, > > Version 0.9 has just been released, and can be downloaded here: > http://sourceforge.net/project/showfiles.php?group_id=175084&package_id=246500&release_id=577578 > > Gervill project page at java.net is: > http://gervill.dev.java.net/ > > Change log: > - Fix: JTreg SoftSynthesizer\ImplicitOpenClose.java > did not test correctly. > - Fix: SoftSynthesizer.isSoundbankSupported > now only returns false if > there is any instrument which is not supported. > - Fix: SoftSynthesizer.remapInstrument > did not work correctly. > - Fix: SoftSynthesizer.loadInstrument > SoftSynthesizer.loadInstruments > SoftSynthesizer.loadAllInstruments > SoftSynthesizer.unloadInstrument > SoftSynthesizer.unloadInstruments > SoftSynthesizer.unloadAllInstruments > SoftSynthesizer.getAvailableInstruments > SoftSynthesizer.getLoadedInstruments > now throws IllegalArgumentException > if instrument is not supported > and false if instrument can't be loaded > for some other reason. > - Fix: SoftSynthesizer.getReceivers() > SoftSynthesizer.getMicrosecondPosition() > SoftSynthesizer.getVoiceStatus() > SoftSynthesizer.getChannels() > SoftMidiAudioFileReader.getAudioInputStream(Sequence seq) > now no longer throw IllegalStateException. > - Fix: SoftSynthesizer.getChannels() and > SoftSynthesizer.getVoiceStatus() > now no longer return internal array. > - Fix: CPU spiking caused by denormal floats in SoftReverb. > - Fix: Calling getReceiver before opening the synthesizer results in NullPointerException. > JTreg test added: SoftSynthesizer/GetReceiver2 > - Fix: Removed checksum check on > BULK TUNING DUMP (NON-REAL-TIME) > Because MIDI Tuning Spec was ambigous about > how to calculate the checksum > and different programs tested calculated > different checksum. > JTreg test SoftTuning/Load1 fixed. > > regards, > Karl Helgason > _______________________________________________ > audio-engine-dev mailing list > audio-engine-dev at openjdk.java.net > http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev