Add sample update function

This commit is contained in:
David Henningsson 2010-06-29 14:03:44 +00:00
parent d5cd9dee7e
commit ac8533c193
2 changed files with 10 additions and 3 deletions

View file

@ -94,6 +94,7 @@ fluid_rvoice_event_dispatch(fluid_rvoice_event_t* event)
EVENTFUNC_I1(fluid_rvoice_set_loopstart, fluid_rvoice_t*); EVENTFUNC_I1(fluid_rvoice_set_loopstart, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_loopend, fluid_rvoice_t*); EVENTFUNC_I1(fluid_rvoice_set_loopend, fluid_rvoice_t*);
EVENTFUNC_I1(fluid_rvoice_set_samplemode, fluid_rvoice_t*); EVENTFUNC_I1(fluid_rvoice_set_samplemode, fluid_rvoice_t*);
EVENTFUNC_PTR(fluid_rvoice_set_sample, fluid_rvoice_t*, fluid_sample_t*);
EVENTFUNC_R1(fluid_rvoice_handler_set_polyphony, fluid_rvoice_handler_t*); EVENTFUNC_R1(fluid_rvoice_handler_set_polyphony, fluid_rvoice_handler_t*);

View file

@ -49,6 +49,14 @@ fluid_voice_get_lower_boundary_for_attenuation(fluid_voice_t* voice);
proc, voice->rvoice, 0, 0.0f); \ proc, voice->rvoice, 0, 0.0f); \
} while (0) } while (0)
#define UPDATE_RVOICE_PTR(proc, obj) \
do { \
if (voice->can_access_rvoice) proc(voice->rvoice, obj); \
else fluid_rvoice_eventhandler_push_ptr(voice->channel->synth->eventhandler, \
proc, voice->rvoice, obj); \
} while (0)
#define UPDATE_RVOICE_GENERIC_R1(proc, obj, rarg) \ #define UPDATE_RVOICE_GENERIC_R1(proc, obj, rarg) \
do { \ do { \
if (voice->can_access_rvoice) proc(obj, rarg); \ if (voice->can_access_rvoice) proc(obj, rarg); \
@ -171,8 +179,6 @@ fluid_voice_init(fluid_voice_t* voice, fluid_sample_t* sample,
* of IIR filters, position in sample etc) is initialized. */ * of IIR filters, position in sample etc) is initialized. */
int i; int i;
fluid_return_val_if_fail(voice->can_access_rvoice, FLUID_FAILED);
voice->id = id; voice->id = id;
voice->chan = fluid_channel_get_num(channel); voice->chan = fluid_channel_get_num(channel);
voice->key = (unsigned char) key; voice->key = (unsigned char) key;
@ -184,7 +190,7 @@ fluid_voice_init(fluid_voice_t* voice, fluid_sample_t* sample,
voice->debug = 0; voice->debug = 0;
voice->has_noteoff = 0; voice->has_noteoff = 0;
UPDATE_RVOICE0(fluid_rvoice_reset); UPDATE_RVOICE0(fluid_rvoice_reset);
fluid_rvoice_set_sample(voice->rvoice, sample); UPDATE_RVOICE_PTR(fluid_rvoice_set_sample, voice->rvoice, sample);
i = fluid_channel_get_interp_method(channel); i = fluid_channel_get_interp_method(channel);
UPDATE_RVOICE_I1(fluid_rvoice_set_interp_method, i); UPDATE_RVOICE_I1(fluid_rvoice_set_interp_method, i);