*/
protected Sequence scoreToSeq(Score score)
throws InvalidMidiDataException {
//Create the Sequence
Sequence sequence = new Sequence(Sequence.PPQ, m_ppqn);
if (null == sequence) {
return null;
}
m_masterTempo = m_currentTempo =
new Float(score.getTempo()).floatValue();
//System.out.println("jMusic MidiSynth notification: Score TempoEvent (BPM) = " + score.getTempo());
Track longestTrack = null;
double longestTime = 0.0;
double longestRatio = 1.0;
Enumeration parts = score.getPartList().elements();
while(parts.hasMoreElements()) {
Part inst = (Part) parts.nextElement();
int currChannel = inst.getChannel();
if (currChannel > 16) {
throw new
InvalidMidiDataException(inst.getTitle() +
" - Invalid Channel Number: " +
currChannel);
}
m_tempoHistory.push(new Float(m_currentTempo));
float tempo = new Float(inst.getTempo()).floatValue();
//System.out.println("jMusic MidiSynth notification: Part TempoEvent (BPM) = " + tempo);
if (tempo != Part.DEFAULT_TEMPO) {
m_currentTempo = tempo;
} else if (tempo < Part.DEFAULT_TEMPO)
System.out.println("jMusic MidiSynth error: Part TempoEvent (BPM) too low = " + tempo);
trackTempoRatio = m_masterTempo/m_currentTempo;
int instrument = inst.getInstrument();
if (instrument == NO_INSTRUMENT) instrument = 0;
Enumeration phrases = inst.getPhraseList().elements();
double max = 0;
double currentTime = 0.0;
//
// One track per Part
/////////////
Track currTrack=sequence.createTrack();
while(phrases.hasMoreElements()) {
/////////////////////////////////////////////////
// Each phrase represents a new Track element
// Err no
// There is a 65? track limit