예제 #1
0
 public void rewind()
 {
     mSec0       = mTempoTable.getSecFromClock(mClockStart);
     mSec1       = mTempoTable.getSecFromClock(mClockStart + mClockWidth);
     mFadeWidth  = (float)(mSec1 - mSec0) * 0.2f;
     mPhase      = 0;
     mStartRate  = mRate.getValue(0.0f, mStartRate);
     mStartDepth = mDepth.getValue(0.0f, mStartDepth);
     mAmplitude  = mStartDepth * 2.5f / 127.0f / 2.0f;                      // ビブラートの振幅。
     mPeriod     = VibratoPointIteratorBySec.getPeriodFromRate(mStartRate); //ビブラートの周期、秒
     mOmega      = (float)(2.0 * Math.PI / mPeriod);                        // 角速度(rad/sec)
     mSec        = mSec0;
     mIndex      = 0;
     mFirst      = true;
 }
예제 #2
0
 public Double next()
 {
     if (mFirst)
     {
         mFirst = false;
         return(0.0);
     }
     else
     {
         mIndex++;
         if (mIndex < mClockWidth)
         {
             int    clock = mClockStart + mIndex;
             double t_sec = mTempoTable.getSecFromClock(clock);
             if (mSec0 <= t_sec && t_sec <= mSec0 + mFadeWidth)
             {
                 mAmplitude *= (t_sec - mSec0) / mFadeWidth;
             }
             if (mSec1 - mFadeWidth <= t_sec && t_sec <= mSec1)
             {
                 mAmplitude *= (mSec1 - t_sec) / mFadeWidth;
             }
             mPhase += mOmega * (t_sec - mSec);
             double ret = mAmplitude * Math.Sin(mPhase);
             float  v   = (float)(clock - mClockStart) / (float)mClockWidth;
             int    r   = mRate.getValue(v, mStartRate);
             int    d   = mDepth.getValue(v, mStartDepth);
             mAmplitude = d * 2.5f / 127.0f / 2.0f;
             mPeriod    = VibratoPointIteratorBySec.getPeriodFromRate(r);
             mOmega     = (float)(2.0 * Math.PI / mPeriod);
             mSec       = t_sec;
             return(ret);
         }
         else
         {
             return(0.0);
         }
     }
 }