# Help with using sync points to trigger Callbacks

**URL:** <https://qa.fmod.com/t/help-with-using-sync-points-to-trigger-callbacks/16420>\
**Category:** FMOD Engine\
**Tags:** cpp\
**Created:** [November 10, 2020, 7:29pm UTC](https://qa.fmod.com/t/help-with-using-sync-points-to-trigger-callbacks/16420 "2020-11-10T19:29:51Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![KayDemonLP](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/kaydemonlp/32/1688_2.png) [@KayDemonLP](https://qa.fmod.com/u/KayDemonLP)\
**Post date:** [November 10, 2020, 7:29pm UTC](https://qa.fmod.com/t/help-with-using-sync-points-to-trigger-callbacks/16420/1 "2020-11-10T19:29:51Z")

</div>

I’ve been searching for documentation or examples all around but could not find any unfortunately, so I’m asking here.  
The sound plays fine, and the callback is triggered upon the song ending, however the sync point i setup

> FMOD\_SYNCPOINT \*ptr;  
> pNewSound-\>pStartPtr-\>addSyncPoint(0, FMOD\_TIMEUNIT\_MS, “test”, &ptr);

is never triggered  
I tried several timings but to no avail.  
The sound is created via direct memory access

> result = pSystem-\>createStream((const char \*)pBufferIntro, FMOD\_OPENMEMORY | FMOD\_CREATESTREAM , &infoIntro, &pNewSound-\>pStartPtr);  
> pSystem-\>playSound(pNewSound-\>pStartPtr, pNewSound-\>pChannelGroupPtr, true, &pNewSound-pChannelPtr);

And the callback is set like this

> pNewSound-\>pChannelPtr-\>setCallback((FMOD\_CHANNELCONTROL\_CALLBACK)Test);

With the callback function itself being

> FMOD\_RESULT F\_CALLBACK Test(FMOD\_CHANNELCONTROL \*channelcontrol, FMOD\_CHANNELCONTROL\_TYPE controltype, FMOD\_CHANNELCONTROL\_CALLBACK\_TYPE callbacktype, void \*commanddata1, void \*commanddata2)  
> {  
> if ( callbacktype == FMOD\_CHANNELCONTROL\_CALLBACK\_SYNCPOINT )  
> DevMsg(“Syncpoint callback triggered\n”);  
> else  
> DevMsg(“Generic callback message: %d\n”, callbacktype);
> 
> return FMOD\_OK;  
> }

---

<div class="post-metadata">

**Author:** ![mathew](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/mathew/32/431_2.png) [@mathew](https://qa.fmod.com/u/mathew)\
**Post date:** [November 10, 2020, 9:43pm UTC](https://qa.fmod.com/t/help-with-using-sync-points-to-trigger-callbacks/16420/2 "2020-11-10T21:43:51Z")

</div>

I’ve just done a quick test in our play\_stream example and syncpoints appear to be working correctly using your provided code. The only suggestion I can think of is ensure all the functions are returning FMOD\_OK and ensure you are unpausing the Channel since you are playing it paused.

If neither of those helps, I suggest trying your code in our examples as a way to find what’s different about them.

---

<div class="post-metadata">

**Author:** ![KayDemonLP](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/kaydemonlp/32/1688_2.png) [@KayDemonLP](https://qa.fmod.com/u/KayDemonLP)\
**Post date:** [November 11, 2020, 12:33am UTC](https://qa.fmod.com/t/help-with-using-sync-points-to-trigger-callbacks/16420/3 "2020-11-11T00:33:08Z")

</div>

The problem ended up being that i used a different pointer for actually adding the sync point

> Sound \*pIntroSound = pNewSound-\>pBasePtr;  
> pIntroSound -\>addSyncPoint(0, FMOD\_TIMEUNIT\_MS, “test”, &ptr);

Directly using pNewSound-\>pStartPtr made it work, thanks
