Project

General

Profile

« Previous | Next » 

Revision 24b1f190

Added by Leszek Koltunski almost 3 years ago

RubikControl: fixes; progress.

View differences:

src/main/java/org/distorted/library/type/Dynamic.java
56 56
//
57 57
// and similarly Y(t) and Z(t).
58 58

  
59
public abstract class Dynamic implements InternalMaster.Slave
59
public abstract class Dynamic
60 60
  {
61 61
  /**
62 62
   * One revolution takes us from the first point to the last and back to first through the shortest path.
......
164 164
  private long mCorrectedTime;
165 165
  private static long mPausedTime;
166 166

  
167
  private static final int JOB_RESET = 0;
168

  
169
  private static class Job
170
    {
171
    int type;
172

  
173
    Job(int t)
174
      {
175
      type  = t;
176
      }
177
    }
178

  
179
  private ArrayList<Job> mJobs;
180

  
181 167
///////////////////////////////////////////////////////////////////////////////////////////////////
182 168
// hide this from Javadoc
183 169
  
......
540 526
      }
541 527
    }
542 528

  
543
///////////////////////////////////////////////////////////////////////////////////////////////////
544

  
545
  private void resetToBeginningNow()
546
    {
547
    mStartTime = -1;
548
    }
549

  
550 529
///////////////////////////////////////////////////////////////////////////////////////////////////
551 530

  
552 531
  abstract void interpolate(float[] buffer, int offset, float time);
......
619 598
 */
620 599
  public void resetToBeginning()
621 600
    {
622
    if( mJobs==null ) mJobs = new ArrayList<>();
623

  
624
    mJobs.add(new Job(JOB_RESET));
625
    InternalMaster.newSlave(this);
601
    mStartTime = -1;
626 602
    }
627 603

  
628 604
///////////////////////////////////////////////////////////////////////////////////////////////////
......
759 735
    interpolate(buffer,offset, (float)(pos-(int)pos) );
760 736
    return false;
761 737
    }
762

  
763
///////////////////////////////////////////////////////////////////////////////////////////////////
764

  
765
  public void doWork()
766
    {
767
    int num = mJobs.size();
768
    Job job;
769

  
770
    for(int i=0; i<num; i++)
771
      {
772
      job = mJobs.remove(0);
773

  
774
      if (job.type == JOB_RESET )
775
        {
776
        resetToBeginningNow();
777
        }
778
      }
779
    }
780

  
781
///////////////////////////////////////////////////////////////////////////////////////////////////
782 738
  }

Also available in: Unified diff