Skip to main content

PluginBase

Trait PluginBase 

Source
pub trait PluginBase {
    // Provided methods
    fn on_load(&mut self) -> Result<()> { ... }
    fn get_info(&self) -> PluginInfo { ... }
    fn on_parameter(&mut self, id: i32) -> Result<()> { ... }
    fn on_get_parameter_string(&self, id: i32) -> Result<String> { ... }
}
Expand description

Base plugin trait that all plugin types implement

Provided Methods§

Source

fn on_load(&mut self) -> Result<()>

Called when the plugin is loaded

Examples found in repository?
examples/simple_dsp.rs (line 89)
84fn main() {
85    println!("VirtualDJ Rust SDK - Simple Gain Plugin Example");
86    println!("This example demonstrates a basic DSP plugin structure.");
87    
88    let mut plugin = GainPlugin::new();
89    if let Ok(()) = plugin.on_load() {
90        println!("✓ Plugin loaded successfully");
91    }
92    
93    let info = plugin.get_info();
94    println!("\nPlugin Information:");
95    println!("  Name: {}", info.name);
96    println!("  Author: {}", info.author);
97    println!("  Description: {}", info.description);
98    println!("  Version: {}", info.version);
99    
100    println!("\nTo use this plugin in a real project:");
101    println!("1. Implement DspPlugin trait methods for your audio processing");
102    println!("2. Compile with: cargo build --release");
103    println!("3. Deploy the resulting DLL to VirtualDJ's plugin directory");
104}
Source

fn get_info(&self) -> PluginInfo

Get plugin information

Examples found in repository?
examples/simple_dsp.rs (line 93)
84fn main() {
85    println!("VirtualDJ Rust SDK - Simple Gain Plugin Example");
86    println!("This example demonstrates a basic DSP plugin structure.");
87    
88    let mut plugin = GainPlugin::new();
89    if let Ok(()) = plugin.on_load() {
90        println!("✓ Plugin loaded successfully");
91    }
92    
93    let info = plugin.get_info();
94    println!("\nPlugin Information:");
95    println!("  Name: {}", info.name);
96    println!("  Author: {}", info.author);
97    println!("  Description: {}", info.description);
98    println!("  Version: {}", info.version);
99    
100    println!("\nTo use this plugin in a real project:");
101    println!("1. Implement DspPlugin trait methods for your audio processing");
102    println!("2. Compile with: cargo build --release");
103    println!("3. Deploy the resulting DLL to VirtualDJ's plugin directory");
104}
More examples
Hide additional examples
examples/query_vdj_state.rs (line 113)
87fn main() {
88    println!("VirtualDJ State Query Example");
89    println!("=============================\n");
90    println!("This example demonstrates how to use PluginContext to query VirtualDJ state.");
91    println!("In a real plugin, you would use this pattern in your plugin callbacks.\n");
92    
93    println!("Example usage patterns:\n");
94    
95    println!("1. Query track information:");
96    println!("   let title = context.get_info_string(\"deck 1 get_title\")?;");
97    println!("   let position = context.get_info_double(\"deck 1 get_position\")?;\n");
98    
99    println!("2. Query cue information:");
100    println!("   let has_cue = context.get_info_string(\"deck 1 has_cue 1\")?;");
101    println!("   let cue_pos = context.get_info_double(\"deck 1 cue_pos 1\")?;\n");
102    
103    println!("3. Send commands:");
104    println!("   context.send_command(\"deck 1 play\")?;");
105    println!("   context.send_command(\"mixer master volume 50\")?;\n");
106    
107    println!("Note: This example is a reference. To use PluginContext:");
108    println!("- You need a valid VirtualDJ plugin pointer");
109    println!("- You need access to the VdjCallbacks struct");
110    println!("- Typically this is done within your plugin's on_load() or other callbacks\n");
111    
112    let plugin = StateQueryPlugin::new();
113    let info = plugin.get_info();
114    println!("Plugin: {} v{}", info.name, info.version);
115}
Source

fn on_parameter(&mut self, id: i32) -> Result<()>

Called when a parameter is changed

Source

fn on_get_parameter_string(&self, id: i32) -> Result<String>

Get string representation of a parameter

Implementors§