Hi all,
It looks like there's a misprint in the docs for Measure's
constructor. The two constructors that use Score and Score collection
have the third parameter listed as numStaves. This value seems to be
the value of the highest staffIndex rather than the number of staves.
Here's some demonstration code.
thanks,
Peter McCulloch
package com.petermcculloch.megalo.scratch;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import com.softsynth.jmsl.JMSL;
import com.softsynth.jmsl.score.Measure;
import com.softsynth.jmsl.score.Score;
import com.softsynth.jmsl.score.Staff;
import com.softsynth.jmsl.util.TimeSignature;
public class TestMeasureAdd {
public static void main(String[] args) {
int numStaffs = 2;
Score score = new Score(numStaffs);
// Number of staves - 1, instead of number of staves
Measure measure = new Measure(score.getScoreCollection(), score,
numStaffs - 1);
// Measure measure =
// new Measure(score.getScoreCollection(), score, numStaffs - 1, new
// TimeSignature(3, 8));
Staff staff = new Staff(measure);
measure.add(staff);
measure.setDoubleBar(true);
score.getScoreCollection().add(measure);
score.addMeasures(3);
JFrame frame = new JFrame();
frame.add(score.getScoreCanvas().getComponent());
frame.addWindowStateListener(new WindowAdapter() {
@Override
public void windowClosed(WindowEvent e) {
JMSL.closeMusicDevices();
System.exit(0);
}
});
frame.pack();
frame.setVisible(true);
}
}
_______________________________________________
jmsl mailing list
jmsl@...
http://music.columbia.edu/mailman/listinfo/jmsl