String markname=((de.maramuse.soundcomp.parser.Setmark)pv).getMarkName();
for(Voice vv:voices.values()){
if(vv.getSynchronizeMark()!=null&&vv.getSynchronizeMark().equals(markname)){
// stop waiting
vv.setSynchronizeMark(null);
TempoChangeEvent tce=new AbruptTempoChangeEvent(t);
vv.setLastTimingEvent(tce);
vv.setNextEventTimestamp(t);
// TODO if the waiting voice is following global timing, it may now
// have a random beat offset to global - we need to calculate this.
if(vv.isFollowGlobal()){
vv.setBeatOffsetToGlobal(v.getCurrentBeat()-globalBeat);// TODO calculate from last global timing event and current timestamp
vv.setNextEventGlobalBeat(globalBeat);
}
}
}
}else if(pv instanceof de.maramuse.soundcomp.parser.TimingEvent){
// accelerandi / ritardandi treated here
((de.maramuse.soundcomp.parser.TimingEvent)pv).setTempTimestamp(t
+maximumNegativeEventDelay);
TempoChangeEvent tce=((de.maramuse.soundcomp.parser.TimingEvent)pv).toTempoEvent();
if(v.isFollowGlobal()){
if(!(tce instanceof ReturnToGlobalTiming)) // ignore if redundant RTGT appears
if(Double.isNaN(tce.getStartTempo())){
System.out.println("changing global tempo");
tce.setBeat(globalBeat);
globalTempo=tce;// no start tempo given, take the current global tempo
}
if(tce.isVoicelocal()){
// this voice now leaves global timing
System.out.println("leaving global tempo");
v.setLastTempoChange(tce);
v.setFollowGlobal(false);
}else{
// the global timing is about to change
}
}else{
if(Double.isNaN(tce.getStartTempo())){
// no start tempo given, take the current local tempo
tce.setStartTempo(v.getCurrentTempo(t));
}
v.setLastTempoChange(tce);
if(tce instanceof ReturnToGlobalTiming){
// calculate the beat offset of this voice compared to global beat
// then return