void CallEvents() { if (isJustChanged_) { OnJustChanged(); } if (isJustChanged_ && just_.Unit == 0) { OnBeat(); } if (isJustChanged_ && just_.Beat == 0 && just_.Unit == 0) { OnBar(); } if (isJustChanged_ && just_ < oldJust_) { currentBlockIndex_ = playback_.GetCurrentBlockIndex(); numBlockBar_ = BlockInfos[currentBlockIndex_].NumBar; if (oldBlockIndex_ == currentBlockIndex_) { OnBlockRepeated(); } else { OnBlockChanged(); } oldBlockIndex_ = currentBlockIndex_; } }
// timing protected override void UpdateTimingInternal() { double startMSec = 0.0; if (ResetTimingOnEachBlock) { prevBlockIndex_ = currentBlockIndex_; currentBlockIndex_ = playback_.GetCurrentBlockIndex(); startMSec = Meter.MSecPerBar * CurrentBlock.StartBar; } // playback_.GetNumPlayedSamplesは、見つかった最初の波形のサンプル数を返してしまい、 // 遷移時に残っていた前のブロックの波形を取ってきてしまうことがあるので断念。 currentMSec_ = Math.Max(0, (int)playback_.GetSequencePosition() - (int)startMSec); }
void PlayStart() { if (Current != null && IsPlaying()) { Stop(); } Current = this; Initialize(); WillBlockChange(); #if ADX playback = MusicSource.source.Play(); NumBlockBar = BlockInfos[playback.GetCurrentBlockIndex()].NumBar; #else MusicSource.Play(); #endif OnBlockChanged(); }
void CallEvents() { if (isNowChanged_) { OnNowChanged(); } if (isNowChanged_ && OldNow > Now_) { #if ADX if (NextBlockIndex == CurrentBlockIndex) { #endif WillRepeat(); #if ADX } else { WillBlockChange(); } #endif } if (isJustChanged_) { OnJustChanged(); } if (isJustChanged_ && Just_.unit == 0) { OnBeat(); } if (isJustChanged_ && Just_.barUnit == 0) { OnBar(); } if (isJustChanged_ && OldJust > Just_) { #if ADX CurrentBlockIndex = playback.GetCurrentBlockIndex(); Debug.Log("CurrentBlockIndex is " + CurrentBlockIndex); if (OldBlockIndex == CurrentBlockIndex) { #endif OnRepeated(); #if ADX } else { OnBlockChanged(); } OldBlockIndex = CurrentBlockIndex; #endif } #if WARN_IF_TIMING_SKIPPED if (isJustChanged_ && Just_.totalUnit > 0) { Timing tempOld = new Timing(OldJust); tempOld.Increment(); if (tempOld.totalUnit != Just_.totalUnit) { //This often happens when the frame rate is slow. Debug.LogWarning("Skipped some timing: OldJust = " + OldJust.ToString() + ", Just = " + Just_.ToString()); } } #endif }