Skip to content

Commit

Permalink
works
Browse files Browse the repository at this point in the history
  • Loading branch information
baconpaul committed Jun 19, 2022
1 parent 47d7c0a commit da28cf1
Showing 1 changed file with 29 additions and 21 deletions.
50 changes: 29 additions & 21 deletions src/claudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,7 @@ struct ClaudioWrapper : public clap::helpers::Plugin<clap::helpers::Misbehaviour
clap_process_status process(const clap_process *process) noexcept override
{
auto fc = process->frames_count;
auto ip = process->audio_inputs->data32;
auto op = process->audio_outputs->data32;
float *ip[2], *op[2];
auto smp = 0U;

auto ev = process->in_events;
Expand All @@ -108,33 +107,42 @@ struct ClaudioWrapper : public clap::helpers::Plugin<clap::helpers::Misbehaviour
nextEvent = ev->get(ev, nextEventIndex);
}

while (nextEvent && nextEvent->time < smp + fc)
uint32_t basechunk = 32;
while (smp < fc)
{
if (nextEvent->space_id == CLAP_CORE_EVENT_SPACE_ID)
uint32_t chunk = std::min(basechunk, fc-smp);
ip[0] = &process->audio_inputs->data32[0][smp];
ip[1] = &process->audio_inputs->data32[1][smp];
op[0] = &process->audio_outputs->data32[0][smp];
op[1] = &process->audio_outputs->data32[1][smp];
while (nextEvent && nextEvent->time < smp + chunk)
{
switch(nextEvent->type)
if (nextEvent->space_id == CLAP_CORE_EVENT_SPACE_ID)
{
case CLAP_EVENT_PARAM_VALUE:
{
auto pevt = reinterpret_cast<const clap_event_param_value *>(nextEvent);
underlyer->setParameter(pevt->param_id - paramOff, pevt->value);
break;
}
default:
break;
switch (nextEvent->type)
{
case CLAP_EVENT_PARAM_VALUE:
{
auto pevt = reinterpret_cast<const clap_event_param_value *>(nextEvent);
underlyer->setParameter(pevt->param_id - paramOff, pevt->value);
break;
}
default:
break;
}
}

nextEventIndex++;
if (nextEventIndex >= sz)
nextEvent = nullptr;
else
nextEvent = ev->get(ev, nextEventIndex);
}

nextEventIndex++;
if (nextEventIndex >= sz)
nextEvent = nullptr;
else
nextEvent = ev->get(ev, nextEventIndex);
underlyer->processReplacing(ip, op, chunk);
smp += chunk;
}

underlyer->processReplacing(ip, op, process->frames_count);


assert (!nextEvent);
return CLAP_PROCESS_CONTINUE;
}
Expand Down

0 comments on commit da28cf1

Please sign in to comment.