changeset 1221:e61cd67602bd

6823445: Gervill SoftChannel/ResetAllControllers jtreg test fails after portamento fix from last merge. Reviewed-by: amenkov
author kalli
date Fri, 17 Apr 2009 16:20:50 +0400
parents 923a730165bf
children 5ac8b97ffabd
files src/share/classes/com/sun/media/sound/SoftChannel.java
diffstat 1 files changed, 7 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/com/sun/media/sound/SoftChannel.java	Fri Apr 17 16:13:43 2009 +0400
+++ b/src/share/classes/com/sun/media/sound/SoftChannel.java	Fri Apr 17 16:20:50 2009 +0400
@@ -67,7 +67,6 @@
         dontResetControls[77] = true;  // Sound Controller 8 (GM2 default: Vibrato Depth)
         dontResetControls[78] = true;  // Sound Controller 9 (GM2 default: Vibrato Delay)
         dontResetControls[79] = true;  // Sound Controller 10 (GM2 default: Undefined)
-        dontResetControls[84] = true;  // Portamento Controller
         dontResetControls[120] = true; // All Sound Off
         dontResetControls[121] = true; // Reset All Controllers
         dontResetControls[122] = true; // Local Control On/Off
@@ -94,7 +93,6 @@
     protected double portamento_time = 1; // keyschanges per control buffer time
     protected int[] portamento_lastnote = new int[128];
     protected int portamento_lastnote_ix = 0;
-    private int portamento_control_note = -1;
     private boolean portamento = false;
     private boolean mono = false;
     private boolean mute = false;
@@ -370,12 +368,12 @@
         voice.setSoloMute(solomute);
         if (releaseTriggered)
             return;
-        if (portamento_control_note != -1) {
+        if (controller[84] != 0) {
             voice.co_noteon_keynumber[0]
-                    = (tuning.getTuning(portamento_control_note) / 100.0)
+                    = (tuning.getTuning(controller[84]) / 100.0)
                     * (1f / 128f);
             voice.portamento = true;
-            portamento_control_note = -1;
+            controlChange(84, 0);
         } else if (portamento) {
             if (mono) {
                 if (portamento_lastnote[0] != -1) {
@@ -383,7 +381,7 @@
                             = (tuning.getTuning(portamento_lastnote[0]) / 100.0)
                             * (1f / 128f);
                     voice.portamento = true;
-                    portamento_control_note = -1;
+                    controlChange(84, 0);
                 }
                 portamento_lastnote[0] = noteNumber;
             } else {
@@ -450,19 +448,19 @@
                     }
                 }
 
-                if (portamento_control_note != -1) {
+                if (controller[84] != 0) {
                     boolean n_found = false;
                     for (int i = 0; i < voices.length; i++) {
                         if (voices[i].on && voices[i].channel == channel
                                 && voices[i].active
-                                && voices[i].note == portamento_control_note
+                                && voices[i].note == controller[84]
                                 && voices[i].releaseTriggered == false) {
                             voices[i].portamento = true;
                             voices[i].setNote(noteNumber);
                             n_found = true;
                         }
                     }
-                    portamento_control_note = -1;
+                    controlChange(84, 0);
                     if (n_found)
                         return;
                 }
@@ -1154,9 +1152,6 @@
                     }
                 }
                 break;
-            case 84:
-                portamento_control_note = value;
-                break;
             case 98:
                 nrpn_control = (nrpn_control & (127 << 7)) + value;
                 rpn_control = RPN_NULL_VALUE;
@@ -1398,10 +1393,6 @@
                     controlChange(i, 0);
             }
 
-            // Portamento Controller (0x54) has to reset
-            // to -1 which mean that Portamento Controller is off
-            portamento_control_note = -1;
-
             controlChange(71, 64); // Filter Resonance
             controlChange(72, 64); // Release Time
             controlChange(73, 64); // Attack Time