Reputation: 927
I can't find the correct syntax for passing a pointer array of type float *[] as a parameter to a function.
real * pp[] = { _osc[0].get_samples_ptr(), _osc[1].get_samples_ptr() };
_mod.iterate_sample_loop( samples, p_syn_ctx, pp );
is ok, but
_mod.iterate_sample_loop( samples, p_syn_ctx,
{ _osc[0].get_samples_ptr(),
_osc[1].get_samples_ptr() } );
where iterate_sample_loop is:
void mod::iterate_sample_loop( u32 samples,
synth_context * p_syn_ctx,
real * p_inputs[] ) ...
results "error: expected primary-expression before 'xxx' token".
Upvotes: 0
Views: 180
Reputation: 234354
You can't create an array temporary with { _osc[0].get_samples_ptr(), _osc[1].get_samples_ptr() }
. AFAIK the only way to create an array temporary is like this:
typedef int array_type[3];
void f(int the_array[]) {}
int main() {
f(array_type{1,3,4});
}
This only works in C++11, though. I think it's not possible at all in C++03.
Upvotes: 3