# FMOD\_OPENUSER read callback only called once

**URL:** <https://qa.fmod.com/t/fmod-openuser-read-callback-only-called-once/12509>\
**Category:** FMOD Engine\
**Created:** [May 29, 2016, 10:47pm UTC](https://qa.fmod.com/t/fmod-openuser-read-callback-only-called-once/12509 "2016-05-29T22:47:01Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Kryofenix](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kryofenix](https://qa.fmod.com/u/Kryofenix)\
**Post date:** [May 29, 2016, 10:47pm UTC](https://qa.fmod.com/t/fmod-openuser-read-callback-only-called-once/12509/1 "2016-05-29T22:47:01Z")

</div>

Hello,

I am reading PCM16 samples from a hardware device and am trying to play back the sound with FMOD.

My current method is to use FMOD\_OPENUSER | FMOD\_LOOP\_NORMAL, and to use lock()/unlock() to write directly into the buffer. While this works you are now faced with the problem of synchronizing the cursors so the read cursor from FMOD doesn’t overtake the write. This results in complicated logic and unstable systems.

What I would like to do is for FMOD itself to wait until there is input data, by overriding the pcm read callback (FMOD\_CREATESOUNDEXINFO.pcmreadcallback).  
I expected it to be doing this but the callback is only called once on load and never afterwards, the sound will loop.

Is there a way for me to move the device capturing code into FMOD callbacks in a way that will make the read cursor wait for the written data to be available ?

What am I missing?  
Thanks in advance.

---

<div class="post-metadata">

**Author:** ![nick1](https://avatars.discourse-cdn.com/v4/letter/n/47e85d/32.png) [@nick1](https://qa.fmod.com/u/nick1)\
**Post date:** [May 30, 2016, 1:33am UTC](https://qa.fmod.com/t/fmod-openuser-read-callback-only-called-once/12509/2 "2016-05-30T01:33:27Z")

</div>

What you want to achieve is shown by the infinite stream option in the user\_created\_sound example.

---

<div class="post-metadata">

**Author:** ![Kryofenix](https://avatars.discourse-cdn.com/v4/letter/k/a9adbd/32.png) [@Kryofenix](https://qa.fmod.com/u/Kryofenix)\
**Post date:** [May 30, 2016, 6:40pm UTC](https://qa.fmod.com/t/fmod-openuser-read-callback-only-called-once/12509/3 "2016-05-30T18:40:57Z")

</div>

Very interesting, I feed bad for missing this, but I will try this out.

Thanks!
