# Callback for FMOD\_CHANNELCONTROL\_CALLBACK\_SYNCPOINT (LInux)\[Ubuntu x86 64bit\]

**URL:** <https://qa.fmod.com/t/callback-for-fmod-channelcontrol-callback-syncpoint-linux-ubuntu-x86-64bit/13723>\
**Category:** FMOD Engine\
**Created:** [February 24, 2018, 9:31pm UTC](https://qa.fmod.com/t/callback-for-fmod-channelcontrol-callback-syncpoint-linux-ubuntu-x86-64bit/13723 "2018-02-24T21:31:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![pkolesnik](https://avatars.discourse-cdn.com/v4/letter/p/858c86/32.png) [@pkolesnik](https://qa.fmod.com/u/pkolesnik)\
**Post date:** [February 24, 2018, 9:31pm UTC](https://qa.fmod.com/t/callback-for-fmod-channelcontrol-callback-syncpoint-linux-ubuntu-x86-64bit/13723/1 "2018-02-24T21:31:52Z")

</div>

Hello,

I am playing a .wav sound with embedded markers that were created in SoundForge, and I would like to receive a callback for every time the marker is encountered.

I set up a callback for FMOD\_CHANNELCONTROL\_CALLBACK\_SYNCPOINT (please see the code below). The callback gets triggered, however I am having two issues with it:

1. I would like to retrieve the index of the marker. I am attempting to do so by casting void \*commanddata1 to int (as suggested in the API reference - please see my code below), however I get a crash when attempting to print out the index int value.

2.From the point the callback gets triggered for the first time, it seems to be triggered continuously every frame - I was expecting it would be only triggered once when every marker is encountered?

Thank you for your help.

* * *

```
FMOD_RESULT F_CALLBACK AudioEngine::SoundPlayingCallback(FMOD_CHANNELCONTROL *chanControl, FMOD_CHANNELCONTROL_TYPE controlType, FMOD_CHANNELCONTROL_CALLBACK_TYPE callbackType, void *commanddata1, void *commanddata2)
{
    //attempt to get the index of the marker
    int cindex = *((int *)commandData1);
    
    if (controlType == FMOD_CHANNELCONTROL_CHANNEL)
    {
        FMOD::Channel *channel = (FMOD::Channel *)chanControl;
        // Channel specific functions here...
        switch (callbackType)
        {
            case FMOD_CHANNELCONTROL_CALLBACK_SYNCPOINT:
                //printing out the cindex causes the crash
                cout << "channel playing syncpoint callback, index: " << cindex << endl;
                break;
            case FMOD_CHANNELCONTROL_CALLBACK_END:
                cout << "channel playing end callback" << endl;
                break;
        }
    }
    else
    {
        FMOD::ChannelGroup *group = (FMOD::ChannelGroup *)chanControl;
        // ChannelGroup specific functions here...
    }

    // ChannelControl generic functions here...
}
```

---

<div class="post-metadata">

**Author:** ![brett](https://yyz2.discourse-cdn.com/flex036/user_avatar/qa.fmod.com/brett/32/261_2.png) [@brett](https://qa.fmod.com/u/brett)\
**Post date:** [March 2, 2018, 1:47am UTC](https://qa.fmod.com/t/callback-for-fmod-channelcontrol-callback-syncpoint-linux-ubuntu-x86-64bit/13723/2 "2018-03-02T01:47:57Z")

</div>

It should trigger once if it contains 1 sync point. I’d have to see the wav file probably to determine what is going on there.

The commandData1 doc says ‘cast to int’. You cast it to ‘int \*’ and dereferenced it, you’re probably dereferencing null or 0x1 or something like that.

regards,
