vsariola / sointu

Fork of 4klang that can target 386, amd64 and WebAssembly. Tools run on Windows, Mac & Linux
MIT License
239 stars 15 forks source link

Expose unit tracks as SuSample * #127

Closed LeStahL closed 6 months ago

LeStahL commented 6 months ago

Synchronisation of music and visuals is a costly task; It currently requires the shader to contain the sequence and additional code to evaluate into "beat count, smooth beat count, beat envelope" values.

Would it be possible to expose envelopes tracks from Sointu to feed into the shader as texture for synchronization? I understand this requires additional memory and initialization code; so maybe this feature could be turned off by default and switched on per unit?

This would require a similiar infrastructure to what's required for #61 or #67, but for the exported assembly code.

vsariola commented 6 months ago

There's the SYNC opcode which allows sending any signals to sync data, and sointu does not define this symbol, so you can make this symbol available anywhere in the code e.g. block of memory that you send as a texture the shader. Check out Adam intro on how this was done.

Does this solve your issue?

LeStahL commented 6 months ago

This is exactly what I wanted to do; thanks! (This file gives info on how this works - this is in https://github.com/vsariola/adam/blob/main/intro/main.c#L1)