Exemplo n.º 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;
 }
Exemplo n.º 2
0
        public VibratoPointIteratorBySec(VsqFileEx vsq,
                                         VibratoBPList rate,
                                         int start_rate,
                                         VibratoBPList depth,
                                         int start_depth,
                                         int clock_start,
                                         int clock_width,
                                         float sec_resolution)
        {
            this.vsq            = vsq;
            this.rate           = rate;
            this.start_rate     = start_rate;
            this.depth          = depth;
            this.start_depth    = start_depth;
            this.clock_start    = clock_start;
            this.clock_width    = clock_width;
            this.sec_resolution = sec_resolution;

            sec0        = vsq.getSecFromClock(clock_start);
            sec1        = vsq.getSecFromClock(clock_start + clock_width);
            count       = (int)((sec1 - sec0) / sec_resolution);
            phase       = 0;
            start_rate  = rate.getValue(0.0f, start_rate);
            start_depth = depth.getValue(0.0f, start_depth);
            amplitude   = start_depth * 2.5f / 127.0f / 2.0f; // ビブラートの振幅。
            period      = getPeriodFromRate(start_rate);      //ビブラートの周期、秒
            omega       = (float)(2.0 * Math.PI / period);    // 角速度(rad/sec)
            sec         = sec0;
            fadewidth   = (float)(sec1 - sec0) * 0.2f;
        }
Exemplo n.º 3
0
 public PointD next()
 {
     if (first)
     {
         i     = 0;
         first = false;
         return(new PointD(sec0, 0));
     }
     else
     {
         i++;
         if (i < count)
         {
             double t_sec = sec0 + sec_resolution * i;
             double clock = vsq.getClockFromSec(t_sec);
             if (sec0 <= t_sec && t_sec <= sec0 + fadewidth)
             {
                 amplitude *= (float)(t_sec - sec0) / fadewidth;
             }
             if (sec1 - fadewidth <= t_sec && t_sec <= sec1)
             {
                 amplitude *= (float)(sec1 - t_sec) / fadewidth;
             }
             phase += omega * (t_sec - sec);
             PointD ret = new PointD(t_sec, amplitude * Math.Sin(phase));
             float  v   = (float)(clock - clock_start) / (float)clock_width;
             int    r   = rate.getValue(v, start_rate);
             int    d   = depth.getValue(v, start_depth);
             amplitude = d * 2.5f / 127.0f / 2.0f;
             period    = getPeriodFromRate(r);
             omega     = (float)(2.0 * Math.PI / period);
             sec       = t_sec;
             return(ret);
         }
         else
         {
             return(new PointD());
         }
     }
 }