Starting to learn Juce in order to build plugins and am interested in whether it would feasible to include the Sunvox dll with a plugin. I am just learning and am trying to figure out if I am on the right track with what I'm picturing. Should these scenarios be possible?
1 - Host a sunvox file via the dll in a Juce app. Receive midi from a gui built with juce, note and cc control. Juce app receives the audio from the dll somehow, which outputs (a buffer?) Juce can work with.
2 - Same thing but set up an effects processing chain. So I guess pass a buffer through the dll and receive the processed buffer?
In my naive fantasy world I imagine that I can load the dll, initialize it in my Juce app with sv_open_slot( 0 ), and have access to the full dll api within my Juce code. I know its probably not going to be that simple, I'm just wondering should it be possible. Any feedback appreciated!
Thanks
Sunvox and Juce
- NightRadio
- Site Admin
- Posts: 3955
- Joined: Fri Jan 23, 2004 12:28 am
- Location: Ekaterinburg. Russia
- Contact:
Re: Sunvox and Juce
Hi!
It is definitely possible :)
App start:
App end:
Simplified view of the audio callback (I don't know what it actually looks like in Juce, but probably something similar):
It is definitely possible :)
App start:
Code: Select all
sv_load_dll();
sv_init( 0, sample_rate, 2, SV_INIT_FLAG_OFFLINE );
sv_open_slot( 0 );
//make some connections or load a project file
sv_update_input();
//now start some audio stream (outside the SunVox)
Code: Select all
sv_close_slot( 0 );
sv_deinit();
sv_unload_sll();
Code: Select all
void audio_callback( int channels, int number_of_frames, float* in[ channels ], float* out[ channels ] )
{
float temp_buf1[ number_of_frames * channels ];
float temp_buf2[ number_of_frames * channels ];
sv_audio_callback2( temp_buf1, number_of_frames, 0, sv_get_ticks(), 1, channels, temp_buf2 );
for( int c = 0; c < channels; c++ )
{
for( int i = 0; i < number_of_frames; i++ )
{
out[ c ][ i ] = temp_buf1[ i * channels + c ];
in[ c ][ i ] = temp_buf2[ i * channels + c ];
}
}
}
Re: Sunvox and Juce
Amazing, thank you Alex!!
Much appreciated
Much appreciated