Skip to content

Commit

Permalink
add version field to PluginInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
micahrj committed Oct 26, 2023
1 parent 10f30c2 commit 369e969
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/gain/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ impl Plugin for Gain {
fn info() -> PluginInfo {
PluginInfo {
name: "Gain".to_string(),
version: "0.1.0".to_string(),
vendor: "Vendor".to_string(),
url: "https://example.com".to_string(),
email: "[email protected]".to_string(),
Expand Down
4 changes: 3 additions & 1 deletion src/format/clap/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ impl<P: Plugin + ClapPlugin> Factory<P> {
let name = CString::new(&*info.name).unwrap().into_raw();
let vendor = CString::new(&*info.vendor).unwrap().into_raw();
let url = CString::new(&*info.url).unwrap().into_raw();
let version = CString::new(&*info.version).unwrap().into_raw();

const EMPTY: &'static CStr = unsafe { CStr::from_bytes_with_nul_unchecked(b"\0") };
const FEATURES: &'static [*const c_char] = &[ptr::null()];
Expand All @@ -60,7 +61,7 @@ impl<P: Plugin + ClapPlugin> Factory<P> {
url,
manual_url: EMPTY.as_ptr(),
support_url: EMPTY.as_ptr(),
version: EMPTY.as_ptr(),
version,
description: EMPTY.as_ptr(),
features: FEATURES.as_ptr(),
},
Expand All @@ -76,6 +77,7 @@ impl<P: Plugin + ClapPlugin> Factory<P> {
drop(CString::from_raw(state.descriptor.name as *mut c_char));
drop(CString::from_raw(state.descriptor.vendor as *mut c_char));
drop(CString::from_raw(state.descriptor.url as *mut c_char));
drop(CString::from_raw(state.descriptor.version as *mut c_char));
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/format/vst3/factory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl<P: Plugin> IPluginFactory2Trait for Factory<P> {
info.classFlags = 0;
copy_cstring("Fx", &mut info.subCategories);
copy_cstring(&self.info.vendor, &mut info.vendor);
copy_cstring("", &mut info.version);
copy_cstring(&self.info.version, &mut info.version);
let version_str = CStr::from_ptr(SDKVersionString).to_str().unwrap();
copy_cstring(version_str, &mut info.sdkVersion);

Expand All @@ -119,7 +119,7 @@ impl<P: Plugin> IPluginFactory3Trait for Factory<P> {
info.classFlags = 0;
copy_cstring("Fx", &mut info.subCategories);
copy_wstring(&self.info.vendor, &mut info.vendor);
copy_wstring("", &mut info.version);
copy_wstring(&self.info.version, &mut info.version);
let version_str = CStr::from_ptr(SDKVersionString).to_str().unwrap();
copy_wstring(version_str, &mut info.sdkVersion);

Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ pub type ParamValue = f64;

pub struct PluginInfo {
pub name: String,
pub version: String,
pub vendor: String,
pub url: String,
pub email: String,
Expand Down

0 comments on commit 369e969

Please sign in to comment.