# Playing back audio table programmer sounds on Unity Timeline at edit time (and runtime)

**URL:** https://qa.fmod.com/t/playing-back-audio-table-programmer-sounds-on-unity-timeline-at-edit-time-and-runtime/21720
**Category:** Unity
**Created:** [June 5, 2024, 9:25pm UTC](https://qa.fmod.com/t/playing-back-audio-table-programmer-sounds-on-unity-timeline-at-edit-time-and-runtime/21720 "2024-06-05T21:25:48Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![kkukshtel](https://avatars.discourse-cdn.com/v4/letter/k/f6c823/32.png) [@kkukshtel](https://qa.fmod.com/u/kkukshtel)
#### Post date: [June 12, 2024, 3:47pm UTC](https://qa.fmod.com/t/playing-back-audio-table-programmer-sounds-on-unity-timeline-at-edit-time-and-runtime/21720/3 "2024-06-12T15:47:09Z")

</div>

The playable code is just boilerplate, the issue stems from the callback and need to create sounds with the Runtime API (meaning, there is no ability to create sounds at edit time _without_ the runtime API).

Here’s the relevant block in the callback code (which is mostly just the example code) -

```auto
case FMOD.Studio.EVENT_CALLBACK_TYPE.CREATE_PROGRAMMER_SOUND:
{
    FMOD.MODE soundMode = FMOD.MODE.LOOP_NORMAL | FMOD.MODE.CREATECOMPRESSEDSAMPLE | FMOD.MODE.NONBLOCKING;
    var parameter = (FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES)Marshal.PtrToStructure(parameterPtr, typeof(FMOD.Studio.PROGRAMMER_SOUND_PROPERTIES));
    FMOD.Studio.SOUND_INFO dialogueSoundInfo;
    var keyResult = FMODUnity.RuntimeManager.StudioSystem.getSoundInfo(key, out dialogueSoundInfo);
    // FMODUnity.EditorUtils.System.getSoundInfo(key, out dialogueSoundInfo); edit mode - not supported
    if (keyResult != FMOD.RESULT.OK)
    {
        UnityEngine.Debug.LogError($"failed to load programmer sound {key} with error {keyResult}");
        break;
    }
    FMOD.Sound dialogueSound;
    var soundResult = FMODUnity.RuntimeManager.CoreSystem.createSound(dialogueSoundInfo.name_or_data, soundMode | dialogueSoundInfo.mode, ref dialogueSoundInfo.exinfo, out dialogueSound);
    if (soundResult != FMOD.RESULT.OK)
    {
        UnityEngine.Debug.LogError($"failed to create programmer sound {key} with error {soundResult}");
        break;
    }

    parameter.sound = dialogueSound.handle;
    parameter.subsoundIndex = dialogueSoundInfo.subsoundindex;
    Marshal.StructureToPtr(parameter, parameterPtr, false);
    break;
}

```

I looked around on the forums a lot and you’ve answered a similar issue before:

> [@Correct way of using RuntimeManager in editor](https://qa.fmod.com/t/correct-way-of-using-runtimemanager-in-editor/20611/2):
>
> While it is _technically_ possible to call into RuntimeManager to create a Studio System, it is only designed to be used at runtime. This is because RuntimeManager destroys the created System in OnDestroy(), which only happens when a scene or game ends. so you’ll leak the Studio System in the current editor instance when calling from outside of runtime. FMOD can support up to eight Systems at once - once you call into RuntimeManager eight times from the editor, FMOD will no longer be able to create a new system until you restart the editor.

As from the quoted post - is the way to do this to create a new system at edit time that the timeline uses?

What would be nice is if audiotable audio worked in the timeline by default, but given the complexity around _what_ that audio may be maybe it’s not possible?

Let me know whats best here.

---

_[View the full topic](https://qa.fmod.com/t/playing-back-audio-table-programmer-sounds-on-unity-timeline-at-edit-time-and-runtime/21720)._
