void Voice_mix( Voice* voice, Device_states* states, uint32_t nframes, uint32_t offset, uint32_t freq, double tempo) { assert(voice != NULL); assert(voice->gen != NULL); assert(states != NULL); assert(freq > 0); if (voice->prio == VOICE_PRIO_INACTIVE) return; uint32_t mixed = offset; Generator_mix(voice->gen, states, voice->state, nframes, mixed, freq, tempo); if (!voice->state->active) Voice_reset(voice); else if (!voice->state->note_on) voice->prio = VOICE_PRIO_BG; return; }
void Voice_pool_reset(Voice_pool* pool) { assert(pool != NULL); for (uint16_t i = 0; i < pool->size; ++i) Voice_reset(pool->voices[i]); return; }