Store the minimum buffer size in BufferConfig
This commit is contained in:
parent
e1d4be2a03
commit
ee3b0bf8e6
4 changed files with 8 additions and 2 deletions
|
@ -294,8 +294,11 @@ pub struct BusConfig {
|
||||||
pub struct BufferConfig {
|
pub struct BufferConfig {
|
||||||
/// The current sample rate.
|
/// The current sample rate.
|
||||||
pub sample_rate: f32,
|
pub sample_rate: f32,
|
||||||
|
/// The minimum buffer size the host will use. This may not be set.
|
||||||
|
pub min_buffer_size: Option<u32>,
|
||||||
/// The maximum buffer size the host will use. The plugin should be able to accept variable
|
/// The maximum buffer size the host will use. The plugin should be able to accept variable
|
||||||
/// sized buffers up to this size.
|
/// sized buffers up to this size, or between the minimum and the maximum buffer size if both
|
||||||
|
/// are set.
|
||||||
pub max_buffer_size: u32,
|
pub max_buffer_size: u32,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1506,7 +1506,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
unsafe extern "C" fn activate(
|
unsafe extern "C" fn activate(
|
||||||
plugin: *const clap_plugin,
|
plugin: *const clap_plugin,
|
||||||
sample_rate: f64,
|
sample_rate: f64,
|
||||||
_min_frames_count: u32,
|
min_frames_count: u32,
|
||||||
max_frames_count: u32,
|
max_frames_count: u32,
|
||||||
) -> bool {
|
) -> bool {
|
||||||
check_null_ptr!(false, plugin);
|
check_null_ptr!(false, plugin);
|
||||||
|
@ -1515,6 +1515,7 @@ impl<P: ClapPlugin> Wrapper<P> {
|
||||||
let bus_config = wrapper.current_bus_config.load();
|
let bus_config = wrapper.current_bus_config.load();
|
||||||
let buffer_config = BufferConfig {
|
let buffer_config = BufferConfig {
|
||||||
sample_rate: sample_rate as f32,
|
sample_rate: sample_rate as f32,
|
||||||
|
min_buffer_size: Some(min_frames_count),
|
||||||
max_buffer_size: max_frames_count,
|
max_buffer_size: max_frames_count,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -200,6 +200,7 @@ impl<P: Plugin, B: Backend> Wrapper<P, B> {
|
||||||
},
|
},
|
||||||
buffer_config: BufferConfig {
|
buffer_config: BufferConfig {
|
||||||
sample_rate: config.sample_rate,
|
sample_rate: config.sample_rate,
|
||||||
|
min_buffer_size: None,
|
||||||
max_buffer_size: config.period_size,
|
max_buffer_size: config.period_size,
|
||||||
},
|
},
|
||||||
config,
|
config,
|
||||||
|
|
|
@ -690,6 +690,7 @@ impl<P: Vst3Plugin> IAudioProcessor for Wrapper<P> {
|
||||||
// This is needed when activating the plugin and when restoring state
|
// This is needed when activating the plugin and when restoring state
|
||||||
self.inner.current_buffer_config.store(Some(BufferConfig {
|
self.inner.current_buffer_config.store(Some(BufferConfig {
|
||||||
sample_rate: setup.sample_rate as f32,
|
sample_rate: setup.sample_rate as f32,
|
||||||
|
min_buffer_size: None,
|
||||||
max_buffer_size: setup.max_samples_per_block as u32,
|
max_buffer_size: setup.max_samples_per_block as u32,
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue