Hi,
I updated the IcedTea6 Gervill overlay with current Gervill CVS.
Out current set of changes compared with upstream are now really minimal
(diff attached). It incorporates a couple of the fixes for the
unloadInstruments methods from icedtea. It also fixes an imported bug
reported against icedtea "freezes on simple midi app":
http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=213
Also since openjdk6 imported a newer Gervill and incorporated a couple
of the changes in the icedtea gervill not yet upstream, we are a bit
closer again. diff between icedtea6-openjdk6 attached. Some of this is
just reformatting changed done in the openjdk6 on the upstream sources.
Not included in the diff is the renaming/changes to the upstream tests
(most of which are similar to our and upstream tests, but repackaged and
slightly reformatted).
All jtreg tests, both the com/sun/media/sound ones from upstream, as the
older javax/sound/midi in openjdk6 (which are almost all a copy of the
upstream tests renamed into a different package) pass.
And you can run them with the new jtreg -s flag, which gives an enormous
speed boost! That is in 45 seconds. Compared to 4.5 minutes without -s.
Test results: passed: 475
2008-11-10 Mark Wielaard <[EMAIL PROTECTED]>
* overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/
CHANGES.txt,SoftAudioPusher.java,SoftFilter.java,
SoftJitterCorrector.java,SoftMainMixer.java,SoftVoice.java:
Updated to new Gervill CVS.
Changes to the icedtea overlays since last import attached.
The actual changes to Gervill since our last import:
- Fix: Throw IllegalArgumentException Exception on
invalid soundbank to:
SoftSynthesizer.unloadAllInstruments(Soundbank soundbank)
SoftSynthesizer.unloadInstruments(Soundbank soundbank, Patch[] patchList)
just like done in:
SoftSynthesizer.unloadInstrument(Instrument instrument).
- Change: SoftMainMixer, SoftVoice optimized for mono voices.
- Change: SoftFilter optimized.
- Fix: Turn SoftJitterCorrector, SoftAudioPusher threads into a daemon threads.
These threads prevented the VM to exit when synthesizer was open.
See: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=213
Cheers,
Mark
Index: build.xml
===================================================================
RCS file: /cvs/gervill/build.xml,v
retrieving revision 1.2
diff -u -r1.2 build.xml
--- build.xml 14 Dec 2007 03:33:11 -0000 1.2
+++ build.xml 10 Nov 2008 10:09:28 -0000
@@ -29,7 +29,8 @@
<!-- run javac to compile the source files -->
<target name="compile" depends="init">
<javac srcdir="${src}"
-destdir="${build}">
+destdir="${build}"
+debug="true">
<classpath>
<path refid="lib.path"/>
</classpath>
@@ -69,4 +70,4 @@
<delete dir="${lib}"/>
<delete dir="${docs}"/>
</target>
-</project>
\ No newline at end of file
+</project>
Index: src/com/sun/media/sound/DLSSoundbankReader.java
===================================================================
RCS file: /cvs/gervill/src/com/sun/media/sound/DLSSoundbankReader.java,v
retrieving revision 1.3
diff -u -r1.3 DLSSoundbankReader.java
--- src/com/sun/media/sound/DLSSoundbankReader.java 5 Jun 2008 01:55:28 -0000 1.3
+++ src/com/sun/media/sound/DLSSoundbankReader.java 10 Nov 2008 10:09:28 -0000
@@ -47,6 +47,8 @@
return new DLSSoundbank(url);
} catch (RIFFInvalidFormatException e) {
return null;
+ } catch(IOException ioe) {
+ return null;
}
}
Index: src/com/sun/media/sound/SF2SoundbankReader.java
===================================================================
RCS file: /cvs/gervill/src/com/sun/media/sound/SF2SoundbankReader.java,v
retrieving revision 1.3
diff -u -r1.3 SF2SoundbankReader.java
--- src/com/sun/media/sound/SF2SoundbankReader.java 5 Jun 2008 01:55:33 -0000 1.3
+++ src/com/sun/media/sound/SF2SoundbankReader.java 10 Nov 2008 10:09:28 -0000
@@ -46,6 +46,8 @@
return new SF2Soundbank(url);
} catch (RIFFInvalidFormatException e) {
return null;
+ } catch(IOException ioe) {
+ return null;
}
}
Index: src/com/sun/media/sound/SoftChannel.java
===================================================================
RCS file: /cvs/gervill/src/com/sun/media/sound/SoftChannel.java,v
retrieving revision 1.11
diff -u -r1.11 SoftChannel.java
--- src/com/sun/media/sound/SoftChannel.java 27 Jul 2008 19:06:21 -0000 1.11
+++ src/com/sun/media/sound/SoftChannel.java 10 Nov 2008 10:09:28 -0000
@@ -1215,7 +1215,9 @@
public int getController(int controller) {
synchronized (control_mutex) {
- return this.controller[controller];
+ // Should only return lower 7 bits,
+ // even when controller is "boosted" higher.
+ return this.controller[controller] & 127;
}
}
--- /home/mark/src/openjdk6/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java 2008-11-05 10:12:10.000000000 +0100
+++ jdk/src/share/classes/com/sun/media/sound/SoftFilter.java 2008-11-10 10:40:49.000000000 +0100
@@ -543,8 +543,6 @@
public void filter1(SoftAudioBuffer sbuffer) {
- float[] buffer = sbuffer.array();
-
if (dirty) {
filter1calc();
dirty = false;
@@ -559,6 +557,7 @@
if (wet > 0 || last_wet > 0) {
+ float[] buffer = sbuffer.array();
int len = buffer.length;
float a0 = this.last_a0;
float q = this.last_q;
@@ -577,14 +576,16 @@
q += q_delta;
gain += gain_delta;
wet += wet_delta;
- y1 = (1 - q * a0) * y1 - (a0) * y2 + (a0) * buffer[i];
- y2 = (1 - q * a0) * y2 + (a0) * y1;
+ float ga0 = (1 - q * a0);
+ y1 = ga0 * y1 + (a0) * (buffer[i] - y2);
+ y2 = ga0 * y2 + (a0) * y1;
buffer[i] = y2 * gain * wet + buffer[i] * (1 - wet);
}
} else if (a0_delta == 0 && q_delta == 0) {
+ float ga0 = (1 - q * a0);
for (int i = 0; i < len; i++) {
- y1 = (1 - q * a0) * y1 - (a0) * y2 + (a0) * buffer[i];
- y2 = (1 - q * a0) * y2 + (a0) * y1;
+ y1 = ga0 * y1 + (a0) * (buffer[i] - y2);
+ y2 = ga0 * y2 + (a0) * y1;
buffer[i] = y2 * gain;
}
} else {
@@ -592,8 +593,9 @@
a0 += a0_delta;
q += q_delta;
gain += gain_delta;
- y1 = (1 - q * a0) * y1 - (a0) * y2 + (a0) * buffer[i];
- y2 = (1 - q * a0) * y2 + (a0) * y1;
+ float ga0 = (1 - q * a0);
+ y1 = ga0 * y1 + (a0) * (buffer[i] - y2);
+ y2 = ga0 * y2 + (a0) * y1;
buffer[i] = y2 * gain;
}
}
@@ -611,4 +613,4 @@
this.last_gain = this.gain;
this.last_wet = this.wet;
}
-}
+}
\ No newline at end of file
--- /home/mark/src/openjdk6/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java 2008-11-05 10:12:10.000000000 +0100
+++ jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java 2008-11-10 10:40:49.000000000 +0100
@@ -48,16 +48,18 @@
public final static int CHANNEL_LEFT = 0;
public final static int CHANNEL_RIGHT = 1;
- public final static int CHANNEL_EFFECT1 = 2;
- public final static int CHANNEL_EFFECT2 = 3;
- public final static int CHANNEL_EFFECT3 = 4;
- public final static int CHANNEL_EFFECT4 = 5;
+ public final static int CHANNEL_MONO = 2;
+ public final static int CHANNEL_EFFECT1 = 3;
+ public final static int CHANNEL_EFFECT2 = 4;
+ public final static int CHANNEL_EFFECT3 = 5;
+ public final static int CHANNEL_EFFECT4 = 6;
public final static int CHANNEL_LEFT_DRY = 10;
public final static int CHANNEL_RIGHT_DRY = 11;
public final static int CHANNEL_SCRATCH1 = 12;
public final static int CHANNEL_SCRATCH2 = 13;
public final static int CHANNEL_CHANNELMIXER_LEFT = 14;
public final static int CHANNEL_CHANNELMIXER_RIGHT = 15;
+ public final static int CHANNEL_CHANNELMIXER_MONO = 16;
protected boolean active_sensing_on = false;
private long msec_last_activity = -1;
private boolean pusher_silent = false;
@@ -485,8 +487,10 @@
// to channelmixer left,right input/output
SoftAudioBuffer leftbak = buffers[CHANNEL_LEFT];
SoftAudioBuffer rightbak = buffers[CHANNEL_RIGHT];
+ SoftAudioBuffer monobak = buffers[CHANNEL_MONO];
buffers[CHANNEL_LEFT] = buffers[CHANNEL_CHANNELMIXER_LEFT];
- buffers[CHANNEL_RIGHT] = buffers[CHANNEL_CHANNELMIXER_LEFT];
+ buffers[CHANNEL_RIGHT] = buffers[CHANNEL_CHANNELMIXER_RIGHT];
+ buffers[CHANNEL_MONO] = buffers[CHANNEL_CHANNELMIXER_MONO];
int bufferlen = buffers[CHANNEL_LEFT].getSize();
@@ -503,6 +507,7 @@
for (ModelChannelMixer cmixer : act_registeredMixers) {
for (int i = 0; i < cbuffer.length; i++)
Arrays.fill(cbuffer[i], 0);
+ buffers[CHANNEL_MONO].clear();
boolean hasactivevoices = false;
for (int i = 0; i < voicestatus.length; i++)
if (voicestatus[i].active)
@@ -516,6 +521,26 @@
cur_registeredMixers = null;
}
}
+
+ if(!buffers[CHANNEL_MONO].isSilent())
+ {
+ float[] mono = buffers[CHANNEL_MONO].array();
+ float[] left = buffers[CHANNEL_LEFT].array();
+ if (nrofchannels != 1) {
+ float[] right = buffers[CHANNEL_RIGHT].array();
+ for (int i = 0; i < bufferlen; i++) {
+ float v = mono[i];
+ left[i] += v;
+ right[i] += v;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < bufferlen; i++) {
+ left[i] += mono[i];
+ }
+ }
+ }
for (int i = 0; i < cbuffer.length; i++) {
float[] cbuff = cbuffer[i];
@@ -539,6 +564,7 @@
buffers[CHANNEL_LEFT] = leftbak;
buffers[CHANNEL_RIGHT] = rightbak;
+ buffers[CHANNEL_MONO] = monobak;
}
@@ -546,6 +572,27 @@
if (voicestatus[i].active)
if (voicestatus[i].channelmixer == null)
voicestatus[i].processAudioLogic(buffers);
+
+ if(!buffers[CHANNEL_MONO].isSilent())
+ {
+ float[] mono = buffers[CHANNEL_MONO].array();
+ float[] left = buffers[CHANNEL_LEFT].array();
+ int bufferlen = buffers[CHANNEL_LEFT].getSize();
+ if (nrofchannels != 1) {
+ float[] right = buffers[CHANNEL_RIGHT].array();
+ for (int i = 0; i < bufferlen; i++) {
+ float v = mono[i];
+ left[i] += v;
+ right[i] += v;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < bufferlen; i++) {
+ left[i] += mono[i];
+ }
+ }
+ }
// Run effects
if (synth.chorus_on)
@@ -665,7 +712,7 @@
/ synth.getControlRate());
control_mutex = synth.control_mutex;
- buffers = new SoftAudioBuffer[16];
+ buffers = new SoftAudioBuffer[17];
for (int i = 0; i < buffers.length; i++) {
buffers[i] = new SoftAudioBuffer(buffersize, synth.getFormat());
}
--- /home/mark/src/openjdk6/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java 2008-11-05 10:12:10.000000000 +0100
+++ jdk/src/share/classes/com/sun/media/sound/SoftVoice.java 2008-11-10 10:40:49.000000000 +0100
@@ -782,6 +782,7 @@
SoftAudioBuffer left = buffer[SoftMainMixer.CHANNEL_LEFT];
SoftAudioBuffer right = buffer[SoftMainMixer.CHANNEL_RIGHT];
+ SoftAudioBuffer mono = buffer[SoftMainMixer.CHANNEL_MONO];
SoftAudioBuffer eff1 = buffer[SoftMainMixer.CHANNEL_EFFECT1];
SoftAudioBuffer eff2 = buffer[SoftMainMixer.CHANNEL_EFFECT2];
SoftAudioBuffer leftdry = buffer[SoftMainMixer.CHANNEL_LEFT_DRY];
@@ -802,17 +803,26 @@
if (rightdry != null)
mixAudioStream(rightdry, left, last_out_mixer_left,
out_mixer_left);
- } else {
- mixAudioStream(leftdry, left, last_out_mixer_left, out_mixer_left);
- if (rightdry != null)
- mixAudioStream(rightdry, right, last_out_mixer_right,
- out_mixer_right);
+ } else {
+ if(rightdry == null &&
+ last_out_mixer_left == last_out_mixer_right &&
+ out_mixer_left == out_mixer_right)
+ {
+ mixAudioStream(leftdry, mono, last_out_mixer_left, out_mixer_left);
+ }
else
- mixAudioStream(leftdry, right, last_out_mixer_right,
+ {
+ mixAudioStream(leftdry, left, last_out_mixer_left, out_mixer_left);
+ if (rightdry != null)
+ mixAudioStream(rightdry, right, last_out_mixer_right,
+ out_mixer_right);
+ else
+ mixAudioStream(leftdry, right, last_out_mixer_right,
out_mixer_right);
+ }
}
- if (rightdry == null) {
+ if (rightdry == null) {
mixAudioStream(leftdry, eff1, last_out_mixer_effect1,
out_mixer_effect1);
mixAudioStream(leftdry, eff2, last_out_mixer_effect2,
--- /home/mark/src/openjdk6/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java 2008-11-05 10:12:10.000000000 +0100
+++ jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java 2008-11-10 10:40:49.000000000 +0100
@@ -216,6 +216,7 @@
};
thread = new Thread(runnable);
+ thread.setDaemon(true);
thread.setPriority(Thread.MAX_PRIORITY);
thread.start();
}
--- /home/mark/src/openjdk6/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java 2008-11-05 10:12:09.000000000 +0100
+++ jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java 2008-11-10 10:40:49.000000000 +0100
@@ -54,6 +54,7 @@
return;
active = true;
audiothread = new Thread(this);
+ audiothread.setDaemon(true);
audiothread.setPriority(Thread.MAX_PRIORITY);
audiothread.start();
}
diff -r 688efd120766 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 Sun Nov 09 22:31:21 2008 +0100
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/CHANGES.txt Mon Nov 10 12:07:31 2008 +0100
@@ -1,3 +1,14 @@
+ - Fix: Throw IllegalArgumentException Exception on
+ invalid soundbank to:
+ SoftSynthesizer.unloadAllInstruments(Soundbank soundbank)
+ SoftSynthesizer.unloadInstruments(Soundbank soundbank, Patch[] patchList)
+ just like done in:
+ SoftSynthesizer.unloadInstrument(Instrument instrument).
+ - Change: SoftMainMixer, SoftVoice optimized for mono voices.
+ - Change: SoftFilter optimized.
+ - Fix: Turn SoftJitterCorrector, SoftAudioPusher threads into a daemon threads.
+ These threads prevented the VM to exit when synthesizer was open.
+ See: http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=213
- Add: More JTreg tests added:
EmergencySoundbank
SoftFilter
@@ -6,6 +17,8 @@
- Fix: ModelByteBuffer.skip called super.skip
instead to call to RandomAccessFile directly.
JTreg tests added: ModelByteBuffer/RandomFileInputStream/*.java
+
+Version 1.0.2 (released in OpenJDK 6 b12)
- Fix: ModelByteBuffer.len was being modified in inner
class RandomFileInputStream. The variable was made final
and RandomFileInputStream.read methods where fixed.
@@ -13,7 +26,7 @@
Keys array was to small, it couldn't
hold all possible midi notes (0..127).
-Version 1.0.1
+Version 1.0.1 (released as 1.0)
- Fix: Created dummy SourceDataline so that following
jtreg test can be tested without using
a real Audio Device SourceDataLine.
diff -r 688efd120766 overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java Sun Nov 09 22:31:21 2008 +0100
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftAudioPusher.java Mon Nov 10 12:07:31 2008 +0100
@@ -54,6 +54,7 @@
return;
active = true;
audiothread = new Thread(this);
+ audiothread.setDaemon(true);
audiothread.setPriority(Thread.MAX_PRIORITY);
audiothread.start();
}
diff -r 688efd120766 overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java Sun Nov 09 22:31:21 2008 +0100
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftFilter.java Mon Nov 10 12:07:31 2008 +0100
@@ -543,8 +543,6 @@
public void filter1(SoftAudioBuffer sbuffer) {
- float[] buffer = sbuffer.array();
-
if (dirty) {
filter1calc();
dirty = false;
@@ -559,6 +557,7 @@
if (wet > 0 || last_wet > 0) {
+ float[] buffer = sbuffer.array();
int len = buffer.length;
float a0 = this.last_a0;
float q = this.last_q;
@@ -577,14 +576,16 @@
q += q_delta;
gain += gain_delta;
wet += wet_delta;
- y1 = (1 - q * a0) * y1 - (a0) * y2 + (a0) * buffer[i];
- y2 = (1 - q * a0) * y2 + (a0) * y1;
+ float ga0 = (1 - q * a0);
+ y1 = ga0 * y1 + (a0) * (buffer[i] - y2);
+ y2 = ga0 * y2 + (a0) * y1;
buffer[i] = y2 * gain * wet + buffer[i] * (1 - wet);
}
} else if (a0_delta == 0 && q_delta == 0) {
+ float ga0 = (1 - q * a0);
for (int i = 0; i < len; i++) {
- y1 = (1 - q * a0) * y1 - (a0) * y2 + (a0) * buffer[i];
- y2 = (1 - q * a0) * y2 + (a0) * y1;
+ y1 = ga0 * y1 + (a0) * (buffer[i] - y2);
+ y2 = ga0 * y2 + (a0) * y1;
buffer[i] = y2 * gain;
}
} else {
@@ -592,8 +593,9 @@
a0 += a0_delta;
q += q_delta;
gain += gain_delta;
- y1 = (1 - q * a0) * y1 - (a0) * y2 + (a0) * buffer[i];
- y2 = (1 - q * a0) * y2 + (a0) * y1;
+ float ga0 = (1 - q * a0);
+ y1 = ga0 * y1 + (a0) * (buffer[i] - y2);
+ y2 = ga0 * y2 + (a0) * y1;
buffer[i] = y2 * gain;
}
}
@@ -611,4 +613,4 @@
this.last_gain = this.gain;
this.last_wet = this.wet;
}
-}
+}
\ No newline at end of file
diff -r 688efd120766 overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java Sun Nov 09 22:31:21 2008 +0100
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java Mon Nov 10 12:07:31 2008 +0100
@@ -216,6 +216,7 @@
};
thread = new Thread(runnable);
+ thread.setDaemon(true);
thread.setPriority(Thread.MAX_PRIORITY);
thread.start();
}
diff -r 688efd120766 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 Sun Nov 09 22:31:21 2008 +0100
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftMainMixer.java Mon Nov 10 12:07:31 2008 +0100
@@ -48,16 +48,18 @@
public final static int CHANNEL_LEFT = 0;
public final static int CHANNEL_RIGHT = 1;
- public final static int CHANNEL_EFFECT1 = 2;
- public final static int CHANNEL_EFFECT2 = 3;
- public final static int CHANNEL_EFFECT3 = 4;
- public final static int CHANNEL_EFFECT4 = 5;
+ public final static int CHANNEL_MONO = 2;
+ public final static int CHANNEL_EFFECT1 = 3;
+ public final static int CHANNEL_EFFECT2 = 4;
+ public final static int CHANNEL_EFFECT3 = 5;
+ public final static int CHANNEL_EFFECT4 = 6;
public final static int CHANNEL_LEFT_DRY = 10;
public final static int CHANNEL_RIGHT_DRY = 11;
public final static int CHANNEL_SCRATCH1 = 12;
public final static int CHANNEL_SCRATCH2 = 13;
public final static int CHANNEL_CHANNELMIXER_LEFT = 14;
public final static int CHANNEL_CHANNELMIXER_RIGHT = 15;
+ public final static int CHANNEL_CHANNELMIXER_MONO = 16;
protected boolean active_sensing_on = false;
private long msec_last_activity = -1;
private boolean pusher_silent = false;
@@ -485,8 +487,10 @@
// to channelmixer left,right input/output
SoftAudioBuffer leftbak = buffers[CHANNEL_LEFT];
SoftAudioBuffer rightbak = buffers[CHANNEL_RIGHT];
+ SoftAudioBuffer monobak = buffers[CHANNEL_MONO];
buffers[CHANNEL_LEFT] = buffers[CHANNEL_CHANNELMIXER_LEFT];
- buffers[CHANNEL_RIGHT] = buffers[CHANNEL_CHANNELMIXER_LEFT];
+ buffers[CHANNEL_RIGHT] = buffers[CHANNEL_CHANNELMIXER_RIGHT];
+ buffers[CHANNEL_MONO] = buffers[CHANNEL_CHANNELMIXER_MONO];
int bufferlen = buffers[CHANNEL_LEFT].getSize();
@@ -503,6 +507,7 @@
for (ModelChannelMixer cmixer : act_registeredMixers) {
for (int i = 0; i < cbuffer.length; i++)
Arrays.fill(cbuffer[i], 0);
+ buffers[CHANNEL_MONO].clear();
boolean hasactivevoices = false;
for (int i = 0; i < voicestatus.length; i++)
if (voicestatus[i].active)
@@ -516,6 +521,26 @@
cur_registeredMixers = null;
}
}
+
+ if(!buffers[CHANNEL_MONO].isSilent())
+ {
+ float[] mono = buffers[CHANNEL_MONO].array();
+ float[] left = buffers[CHANNEL_LEFT].array();
+ if (nrofchannels != 1) {
+ float[] right = buffers[CHANNEL_RIGHT].array();
+ for (int i = 0; i < bufferlen; i++) {
+ float v = mono[i];
+ left[i] += v;
+ right[i] += v;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < bufferlen; i++) {
+ left[i] += mono[i];
+ }
+ }
+ }
for (int i = 0; i < cbuffer.length; i++) {
float[] cbuff = cbuffer[i];
@@ -539,6 +564,7 @@
buffers[CHANNEL_LEFT] = leftbak;
buffers[CHANNEL_RIGHT] = rightbak;
+ buffers[CHANNEL_MONO] = monobak;
}
@@ -546,6 +572,27 @@
if (voicestatus[i].active)
if (voicestatus[i].channelmixer == null)
voicestatus[i].processAudioLogic(buffers);
+
+ if(!buffers[CHANNEL_MONO].isSilent())
+ {
+ float[] mono = buffers[CHANNEL_MONO].array();
+ float[] left = buffers[CHANNEL_LEFT].array();
+ int bufferlen = buffers[CHANNEL_LEFT].getSize();
+ if (nrofchannels != 1) {
+ float[] right = buffers[CHANNEL_RIGHT].array();
+ for (int i = 0; i < bufferlen; i++) {
+ float v = mono[i];
+ left[i] += v;
+ right[i] += v;
+ }
+ }
+ else
+ {
+ for (int i = 0; i < bufferlen; i++) {
+ left[i] += mono[i];
+ }
+ }
+ }
// Run effects
if (synth.chorus_on)
@@ -665,7 +712,7 @@
/ synth.getControlRate());
control_mutex = synth.control_mutex;
- buffers = new SoftAudioBuffer[16];
+ buffers = new SoftAudioBuffer[17];
for (int i = 0; i < buffers.length; i++) {
buffers[i] = new SoftAudioBuffer(buffersize, synth.getFormat());
}
diff -r 688efd120766 overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java
--- a/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java Sun Nov 09 22:31:21 2008 +0100
+++ b/overlays/openjdk/jdk/src/share/classes/com/sun/media/sound/SoftVoice.java Mon Nov 10 12:07:31 2008 +0100
@@ -782,6 +782,7 @@
SoftAudioBuffer left = buffer[SoftMainMixer.CHANNEL_LEFT];
SoftAudioBuffer right = buffer[SoftMainMixer.CHANNEL_RIGHT];
+ SoftAudioBuffer mono = buffer[SoftMainMixer.CHANNEL_MONO];
SoftAudioBuffer eff1 = buffer[SoftMainMixer.CHANNEL_EFFECT1];
SoftAudioBuffer eff2 = buffer[SoftMainMixer.CHANNEL_EFFECT2];
SoftAudioBuffer leftdry = buffer[SoftMainMixer.CHANNEL_LEFT_DRY];
@@ -802,17 +803,26 @@
if (rightdry != null)
mixAudioStream(rightdry, left, last_out_mixer_left,
out_mixer_left);
- } else {
- mixAudioStream(leftdry, left, last_out_mixer_left, out_mixer_left);
- if (rightdry != null)
- mixAudioStream(rightdry, right, last_out_mixer_right,
+ } else {
+ if(rightdry == null &&
+ last_out_mixer_left == last_out_mixer_right &&
+ out_mixer_left == out_mixer_right)
+ {
+ mixAudioStream(leftdry, mono, last_out_mixer_left, out_mixer_left);
+ }
+ else
+ {
+ mixAudioStream(leftdry, left, last_out_mixer_left, out_mixer_left);
+ if (rightdry != null)
+ mixAudioStream(rightdry, right, last_out_mixer_right,
out_mixer_right);
- else
- mixAudioStream(leftdry, right, last_out_mixer_right,
+ else
+ mixAudioStream(leftdry, right, last_out_mixer_right,
out_mixer_right);
+ }
}
- if (rightdry == null) {
+ if (rightdry == null) {
mixAudioStream(leftdry, eff1, last_out_mixer_effect1,
out_mixer_effect1);
mixAudioStream(leftdry, eff2, last_out_mixer_effect2,
_______________________________________________
audio-engine-dev mailing list
[email protected]
http://mail.openjdk.java.net/mailman/listinfo/audio-engine-dev