Skip to content

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

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/analysis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,8 @@ impl Analyser {
ring_buffer,
fft_size: DEFAULT_FFT_SIZE,
smoothing_time_constant: DEFAULT_SMOOTHING_TIME_CONSTANT,
min_decibels: DEFAULT_MIN_DECIBELS,
max_decibels: DEFAULT_MAX_DECIBELS,
min_decibels: f64::NEG_INFINITY,
max_decibels: f64::INFINITY,
fft_planner: Mutex::new(fft_planner),
fft_input,
fft_scratch,
Expand Down Expand Up @@ -636,16 +636,25 @@ mod tests {
#[should_panic]
fn test_min_decibels_constraints_lt_max_decibels() {
let mut analyser = Analyser::new();
analyser.set_max_decibels(DEFAULT_MAX_DECIBELS); // init value
analyser.set_min_decibels(DEFAULT_MAX_DECIBELS);
}

#[test]
#[should_panic]
fn test_max_decibels_constraints_lt_min_decibels() {
let mut analyser = Analyser::new();
analyser.set_min_decibels(DEFAULT_MIN_DECIBELS); // init value
analyser.set_max_decibels(DEFAULT_MIN_DECIBELS);
}

#[test]
fn test_min_max_decibels_init() {
let mut analyser = Analyser::new();
analyser.set_min_decibels(-10.);
analyser.set_max_decibels(20.);
}

#[test]
fn test_get_float_time_domain_data_vs_fft_size() {
// dst is bigger than fft_size
Expand Down
2 changes: 1 addition & 1 deletion src/node/audio_buffer_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ impl AudioBufferSourceNode {
assert_valid_time_value(duration);
assert!(
!self.source_started,
"InvalidStateError: Cannot call `start` twice"
"InvalidStateError - Cannot call `start` twice"
);

self.source_started = true;
Expand Down
6 changes: 3 additions & 3 deletions src/node/delay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,13 @@ impl AudioNode for DelayNode {
input: usize,
) -> &'a dyn AudioNode {
if self.context() != dest.context() {
panic!("InvalidAccessError: Attempting to connect nodes from different contexts");
panic!("InvalidAccessError - Attempting to connect nodes from different contexts");
}
if self.number_of_outputs() <= output {
panic!("IndexSizeError: output port {} is out of bounds", output);
panic!("IndexSizeError - output port {} is out of bounds", output);
}
if dest.number_of_inputs() <= input {
panic!("IndexSizeError: input port {} is out of bounds", input);
panic!("IndexSizeError - input port {} is out of bounds", input);
}

self.context().connect(
Expand Down
6 changes: 3 additions & 3 deletions src/node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,13 +268,13 @@ pub trait AudioNode {
input: usize,
) -> &'a dyn AudioNode {
if self.context() != dest.context() {
panic!("InvalidAccessError: Attempting to connect nodes from different contexts");
panic!("InvalidAccessError - Attempting to connect nodes from different contexts");
}
if self.number_of_outputs() <= output {
panic!("IndexSizeError: output port {} is out of bounds", output);
panic!("IndexSizeError - output port {} is out of bounds", output);
}
if dest.number_of_inputs() <= input {
panic!("IndexSizeError: input port {} is out of bounds", input);
panic!("IndexSizeError - input port {} is out of bounds", input);
}

self.context().connect(
Expand Down
Loading