Пример #1
0
        public void Update()
        {
            if (FinishTime.HasValue)
            {
                return;
            }

            // 終了時間を記録.
            if (playback.GetStatus() == CriAtomExPlayback.Status.Removed)
            {
                FinishTime = Time.realtimeSinceStartup;

                if (onFinish != null)
                {
                    onFinish.OnNext(Unit.Default);
                }
            }
        }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        long numSamples;

        isNowChanged_  = false;
        isJustChanged_ = false;
#if ADX
        if (playback.GetStatus() != CriAtomExPlayback.Status.Playing)
        {
            return;
        }
        int tempOut;
        if (!playback.GetNumPlayedSamples(out numSamples, out tempOut))
        {
            numSamples = -1;
        }
#else
        if (!MusicSource.IsPlaying())
        {
            return;
        }
        numSamples = MusicSource.source.timeSamples;
#endif
        if (numSamples >= 0)
        {
            Just_.bar = (int)(numSamples / SamplesPerBar);
#if ADX
            UpdateNumBlockBar(numSamples);
            if (NumBlockBar != 0)
            {
                Just_.bar %= NumBlockBar;
            }
#else
            if (NumBar != 0)
            {
                Just_.bar %= NumBar;
            }
#endif
            Just_.beat    = (int)((numSamples % SamplesPerBar) / SamplesPerBeat);
            Just_.unit    = (int)((numSamples % SamplesPerBeat) / SamplesPerUnit);
            isFormerHalf_ = (numSamples % SamplesPerUnit) < SamplesPerUnit / 2;
            dtFromJust_   = (double)(numSamples % SamplesPerUnit) / (double)SamplingRate;

            Now_.Copy(Just_);
            if (!isFormerHalf_)
            {
                Now_.Increment();
            }
            if (SamplesInLoop != 0 && numSamples + SamplesPerUnit / 2 >= SamplesInLoop)
            {
                Now_.Init();
            }

            isNowChanged_  = Now_.totalUnit != OldNow.totalUnit;
            isJustChanged_ = Just_.totalUnit != OldJust.totalUnit;

            CallEvents();

            OldNow.Copy(Now_);
            OldJust.Copy(Just_);
        }
        else
        {
            //Debug.LogWarning( "Warning!! Failed to GetNumPlayedSamples" );
        }
    }