-
Notifications
You must be signed in to change notification settings - Fork 19
Fix AudioParam behaviour #424
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the changes.
I will probably pick this PR apart in the separate issues
- analyser panics, to be continued in fix: unwanted panic at Analiser initialization #422
- validation of audio param numerical values
- the issue of automation_rate_synchronicity (needs work)
} | ||
|
||
/// Update the current value of the automation rate of the AudioParam | ||
/// | ||
/// # Panics | ||
/// | ||
/// Some nodes have automation rate constraints and may panic when updating the value. | ||
pub fn set_automation_rate(&self, value: AutomationRate) { | ||
pub fn set_automation_rate(&mut self, value: AutomationRate) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think marking these methods as &mut self
will work in practise, because they are return as immutable refs from the AudioNodes:
pub fn gain(&self) -> &AudioParam
This could of course be changed to pub fn gain(&mut self) -> &mut AudioParam
but that is a rather big change where we should assess pros and cons.
@@ -272,9 +274,11 @@ pub(crate) struct AudioParamRaw { | |||
default_value: f32, // immutable | |||
min_value: f32, // immutable | |||
max_value: f32, // immutable | |||
automation_rate: AutomationRate, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Including the non-Arc field here breaks the Clone
implementation (which we need for the node bindings).
Calling set_automation_rate on a cloned AudioParam will not update the automation rate of the original AudioParam
Hum right, I didn't think about these points indeed (and sorry I indeed forked from the previous PR branch rather than from main) For the automation rate problem, maybe the more straightforward solution is then just to update it through I let you cherry pick the changes, feel free to close the PR when needed |
Hey, some new stuff regarding AudioParam
AudioParam
argument parsingset_value
andset_automation_rate
)~~set_value
setter