[jsyn] WaveDisplay.getRightIndex()

jsyn at music.columbia.edu jsyn at music.columbia.edu
Thu Aug 26 12:33:50 EDT 2004


Hi,

I've been playing around with the WaveDisplay class, and I suspect there 
is a small bug in the method getRightIndex(), as the following lines show

/* dummy init */
WaveDisplay display=new WaveDisplay();
display.addTrace(new WaveTrace(new short[1000],Color.black,1.0));
/* set left=10 and right=100 ... */
display.setLeftIndex(10);
display.setRightIndex(100);          
int left=display.getLeftIndex();
 >> left =10;
int right=display.getRightIndex();
 >> right =10;  // sic

Bad case of copy/paste maybe ?

A possible quick fix when one doesn't have access to the source is to 
extend WaveDisplay in the same package, and overload the getRightIndex 
by returning the (protected) member super.rightIndex;

package com.softsynth.jsyn.view102;
public class BetterWaveDisplay extends WaveDisplay{      
    public int getRightIndex(){       
        return rightIndex;
    }
}

Cheers,
JJ

-- 
Jean-Julien Aucouturier, Assistant Researcher
http://www.csl.sony.fr/~jj
SONY CSL-Paris                 Tel: (33) 1 44 08 05 11
6, rue Amyot                   Fax: (33) 1 45 87 87 50
75005 Paris, France            E-mail: jj at csl.sony.fr 





More information about the JSyn mailing list