Package de.maramuse.soundcomp.events

Examples of de.maramuse.soundcomp.events.TempoChangeEvent


        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
View Full Code Here


   * code to verify the tempo change event calculations - as these are far from
   * being trivial, we must test all of them for plausible calculation results.
   */
 
  public void testTempoChangeCalculations() {
  TempoChangeEvent itce=new InverseTempoChangeEvent(10d);
  itce.setBeat(0);
  TempoChangeEvent etce=new ExponentialTempoChangeEvent(10d);
  etce.setBeat(0);
  TempoChangeEvent stce=new SeamlessTempoChangeEvent(10d);
  stce.setBeat(0);
  TempoChangeEvent htce=new HarmonicTempoChangeEvent(10d);
  htce.setBeat(0);
  TempoChangeEvent ltce=new LinearTempoChangeEvent(10d);
  ltce.setBeat(0);
  System.out.println("testing inverse tc accel");
  testTempoChange(itce, true);
  System.out.println("testing exponential tc accel");
  testTempoChange(etce, true);
  System.out.println("testing harmonic tc accel");
View Full Code Here

  }
  }
 
  @Override
  public de.maramuse.soundcomp.events.TempoChangeEvent toTempoEvent() {
  TempoChangeEvent tce=null;
  switch(accelMode){
    case ACCELMODE_ABRUPT:
    tce=new AbruptTempoChangeEvent(tempTimestamp);
    break;
    case ACCELMODE_EXPONENTIAL:
    tce=new ExponentialTempoChangeEvent(tempTimestamp);
    break;
    case ACCELMODE_HARMONIC:
    tce=new HarmonicTempoChangeEvent(tempTimestamp);
    break;
    case ACCELMODE_INVERSE:
    tce=new InverseTempoChangeEvent(tempTimestamp);
    break;
    case ACCELMODE_SEAMLESS:
    tce=new SeamlessTempoChangeEvent(tempTimestamp);
    break;
    case ACCELMODE_RETURN:
    tce=new ReturnToGlobalTiming(tempTimestamp);
    break;
    case ACCELMODE_LINEAR:
    tce=new LinearTempoChangeEvent(tempTimestamp);
    break;
    default:
    return null;
  }
  tce.setEndBpm(endSpeed);
  tce.setStartBpm(startSpeed);
  tce.setBeats(duration);
  tce.setVoicelocal(voicelocal);
  tce.init();
  // tce.setBeat(beat); since this potentially is to be used in another voice,
  // there might be a beat offset necessary. We do not have the necessary info here.
  // if necessary, calculate it in the relevant voice where the previous tempo change,
  // timestamp and beat is known.
  tce.setBeat(Double.NaN);
  return tce;
  }
View Full Code Here

TOP

Related Classes of de.maramuse.soundcomp.events.TempoChangeEvent

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.