mirror of
https://github.com/robbert-vdh/yabridge.git
synced 2026-05-09 20:29:10 +02:00
Make the maximum block size in VST2 optional
This commit is contained in:
@@ -747,19 +747,19 @@ AudioShmBuffer::Config Vst2Bridge::setup_shared_audio_buffers() {
|
|||||||
// audio channel are in samples (since they'll be used with pointer
|
// audio channel are in samples (since they'll be used with pointer
|
||||||
// arithmetic in `AudioShmBuffer`), and we'll only use the first bus (since
|
// arithmetic in `AudioShmBuffer`), and we'll only use the first bus (since
|
||||||
// VST2 plugins don't have multiple audio busses).
|
// VST2 plugins don't have multiple audio busses).
|
||||||
assert(max_samples_per_block != 0);
|
assert(max_samples_per_block);
|
||||||
uint32_t current_offset = 0;
|
uint32_t current_offset = 0;
|
||||||
|
|
||||||
std::vector<uint32_t> input_channel_offsets(plugin->numInputs);
|
std::vector<uint32_t> input_channel_offsets(plugin->numInputs);
|
||||||
for (int channel = 0; channel < plugin->numInputs; channel++) {
|
for (int channel = 0; channel < plugin->numInputs; channel++) {
|
||||||
input_channel_offsets[channel] = current_offset;
|
input_channel_offsets[channel] = current_offset;
|
||||||
current_offset += max_samples_per_block;
|
current_offset += *max_samples_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<uint32_t> output_channel_offsets(plugin->numOutputs);
|
std::vector<uint32_t> output_channel_offsets(plugin->numOutputs);
|
||||||
for (int channel = 0; channel < plugin->numOutputs; channel++) {
|
for (int channel = 0; channel < plugin->numOutputs; channel++) {
|
||||||
output_channel_offsets[channel] = current_offset;
|
output_channel_offsets[channel] = current_offset;
|
||||||
current_offset += max_samples_per_block;
|
current_offset += *max_samples_per_block;
|
||||||
}
|
}
|
||||||
|
|
||||||
// The size of the buffer is in bytes, and it will depend on whether the
|
// The size of the buffer is in bytes, and it will depend on whether the
|
||||||
|
|||||||
@@ -146,8 +146,12 @@ class Vst2Bridge : public HostBridge {
|
|||||||
* `processReplacing()`/`processDoubleReplacing()`/`process()`. This is
|
* `processReplacing()`/`processDoubleReplacing()`/`process()`. This is
|
||||||
* indicated using a call to `effSetBlockSize()` prior to
|
* indicated using a call to `effSetBlockSize()` prior to
|
||||||
* `effMainsChanged()`.
|
* `effMainsChanged()`.
|
||||||
|
*
|
||||||
|
* Some hosts forget to call this, so it will be a nullopt until it is
|
||||||
|
* called. In that case we'll use the value obtained through
|
||||||
|
* `audioMasterGetBlockSize()` instead.
|
||||||
*/
|
*/
|
||||||
uint32_t max_samples_per_block = 0;
|
std::optional<uint32_t> max_samples_per_block;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Whether the host is going to send double precision audio or not. This
|
* Whether the host is going to send double precision audio or not. This
|
||||||
|
|||||||
Reference in New Issue
Block a user