Skip to content

Commit 46d8434

Browse files
committed
refactor: rename LoopParameters to LoopControl
1 parent 31af298 commit 46d8434

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/node/audio_buffer_source.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ struct PlaybackInfo {
5050
}
5151

5252
// The strategy for loop parameters is as follow: store the given values
53-
// in the `loop_parameters` thread safe instance which only lives in control
53+
// in the `loop_control` thread safe instance which only lives in control
5454
// thread(s) and send a message to the render thread which stores the raw values.
5555
// Values between control and render side might be desynchronised for little while
5656
// but the developer experience will appear more logical, i.e.
@@ -61,15 +61,15 @@ struct PlaybackInfo {
6161
// ```
6262
// Note that this seems to be the strategy used by Firefox
6363
#[derive(Debug)]
64-
struct LoopParameters {
64+
struct LoopControl {
6565
loop_: AtomicBool,
6666
loop_start: AtomicF64,
6767
loop_end: AtomicF64,
6868
}
6969

7070
// Uses the canonical ordering for handover of values,
7171
// i.e. `Acquire` on load and `Release` on store.
72-
impl LoopParameters {
72+
impl LoopControl {
7373
fn loop_(&self) -> bool {
7474
self.loop_.load(Ordering::Acquire)
7575
}
@@ -139,7 +139,7 @@ enum ControlMessage {
139139
///
140140
pub struct AudioBufferSourceNode {
141141
registration: AudioContextRegistration,
142-
loop_parameters: Arc<LoopParameters>,
142+
loop_control: Arc<LoopControl>,
143143
channel_config: ChannelConfig,
144144
detune: AudioParam, // has constraints, no a-rate
145145
playback_rate: AudioParam, // has constraints, no a-rate
@@ -226,7 +226,7 @@ impl AudioBufferSourceNode {
226226
pr_param.set_automation_rate_constrained(true);
227227
pr_param.set_value(playback_rate);
228228

229-
let loop_parameters = Arc::new(LoopParameters {
229+
let loop_control = Arc::new(LoopControl {
230230
loop_: AtomicBool::new(loop_),
231231
loop_start: AtomicF64::new(loop_start),
232232
loop_end: AtomicF64::new(loop_end),
@@ -249,7 +249,7 @@ impl AudioBufferSourceNode {
249249

250250
let node = Self {
251251
registration,
252-
loop_parameters,
252+
loop_control,
253253
channel_config: ChannelConfig::default(),
254254
detune: d_param,
255255
playback_rate: pr_param,
@@ -329,32 +329,32 @@ impl AudioBufferSourceNode {
329329

330330
/// Defines if the playback the [`AudioBuffer`] should be looped
331331
pub fn loop_(&self) -> bool {
332-
self.loop_parameters.loop_()
332+
self.loop_control.loop_()
333333
}
334334

335335
pub fn set_loop(&self, value: bool) {
336-
self.loop_parameters.set_loop(value);
336+
self.loop_control.set_loop(value);
337337
self.registration.post_message(ControlMessage::Loop(value));
338338
}
339339

340340
/// Defines the loop start point, in the time reference of the [`AudioBuffer`]
341341
pub fn loop_start(&self) -> f64 {
342-
self.loop_parameters.loop_start()
342+
self.loop_control.loop_start()
343343
}
344344

345345
pub fn set_loop_start(&self, value: f64) {
346-
self.loop_parameters.set_loop_start(value);
346+
self.loop_control.set_loop_start(value);
347347
self.registration
348348
.post_message(ControlMessage::LoopStart(value));
349349
}
350350

351351
/// Defines the loop end point, in the time reference of the [`AudioBuffer`]
352352
pub fn loop_end(&self) -> f64 {
353-
self.loop_parameters.loop_end()
353+
self.loop_control.loop_end()
354354
}
355355

356356
pub fn set_loop_end(&self, value: f64) {
357-
self.loop_parameters.set_loop_end(value);
357+
self.loop_control.set_loop_end(value);
358358
self.registration
359359
.post_message(ControlMessage::LoopEnd(value));
360360
}

0 commit comments

Comments
 (0)