@@ -50,7 +50,7 @@ struct PlaybackInfo {
50
50
}
51
51
52
52
// 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
54
54
// thread(s) and send a message to the render thread which stores the raw values.
55
55
// Values between control and render side might be desynchronised for little while
56
56
// but the developer experience will appear more logical, i.e.
@@ -61,15 +61,15 @@ struct PlaybackInfo {
61
61
// ```
62
62
// Note that this seems to be the strategy used by Firefox
63
63
#[ derive( Debug ) ]
64
- struct LoopParameters {
64
+ struct LoopControl {
65
65
loop_ : AtomicBool ,
66
66
loop_start : AtomicF64 ,
67
67
loop_end : AtomicF64 ,
68
68
}
69
69
70
70
// Uses the canonical ordering for handover of values,
71
71
// i.e. `Acquire` on load and `Release` on store.
72
- impl LoopParameters {
72
+ impl LoopControl {
73
73
fn loop_ ( & self ) -> bool {
74
74
self . loop_ . load ( Ordering :: Acquire )
75
75
}
@@ -139,7 +139,7 @@ enum ControlMessage {
139
139
///
140
140
pub struct AudioBufferSourceNode {
141
141
registration : AudioContextRegistration ,
142
- loop_parameters : Arc < LoopParameters > ,
142
+ loop_control : Arc < LoopControl > ,
143
143
channel_config : ChannelConfig ,
144
144
detune : AudioParam , // has constraints, no a-rate
145
145
playback_rate : AudioParam , // has constraints, no a-rate
@@ -226,7 +226,7 @@ impl AudioBufferSourceNode {
226
226
pr_param. set_automation_rate_constrained ( true ) ;
227
227
pr_param. set_value ( playback_rate) ;
228
228
229
- let loop_parameters = Arc :: new ( LoopParameters {
229
+ let loop_control = Arc :: new ( LoopControl {
230
230
loop_ : AtomicBool :: new ( loop_) ,
231
231
loop_start : AtomicF64 :: new ( loop_start) ,
232
232
loop_end : AtomicF64 :: new ( loop_end) ,
@@ -249,7 +249,7 @@ impl AudioBufferSourceNode {
249
249
250
250
let node = Self {
251
251
registration,
252
- loop_parameters ,
252
+ loop_control ,
253
253
channel_config : ChannelConfig :: default ( ) ,
254
254
detune : d_param,
255
255
playback_rate : pr_param,
@@ -329,32 +329,32 @@ impl AudioBufferSourceNode {
329
329
330
330
/// Defines if the playback the [`AudioBuffer`] should be looped
331
331
pub fn loop_ ( & self ) -> bool {
332
- self . loop_parameters . loop_ ( )
332
+ self . loop_control . loop_ ( )
333
333
}
334
334
335
335
pub fn set_loop ( & self , value : bool ) {
336
- self . loop_parameters . set_loop ( value) ;
336
+ self . loop_control . set_loop ( value) ;
337
337
self . registration . post_message ( ControlMessage :: Loop ( value) ) ;
338
338
}
339
339
340
340
/// Defines the loop start point, in the time reference of the [`AudioBuffer`]
341
341
pub fn loop_start ( & self ) -> f64 {
342
- self . loop_parameters . loop_start ( )
342
+ self . loop_control . loop_start ( )
343
343
}
344
344
345
345
pub fn set_loop_start ( & self , value : f64 ) {
346
- self . loop_parameters . set_loop_start ( value) ;
346
+ self . loop_control . set_loop_start ( value) ;
347
347
self . registration
348
348
. post_message ( ControlMessage :: LoopStart ( value) ) ;
349
349
}
350
350
351
351
/// Defines the loop end point, in the time reference of the [`AudioBuffer`]
352
352
pub fn loop_end ( & self ) -> f64 {
353
- self . loop_parameters . loop_end ( )
353
+ self . loop_control . loop_end ( )
354
354
}
355
355
356
356
pub fn set_loop_end ( & self , value : f64 ) {
357
- self . loop_parameters . set_loop_end ( value) ;
357
+ self . loop_control . set_loop_end ( value) ;
358
358
self . registration
359
359
. post_message ( ControlMessage :: LoopEnd ( value) ) ;
360
360
}
0 commit comments