13
0

Plugins: Ignore offset for scratch/silent buffers

This allows to process buffers at an offset, as long
as the number of processed samples is less or equal to the
current buffersize.
This commit is contained in:
Robin Gareus 2024-04-06 01:58:26 +02:00
parent 2ca5f28910
commit f858316503
Signed by: rgareus
GPG Key ID: A090BCE02CF57F04
6 changed files with 12 additions and 12 deletions

View File

@ -1417,7 +1417,7 @@ AUPlugin::render_callback(AudioUnitRenderActionFlags*,
if (valid) {
ioData->mBuffers[i].mData = input_buffers->get_audio (idx).data (cb_offsets[bus] + input_offset);
} else {
ioData->mBuffers[i].mData = silent_bufs.get_audio(0).data (cb_offsets[bus] + input_offset);
ioData->mBuffers[i].mData = silent_bufs.get_audio(0).data (0);
}
}
cb_offsets[bus] += inNumberSamples;
@ -1536,7 +1536,7 @@ AUPlugin::connect_and_run (BufferSet& bufs,
if (valid) {
buffers->mBuffers[i].mData = bufs.get_audio (idx).data (offset);
} else {
buffers->mBuffers[i].mData = scratch_bufs.get_audio(0).data(offset);
buffers->mBuffers[i].mData = scratch_bufs.get_audio(0).data(0);
}
}
}

View File

@ -588,12 +588,12 @@ LadspaPlugin::connect_and_run (BufferSet& bufs,
const uint32_t buf_index = in_map.get(DataType::AUDIO, audio_in_index++, &valid);
connect_port(port_index,
valid ? bufs.get_audio(buf_index).data(offset)
: silent_bufs.get_audio(0).data(offset));
: silent_bufs.get_audio(0).data(0));
} else if (LADSPA_IS_PORT_OUTPUT(port_descriptor(port_index))) {
const uint32_t buf_index = out_map.get(DataType::AUDIO, audio_out_index++, &valid);
connect_port(port_index,
valid ? bufs.get_audio(buf_index).data(offset)
: scratch_bufs.get_audio(0).data(offset));
: scratch_bufs.get_audio(0).data(0));
}
}
}

View File

@ -813,7 +813,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
if (valid) {
in_map[ap + 1] = bufs.get_audio (buf_index).data (offset);
} else {
in_map[ap + 1] = silent_bufs.get_audio (0).data (offset);
in_map[ap + 1] = silent_bufs.get_audio (0).data (0);
}
}
for (uint32_t ap = 0; ap < audio_out; ++ap) {
@ -822,7 +822,7 @@ LuaProc::connect_and_run (BufferSet& bufs,
if (valid) {
out_map[ap + 1] = bufs.get_audio (buf_index).data (offset);
} else {
out_map[ap + 1] = scratch_bufs.get_audio (0).data (offset);
out_map[ap + 1] = scratch_bufs.get_audio (0).data (0);
}
}

View File

@ -2845,12 +2845,12 @@ LV2Plugin::connect_and_run(BufferSet& bufs,
index = in_map.get(DataType::AUDIO, audio_in_index++, &valid);
buf = (valid)
? bufs.get_audio(index).data(offset)
: silent_bufs.get_audio(0).data(offset);
: silent_bufs.get_audio(0).data(0);
} else {
index = out_map.get(DataType::AUDIO, audio_out_index++, &valid);
buf = (valid)
? bufs.get_audio(index).data(offset)
: scratch_bufs.get_audio(0).data(offset);
: scratch_bufs.get_audio(0).data(0);
}
} else if (flags & PORT_SEQUENCE) {
/* FIXME: The checks here for bufs.count().n_midi() > index shouldn't

View File

@ -790,7 +790,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs,
index = in_map.get (DataType::AUDIO, in_index++, &valid);
ins[i] = (valid)
? bufs.get_audio (index).data (offset)
: silent_bufs.get_audio (0).data (offset);
: silent_bufs.get_audio (0).data (0);
_connected_inputs[i] = valid;
}
@ -801,7 +801,7 @@ VST3Plugin::connect_and_run (BufferSet& bufs,
index = out_map.get (DataType::AUDIO, out_index++, &valid);
outs[i] = (valid)
? bufs.get_audio (index).data (offset)
: scratch_bufs.get_audio (0).data (offset);
: scratch_bufs.get_audio (0).data (0);
_connected_outputs[i] = valid;
}

View File

@ -724,7 +724,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
index = in_map.get(DataType::AUDIO, in_index++, &valid);
ins[i] = (valid)
? bufs.get_audio(index).data(offset)
: silent_bufs.get_audio(0).data(offset);
: silent_bufs.get_audio(0).data(0);
}
uint32_t out_index = 0;
@ -734,7 +734,7 @@ VSTPlugin::connect_and_run (BufferSet& bufs,
index = out_map.get(DataType::AUDIO, out_index++, &valid);
outs[i] = (valid)
? bufs.get_audio(index).data(offset)
: scratch_bufs.get_audio(0).data(offset);
: scratch_bufs.get_audio(0).data(0);
}
if (bufs.count().n_midi() > 0) {