# Update speed problem depending on buffer size

**URL:** <https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405>\
**Category:** Unity\
**Created:** [March 26, 2024, 9:39am UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405 "2024-03-26T09:39:51Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![guswnd325.code](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@guswnd325.code](https://qa.fmod.com/u/guswnd325.code)\
**Post date:** [March 26, 2024, 9:39am UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/1 "2024-03-26T09:39:51Z")

</div>

Hello, I am developing a rhythm game using fmod. I am calculating the current playing time of music with the code below, but I changed the buffer size in RuntimeManager.cs.  
After debugging, it seems that the higher the buffer size is set, the slower the update speed of getDSPClock becomes. Is there any way to solve this?

```auto
void SetTime()
 {
     // get existing event instance's underlying ChannelGroup
     AudioManager.instance.eventInstance.getChannelGroup(out FMOD.ChannelGroup cg);

     // get ChannelGroup's DSP clock
     cg.getDSPClock(out ulong dspclock, out ulong parentclock);

     if (firstClock == 0)
     {
         firstClock = dspclock;
     }
	// 0.000020833333333f == 1 / 48000;
     time = (((double)dspclock - (double)firstClock) * 0.000020833333333f * 1000f) - musicOffset;
 }

```

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [March 27, 2024, 12:12am UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/2 "2024-03-27T00:12:09Z")

</div>

Hi,

What version of the FMOD integration are you using? Can I see the whole script you are using to calculate this?

---

<div class="post-metadata">

**Author:** ![guswnd325.code](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@guswnd325.code](https://qa.fmod.com/u/guswnd325.code)\
**Post date:** [March 27, 2024, 1:27pm UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/3 "2024-03-27T13:27:21Z")

</div>

Thank you for answer. The version used is 2.02.21. I can’t upload the full code, but what I want to know is whether the update rate varies depending on the buffer size, and if there is another way to get the song’s playback time.

---

<div class="post-metadata">

**Author:** ![guswnd325.code](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@guswnd325.code](https://qa.fmod.com/u/guswnd325.code)\
**Post date:** [March 27, 2024, 10:45pm UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/6 "2024-03-27T22:45:26Z")

</div>

Thank you for answer.  
System.getSystemTime() function not found in fmod. Do you have example code?

---

<div class="post-metadata">

**Author:** ![guswnd325.code](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@guswnd325.code](https://qa.fmod.com/u/guswnd325.code)\
**Post date:** [March 28, 2024, 10:19pm UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/7 "2024-03-28T22:19:18Z")

</div>

Thank you for answer. The version used is 2.02.21. I can’t upload the full code, but what I want to know is whether the update rate varies depending on the buffer size, and if there is another way to get the song’s playback time.

---

<div class="post-metadata">

**Author:** ![guswnd325.code](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@guswnd325.code](https://qa.fmod.com/u/guswnd325.code)\
**Post date:** [March 29, 2024, 6:14pm UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/8 "2024-03-29T18:14:41Z")

</div>

Thank you for answer. The version used is 2.02.21. I can’t upload the full code, but what I want to know is whether the update rate varies depending on the buffer size, and if there is another way to get the song’s playback time.

---

<div class="post-metadata">

**Author:** ![Connor\_FMOD](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/connor_fmod/32/3685_2.png) [@Connor\_FMOD](https://qa.fmod.com/u/Connor_FMOD)\
**Post date:** [April 10, 2024, 3:28am UTC](https://qa.fmod.com/t/update-speed-problem-depending-on-buffer-size/21405/9 "2024-04-10T03:28:17Z")

</div>

Hi,

Apologies for the delayed response.

Unfortunately, I was unable to reproduce the issue. However, it would make sense that increasing the buffer size would affect the `getDSPClock()`. An alternative option may be using [Channel::getPosition()](https://fmod.com/docs/2.02/api/core-api-channel.html#channel_getposition) this 'Retrieves the current playback position. You can retrieve the Channel from the [ChannelGroup](https://fmod.com/docs/2.02/api/core-api-channelgroup.html) using [ChannelGroup::getChannel()](https://fmod.com/docs/2.02/api/core-api-channelgroup.html#channelgroup_getchannel). You may have to dig down through a few `channelgroup`’s before you can find the right channel.

Hope this helps!
