mirror of
https://github.com/robbert-vdh/nih-plug.git
synced 2026-07-01 02:36:54 +00:00
Add a getter for parameter units from poitners
This commit is contained in:
@@ -185,6 +185,19 @@ impl ParamPtr {
|
||||
}
|
||||
}
|
||||
|
||||
/// Get the unit label for this parameter.
|
||||
///
|
||||
/// # Safety
|
||||
///
|
||||
/// Calling this function is only safe as long as the object this `ParamPtr` was created for is
|
||||
/// still alive.
|
||||
pub unsafe fn unit(&self) -> &'static str {
|
||||
match &self {
|
||||
ParamPtr::FloatParam(p) => (**p).unit,
|
||||
ParamPtr::IntParam(p) => (**p).unit,
|
||||
}
|
||||
}
|
||||
|
||||
/// Set this parameter based on a string. Returns whether the updating succeeded. That can fail
|
||||
/// if the string cannot be parsed.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user