Re: Some small Gervill fixes

View: New views
4 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: Some small Gervill fixes

by Mark Wielaard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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  <mwielaard@...>

        * 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

--- com/sun/media/sound/SoftChannel.java Thu May 01 10:57:58 2008 +0200
+++ com/sun/media/sound/SoftChannel.java Fri May 02 01:29:20 2008 +0200
@@ -1170,7 +1170,13 @@ public class SoftChannel implements Midi
  return;
  }
 
- this.controller[controller] = value;
+ // Keep track of values (capped to 7 bit).
+ // Reset least significant (32 through 63)
+ // controller value when most significant
+ // (0 through 31) is set.
+ this.controller[controller] = value & 127;
+ if (controller < 32)
+ this.controller[controller + 32] = 0;
 
  for (int i = 0; i < voices.length; i++)
  if (voices[i].active)

_______________________________________________
audio-engine-dev mailing list
audio-engine-dev@...
http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev

Re: Some small Gervill fixes

by Karl Helgason-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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@... [audio-engine-dev-bounces@...] Fyrir hönd Mark Wielaard [mwielaard@...]
Sent: 1. maí 2008 23:33
Viðtakandi: audio-engine-dev@...
Afrit: distro-pkg-dev@...
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  <mwielaard@...>

        * 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


_______________________________________________
audio-engine-dev mailing list
audio-engine-dev@...
http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev

Re: Some small Gervill fixes

by Mark Wielaard :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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

_______________________________________________
audio-engine-dev mailing list
audio-engine-dev@...
http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev

Re: Some small Gervill fixes

by Mark Wielaard-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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  <mwielaard@...>

    * 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

Index: src/com/sun/media/sound/AudioFloatFormatConverter.java
===================================================================
RCS file: /cvs/gervill/src/com/sun/media/sound/AudioFloatFormatConverter.java,v
retrieving revision 1.2
diff -u -r1.2 AudioFloatFormatConverter.java
--- src/com/sun/media/sound/AudioFloatFormatConverter.java 8 May 2008 16:38:02 -0000 1.2
+++ src/com/sun/media/sound/AudioFloatFormatConverter.java 9 May 2008 17:10:49 -0000
@@ -489,7 +489,7 @@
  }
 
  public AudioFormat[] getTargetFormats(Encoding targetEncoding, AudioFormat sourceFormat) {
- if(AudioFloatConverter.getConverter(sourceFormat) == null) return new AudioFormat[0];
+ if(!isConversionSupported(targetEncoding, sourceFormat)) return new AudioFormat[0];
  int channels = sourceFormat.getChannels();
  ArrayList<AudioFormat> formats = new ArrayList<AudioFormat>();
  formats.add(new AudioFormat(Encoding.PCM_SIGNED, AudioSystem.NOT_SPECIFIED, 8, channels, channels, AudioSystem.NOT_SPECIFIED, false));

_______________________________________________
audio-engine-dev mailing list
audio-engine-dev@...
http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev