changeset in /hg/icedtea: New Gervill CVS import. Add AudioFloat...

Mark Wielaard mark at klomp.org
Thu May 29 14:13:38 PDT 2008


changeset 30c7450d05dc in /hg/icedtea
details: http://icedtea.classpath.org/hg/icedtea?cmd=changeset;node=30c7450d05dc
description:
	New Gervill CVS import. Add AudioFloatFormatConverter FormatConversionProvider.

	2008-05-09  Mark Wielaard  <mwielaard at redhat.com>

	        * 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.

diffstat:

9 files changed, 55 insertions(+), 33 deletions(-)
ChangeLog                                                                                 |    9 +++++
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java |   17 +++++----
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/CHANGES.txt                    |    1 
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioProcessor.java        |    2 -
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java                |   14 +++----
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java               |   12 +++---
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java             |    8 ++--
overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java                |   18 +++++-----
patches/icedtea-gervill.patch                                                             |    7 +++

diffs (233 lines):

diff -r 6d39bcf18078 -r 30c7450d05dc ChangeLog
--- a/ChangeLog	Fri May 09 10:25:45 2008 -0400
+++ b/ChangeLog	Fri May 09 19:04:37 2008 +0200
@@ -1,3 +1,12 @@ 2008-05-09  Lillian Angel  <langel at redha
+2008-05-09  Mark Wielaard  <mwielaard at redhat.com>
+
+	* 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.
+
 2008-05-09  Lillian Angel  <langel at redhat.com>
 
 	* patches/icedtea-certbundle.patch: Fixed typo.
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/AudioFloatFormatConverter.java	Fri May 09 19:04:37 2008 +0200
@@ -366,17 +366,20 @@ public class AudioFloatFormatConverter e
 			int in_end = ibuffer_len;
 			while(remain > 0)
 			{
-				if(ibuffer_len < 0)
-				{
-					in_end = pad2;
-					if(ibuffer_index > in_end) break;	
-				}
-				else
+				if(ibuffer_len >= 0)
 				{
 					if(ibuffer_index >= (ibuffer_len+pad)) 
 						readNextBuffer();
 					in_end = ibuffer_len+pad;
 				}
+				
+				if(ibuffer_len < 0)
+				{
+					in_end = pad2;
+					if(ibuffer_index >= in_end) break;	
+				}
+				
+				
 				if(ibuffer_index < 0) 
 					break;
 				int preDestPos = destPos;
@@ -486,7 +489,7 @@ public class AudioFloatFormatConverter e
 	}
 
 	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));
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/CHANGES.txt
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/CHANGES.txt	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/CHANGES.txt	Fri May 09 19:04:37 2008 +0200
@@ -5,6 +5,7 @@
            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.
+  - Change: Make SoftAudioProcessor (limiter, reverb, chorus, agc) more general.
   - 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.
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioProcessor.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioProcessor.java	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioProcessor.java	Fri May 09 19:04:37 2008 +0200
@@ -37,7 +37,7 @@ public interface SoftAudioProcessor {
 	public void globalParameterControlChange(int[] slothpath, long param,
 			long value);
 
-	public void init(SoftSynthesizer synthesizer);
+	public void init(float samplerate, float controlrate);
 
 	public void setInput(int pin, SoftAudioBuffer input);
 
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftChorus.java	Fri May 09 19:04:37 2008 +0200
@@ -207,8 +207,6 @@ public class SoftChorus implements SoftA
 
 	private float rgain = 0;
 
-	private SoftSynthesizer synth;
-
 	private boolean dirty = true;
 
 	private double dirty_vdelay1L_rate;
@@ -226,11 +224,11 @@ public class SoftChorus implements SoftA
 	private float dirty_vdelay1L_reverbsendgain;
 
 	private float dirty_vdelay1R_reverbsendgain;
-
-	public void init(SoftSynthesizer synth) {
-		this.synth = synth;
-		double samplerate = synth.getFormat().getSampleRate();
-		double controlrate = synth.getControlRate();
+	
+	private float controlrate;
+
+	public void init(float samplerate, float controlrate) {
+		this.controlrate = controlrate;
 		vdelay1L = new LFODelay(samplerate, controlrate);
 		vdelay1R = new LFODelay(samplerate, controlrate);
 		vdelay1L.setGain(1.0f); // %
@@ -334,7 +332,7 @@ public class SoftChorus implements SoftA
 	public void processAudio() {
 
 		if (inputA.isSilent()) {
-			silentcounter += 1 / synth.getControlRate();
+			silentcounter += 1 / controlrate;
 
 			if (silentcounter > 1) {
 				if (!mix) {
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftLimiter.java	Fri May 09 19:04:37 2008 +0200
@@ -52,11 +52,11 @@ public class SoftLimiter implements Soft
 	SoftAudioBuffer bufferLout;
 
 	SoftAudioBuffer bufferRout;
-
-	SoftSynthesizer synth;
-
-	public void init(SoftSynthesizer synth) {
-		this.synth = synth;
+	
+	float controlrate;
+
+	public void init(float samplerate, float controlrate) {
+		this.controlrate = controlrate;
 	}
 
 	public void setInput(int pin, SoftAudioBuffer input) {
@@ -87,7 +87,7 @@ public class SoftLimiter implements Soft
 	public void processAudio() {
 		if (this.bufferL.isSilent()
 				&& (this.bufferR == null || this.bufferR.isSilent())) {
-			silentcounter += 1 / synth.getControlRate();
+			silentcounter += 1 / controlrate;
 
 			if (silentcounter > 60) {
 				if (!mix) {
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java	Fri May 09 19:04:37 2008 +0200
@@ -702,9 +702,11 @@ public class SoftMainMixer {
 		chorus = new SoftChorus();
 		agc = new SoftLimiter();
 
-		reverb.init(synth);
-		chorus.init(synth);
-		agc.init(synth);
+		float samplerate = synth.getFormat().getSampleRate();
+		float controlrate = synth.getControlRate();
+		reverb.init(samplerate, controlrate);
+		chorus.init(samplerate, controlrate);
+		agc.init(samplerate, controlrate);
 
 		reverb.setMixMode(true);
 		chorus.setMixMode(true);
diff -r 6d39bcf18078 -r 30c7450d05dc overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java	Fri May 09 10:25:45 2008 -0400
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftReverb.java	Fri May 09 19:04:37 2008 +0200
@@ -238,8 +238,6 @@ public class SoftReverb implements SoftA
 
 	private SoftAudioBuffer right;
 
-	private SoftSynthesizer synth;
-
 	private boolean dirty = true;
 
 	private float dirty_roomsize;
@@ -250,9 +248,13 @@ public class SoftReverb implements SoftA
 
 	private float dirty_gain;
 	
-	public void init(SoftSynthesizer synth) {
-		this.synth = synth;
-		double samplerate = synth.getFormat().getSampleRate();
+	private float controlrate;
+	
+	private float samplerate;
+	
+	public void init(float samplerate, float controlrate) {
+		this.controlrate = controlrate;		
+		this.samplerate = samplerate;
 
 		double freqscale = ((double) samplerate) / 44100.0;
 		// freqscale = 1.0/ freqscale;
@@ -321,7 +323,7 @@ public class SoftReverb implements SoftA
 	
 	public void processAudio() {
 		if (this.inputA.isSilent()) {
-			silentcounter += 1 / synth.getControlRate();
+			silentcounter += 1 / controlrate;
 
 			if (silentcounter > 60) {
 				if (!mix) {
@@ -473,7 +475,7 @@ public class SoftReverb implements SoftA
 	}
 
 	public void setPreDelay(float value) {
-		delay.setDelay((int) (value * synth.getFormat().getSampleRate()));
+		delay.setDelay((int) (value * samplerate));
 	}
 
 	public void setGain(float gain) {
@@ -481,7 +483,7 @@ public class SoftReverb implements SoftA
 	}
 
 	public void setDamp(float value) {
-		double x = (value / synth.getFormat().getSampleRate()) * (2 * Math.PI);
+		double x = (value / samplerate) * (2 * Math.PI);
 		double cx = 2 - Math.cos(x);
 		damp = (float) (cx - Math.sqrt(cx * cx - 1));
 		if (damp > 1)
diff -r 6d39bcf18078 -r 30c7450d05dc patches/icedtea-gervill.patch
--- a/patches/icedtea-gervill.patch	Fri May 09 10:25:45 2008 -0400
+++ b/patches/icedtea-gervill.patch	Fri May 09 19:04:37 2008 +0200
@@ -28,3 +28,10 @@
  com.sun.media.sound.WaveFileReader
 +com.sun.media.sound.WaveFloatFileReader
 +com.sun.media.sound.SoftMidiAudioFileReader
+--- /home/mark/src/openjdk/jdk/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider	2008-04-13 01:05:30.000000000 +0200
++++ openjdk/jdk/src/share/classes/com/sun/media/sound/services/javax.sound.sampled.spi.FormatConversionProvider	2008-05-09 02:54:26.000000000 +0200
+@@ -2,3 +2,4 @@
+ com.sun.media.sound.UlawCodec
+ com.sun.media.sound.AlawCodec
+ com.sun.media.sound.PCMtoPCMCodec
++com.sun.media.sound.AudioFloatFormatConverter



More information about the distro-pkg-dev mailing list