How can I define a custom audio output with many speakers?

Hi there,

I would like to programmatically map sounds sources to specific speakers depending on where they come from. I would like to have full control over how this is done and use many speakers (e.g. 64).
The end goal ist to use VBAP but I can’t figure out at what place I should implement this.

Is this possible with a custom Spatializer or do I build some kind of Submix?

Thank you very much!