Phase 24: add mix buses, coherent peak meters and master clipping indicators
This commit is contained in:
parent
ba5c2503a7
commit
2fd7724065
32 changed files with 632 additions and 61 deletions
|
|
@ -25,7 +25,9 @@ typedef struct {
|
|||
} voice;
|
||||
|
||||
struct xtc_midi_plan {
|
||||
size_t fade_frames, controller_frames;
|
||||
size_t fade_frames, controller_frames, monitor_stride;
|
||||
float *monitor;
|
||||
uint64_t monitor_position;
|
||||
xtc_gain_ramp volume[16], pan[16];
|
||||
unsigned int sustain[16];
|
||||
xtc_mix_snapshot mix;
|
||||
|
|
@ -334,6 +336,8 @@ static void segment(xtc_midi_plan *p, uint64_t position, float *out, float *righ
|
|||
if (distance < p->fade_frames)
|
||||
sample *= (float)distance / (float)p->fade_frames;
|
||||
}
|
||||
if (p->monitor) xtc_mix_monitor(&p->mix, p->monitor, p->monitor_stride, s->track, position+j,
|
||||
(size_t)(position-p->monitor_position)+j, sample, right != NULL);
|
||||
out[j] += sample * xtc_mix_level(&p->mix, s->track, position + j, right ? 0U : 2U);
|
||||
if (right)
|
||||
right[j] += sample * xtc_mix_level(&p->mix, s->track, position + j, 1);
|
||||
|
|
@ -393,6 +397,7 @@ xtc_result xtc_midi_plan_render_stereo(xtc_midi_plan *p, uint64_t position, cons
|
|||
(e->type == XTC_MIDI_NOTE_ON && !e->velocity))
|
||||
return XTC_ERR_INVALID_ARGUMENT;
|
||||
}
|
||||
p->monitor_position = position;
|
||||
if (!frames)
|
||||
return XTC_OK;
|
||||
if (p->next_position != position)
|
||||
|
|
@ -431,3 +436,6 @@ xtc_result xtc_midi_plan_render(xtc_midi_plan *p, uint64_t position, const xtc_m
|
|||
{
|
||||
return xtc_midi_plan_render_stereo(p, position, events, count, out, NULL, frames);
|
||||
}
|
||||
|
||||
void xtc_midi_plan_monitor(xtc_midi_plan *p, float *samples, size_t stride)
|
||||
{ if (p) { p->monitor = samples; p->monitor_stride = stride; } }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue