Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit f0b7fd3

Browse files
frabertaskeksa
andauthored
Document and add update_display to Host (#126)
Co-authored-by: Aske Simon Christensen <[email protected]>
1 parent d608f3e commit f0b7fd3

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

src/host.rs

+10-1
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ pub enum OpCode {
147147
/// Get the current directory.
148148
/// [return]: `FSSpec` on OS X, `char*` otherwise
149149
GetDirectory,
150-
/// No arguments. TODO: Figure out what this does.
150+
/// Tell the host that the plugin's parameters have changed, refresh the UI.
151+
///
152+
/// No arguments.
151153
UpdateDisplay,
152154
/// Tell the host that if needed, it should record automation data for a control.
153155
///
@@ -222,6 +224,13 @@ pub trait Host {
222224
fn get_block_size(&self) -> isize {
223225
0
224226
}
227+
228+
/// Refresh UI after the plugin's parameters changed.
229+
///
230+
/// Note: some hosts will call some `PluginParameters` methods from within the `update_display`
231+
/// call, including `get_parameter`, `get_parameter_label`, `get_parameter_name`
232+
/// and `get_parameter_text`.
233+
fn update_display(&self) {}
225234
}
226235

227236
/// All possible errors that can occur when loading a VST plugin.

src/plugin.rs

+5
Original file line numberDiff line numberDiff line change
@@ -965,6 +965,11 @@ impl Host for HostCallback {
965965
fn get_block_size(&self) -> isize {
966966
self.callback(self.effect, host::OpCode::GetBlockSize, 0, 0, ptr::null_mut(), 0.0)
967967
}
968+
969+
/// Refresh UI after the plugin's parameters changed.
970+
fn update_display(&self) {
971+
self.callback(self.effect, host::OpCode::UpdateDisplay, 0, 0, ptr::null_mut(), 0.0);
972+
}
968973
}
969974

970975
#[cfg(test)]

0 commit comments

Comments
 (0)