SunVox DLL: add function to inject audio into "Input" modules.

Post Reply
User avatar
queries
Posts: 316
Joined: Tue May 10, 2016 9:51 pm

SunVox DLL: add function to inject audio into "Input" modules.

Post by queries »

This is a proposal to add a function to the SunVox DLL to feed audio data to specific "Input" modules.

The function prototype might look like this:

Code: Select all

int sv_audio_input( int slot, int mod_num, void* buf, int frames ) SUNVOX_FN_ATTR;
Ideas for behavior:
  • After a buffer is set, the next sv_audio_callback would cause that Input module to read from the beginning of that buffer as it produces its output.
  • If an Input module reaches the end of a buffer, it will produce no output.
  • It is therefore up to the caller to manage the synchronization of buffer sizes and timing.
  • It might be useful somehow during realtime playback if there a way to register a callback, but the intent is for this to be useful only when SV_INIT_FLAG_USER_AUDIO_CALLBACK is set during initialization.
One use case I'm thinking of is a SunVox-specific DJ/performance mixing system, where there there are 4+ processes each managing their own SunVox DLL instance. 2+ of them would be playing back SunVox files into small buffers. The contents of those buffers would be piped into corresponding "Input" modules of two other processes (one for master, one for headphones), using a project set up for channel EQ, filtering, mixdown, etc. (The UI would then take MIDI messages from a DJ controller and map them to commands sent to each SunVox process)
maks
Posts: 43
Joined: Sat Mar 26, 2022 4:28 am

Re: SunVox DLL: add function to inject audio into "Input" modules.

Post by maks »

Sorry to dig up an old thread, but I'd like to implement a similar performance mixing system with Sunvox as well.
sv_audio_callback2() almost does what is needed here, but maybe we could have a sv_audio_callback3() where its possible to specify a slot as well?

@NightRadio I also wanted to ask about sv_update_input() as I'm not sure exactly what it does, could it be used switch between different input channels if your audio card has for example 4 inputs, not just 2?

The final piece to this puzzle I think would be being able to mix the level of the output from different slots - I think I saw someone else ask about this, but I think that's not possible at the moment?
User avatar
NightRadio
Site Admin
Posts: 3941
Joined: Fri Jan 23, 2004 12:28 am
Location: Ekaterinburg. Russia
Contact:

Re: SunVox DLL: add function to inject audio into "Input" modules.

Post by NightRadio »

maybe we could have a sv_audio_callback3() where its possible to specify a slot as well?
It is already implemented in Pixilang through the sv_render() function :) So maybe i will add this function to other versions of the library.

sv_update_input() as I'm not sure exactly what it does
sv_update_input() handle input ON/OFF requests to enable/disable input ports of the sound card (for example, after the Input module creation). Call it from the main thread only, where the SunVox sound stream is not locked.
If you use sv_audio_callback - just ignore this function.
If you don't use sv_audio_callback and there is the INPUT module in your project - call sv_update_input() somewhere after the project loading.

mix the level of the output from different slots
If you want to capture a signal from a specific slot - at the moment it is only possible in Pixilang (using the sv_render())
Post Reply