Skip to content

Instantly share code, notes, and snippets.

@silenciocorner
Created April 8, 2021 13:24
Show Gist options
  • Select an option

  • Save silenciocorner/4c55b68a59059c9846e4f6498c9db2c4 to your computer and use it in GitHub Desktop.

Select an option

Save silenciocorner/4c55b68a59059c9846e4f6498c9db2c4 to your computer and use it in GitHub Desktop.
BeatmapEventCallbacks from MusicManager.cs script from Colin Vandervort article "FMOD Unity: Beat-Mapping"
public class MusicManager : MonoBehaviour
{
...
private void Awake()
{
...
}
private void Start()
{
timelineInfo = new TimelineInfo();
beatCallback = new FMOD.Studio.EVENT_CALLBACK(BeatEventCallback);
timelineHandle = GCHandle.Alloc(timelineInfo, GCHandleType.Pinned);
musicPlayEvent.setUserData(GCHandle.ToIntPtr(timelineHandle));
musicPlayEvent.setCallback(beatCallback, FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_BEAT | FMOD.Studio.EVENT_CALLBACK_TYPE.TIMELINE_MARKER);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment