public uint GetPosition() { uint pos = 0; if (channel != null) { result = channel.getPosition(out pos, FMOD.TIMEUNIT.MS); } return(pos);//return pos / 1000.f; }
public int GetTotalMilliseconds(TIMEUNIT un = TIMEUNIT.MS) { uint pos = 0; songChannel1.getPosition(ref pos, un); return((int)pos); }
public uint GetPosition() { if (channel != null) { uint lenms = 0; channel.getPosition(ref lenms, FMOD.TIMEUNIT.MS); return(lenms); } return(0); }
public TimeSpan GetTime() { if (status == STATUS.PLAY) { uint position; channel.getPosition(out position, TIMEUNIT.MS); return(TimeSpan.FromMilliseconds(position)); } else { return(TimeSpan.FromMilliseconds(0)); } }
void LateUpdate() { FMOD.Channel channel = _mutedSourceJustForUserSpeed.Channel; TimeSpan timespan = TimeSpan.FromMilliseconds(0); if (channel != null) { uint position; channel.getPosition(out position, FMOD.TIMEUNIT.MS); timespan = TimeSpan.FromMilliseconds(position); } _userProgression.text = String.Format("{0:D2}:{1:D2} / {2:D2}:{3:D2}", timespan.Minutes, timespan.Seconds, _totalTimeTimeSpan.Minutes, _totalTimeTimeSpan.Seconds); }
public float GetProgress() { if (_sound != null && _channel != null) { uint len = 0; uint pos = 0; _sound.getLength(out len, TIMEUNIT.MS); _channel.getPosition(out pos, TIMEUNIT.MS); if (pos == 0) { return(0f); } return((float)pos / len); } return(0f); }
public void JoinReference(CustomAudioSource reference) { uint currentPosition, currentReferencePosition; if (Channel == null) { return; } Channel.getPosition(out currentPosition, TIMEUNIT.PCM); reference.Channel.getPosition(out currentReferencePosition, TIMEUNIT.PCM); var gapRatio = Mathf.Round((currentPosition / (float)currentReferencePosition) * 1000) / 1000; Speed = reference.Speed - (gapRatio - 1) * 10; Volume = reference.Volume - Mathf.Abs(gapRatio - 1) * 100; if (currentPosition - currentReferencePosition >= 100 || currentPosition - currentReferencePosition == 0) { return; } Channel.setPosition(currentReferencePosition, TIMEUNIT.PCM); Speed = reference.Speed; }