GetPlayingSegmentInfo() public static method

public static GetPlayingSegmentInfo ( uint in_PlayingID, AkSegmentInfo out_segmentInfo ) : AKRESULT
in_PlayingID uint
out_segmentInfo AkSegmentInfo
return AKRESULT
示例#1
0
    // timing

    protected override void UpdateTimingInternal()
    {
        AkSoundEngine.GetPlayingSegmentInfo(playingId_, segmentInfo_);
        currentMSec_ = segmentInfo_.iCurrentPosition;

        bool isActiveSegmentIsNothing = segmentInfo_.iPreEntryDuration == 0 && segmentInfo_.iPostExitDuration == 0 && segmentInfo_.iActiveDuration == 0;

        if (TransitionState == ETransitionState.Intro && isActiveSegmentIsNothing == false)
        {
            TransitionState = ETransitionState.Active;
        }
        else if (TransitionState == ETransitionState.Active)
        {
            if (isActiveSegmentIsNothing)
            {
                if (StopWhenPostExitOfLastSegment)
                {
                    endOfEvent_ = true;
                }
                else
                {
                    TransitionState = ETransitionState.Outro;
                }
            }
            else if (currentMeter_ == null)
            {
                CalcMeter(segmentInfo_.fBeatDuration, segmentInfo_.fBarDuration, segmentInfo_.iActiveDuration);
            }
        }
    }
 // Update is called once per frame
 void Update()
 {
     if (IsPlaying())
     {
         AkSoundEngine.GetPlayingSegmentInfo(m_PlayingID, m_segmentInfo);
     }
 }
    //this is pretty straightforward - get the elapsed time
    public int GetMusicTimeInMS()
    {
        AkSegmentInfo segmentInfo = new AkSegmentInfo();

        AkSoundEngine.GetPlayingSegmentInfo(playingID, segmentInfo, true);

        return(segmentInfo.iCurrentPosition);
    }
    //We're going to call this when we spawn a gem, in order to determine when it's crossing time should be
    //based on the current playback position, our beat duration, and our beat offset
    public int SetCrossingTimeInMS(int beatOffset)
    {
        AkSegmentInfo segmentInfo = new AkSegmentInfo();

        AkSoundEngine.GetPlayingSegmentInfo(playingID, segmentInfo, true);

        int offsetTime = Mathf.RoundToInt(1000 * secondsPerBeat * beatOffset);

        //Debug.Log("setting time: " + segmentInfo.iCurrentPosition + offsetTime);

        return(segmentInfo.iCurrentPosition + offsetTime);
    }