# Get write position for sound buffer

**URL:** <https://qa.fmod.com/t/get-write-position-for-sound-buffer/20918>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [November 28, 2023, 5:45pm UTC](https://qa.fmod.com/t/get-write-position-for-sound-buffer/20918 "2023-11-28T17:45:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![m.khavro](https://avatars.discourse-cdn.com/v4/letter/m/43a26b/32.png) [@m.khavro](https://qa.fmod.com/u/m.khavro)\
**Post date:** [November 28, 2023, 5:45pm UTC](https://qa.fmod.com/t/get-write-position-for-sound-buffer/20918/1 "2023-11-28T17:45:13Z")

</div>

Hi!  
I’m reworking a part of an old sound engine code, that is using DirectSound API. It forms sound data into packets, which are queued by DSBuffer class. Data is then written into DirectSound buffer by getting offset into it with IDirectSoundBuffer::GetCurrentPosition() function. This function returns current ‘play position’ as well as ‘write position’, that marks a " safe position to write new data".

I was wondering, whether I can replicate such behavior with FMOD. Can someone suggest, how to get such ‘safe’ position for fmod sound object? I’ve only seen Channel::getPosition() function, that returns current play position. Should I track a valid write position myself?

Would be grateful for any help.

---

<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:** [November 29, 2023, 9:20pm UTC](https://qa.fmod.com/t/get-write-position-for-sound-buffer/20918/2 "2023-11-29T21:20:34Z")

</div>

Hi,

An option may be tracking the playback position yourself. We do have an example of this in our C# examples but would still work in C++ here: [Unity Integration | Scripting Examples - Video Playback](https://fmod.com/docs/2.02/unity/examples-video-playback.html#:~:text=if%20).

Hope this helps!
