Skip to content

Commit 2eead6f

Browse files
committed
Rename suspend_at methods to suspend, as the argument is required
1 parent d4b2dd9 commit 2eead6f

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/context/offline.rs

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ impl OfflineAudioContext {
114114
/// This function will block the current thread and returns the rendered `AudioBuffer`
115115
/// synchronously.
116116
///
117-
/// This method will only adhere to scheduled suspensions via [`Self::suspend_at_sync`] and
118-
/// will ignore those provided via [`Self::suspend_at`].
117+
/// This method will only adhere to scheduled suspensions via [`Self::suspend_sync`] and
118+
/// will ignore those provided via [`Self::suspend`].
119119
///
120120
/// # Panics
121121
///
@@ -139,8 +139,8 @@ impl OfflineAudioContext {
139139
/// Rendering is purely CPU bound and contains no `await` points, so calling this method will
140140
/// block the executor until completion or until the context is suspended.
141141
///
142-
/// This method will only adhere to scheduled suspensions via [`Self::suspend_at`] and will
143-
/// ignore those provided via [`Self::suspend_at_sync`].
142+
/// This method will only adhere to scheduled suspensions via [`Self::suspend`] and will
143+
/// ignore those provided via [`Self::suspend_sync`].
144144
///
145145
/// # Panics
146146
///
@@ -200,7 +200,7 @@ impl OfflineAudioContext {
200200
/// let context = Arc::new(OfflineAudioContext::new(1, 512, 44_100.));
201201
/// let context_clone = Arc::clone(&context);
202202
///
203-
/// let suspend_promise = context.suspend_at(128. / 44_100.).then(|_| async move {
203+
/// let suspend_promise = context.suspend(128. / 44_100.).then(|_| async move {
204204
/// let mut src = context_clone.create_constant_source();
205205
/// src.connect(&context_clone.destination());
206206
/// src.start();
@@ -213,7 +213,7 @@ impl OfflineAudioContext {
213213
/// assert_eq!(buffer.number_of_channels(), 1);
214214
/// assert_eq!(buffer.length(), 512);
215215
/// ```
216-
pub async fn suspend_at(&self, suspend_time: f64) {
216+
pub async fn suspend(&self, suspend_time: f64) {
217217
let quantum = (suspend_time * self.base.sample_rate() as f64 / RENDER_QUANTUM_SIZE as f64)
218218
.ceil() as usize;
219219

@@ -240,7 +240,7 @@ impl OfflineAudioContext {
240240
/// Schedules a suspension of the time progression in the audio context at the specified time
241241
/// and runs a callback.
242242
///
243-
/// This is a synchronous version of [`Self::suspend_at`] that runs the provided callback at
243+
/// This is a synchronous version of [`Self::suspend`] that runs the provided callback at
244244
/// the `suspendTime`. The rendering resumes automatically after the callback has run, so there
245245
/// is no `resume_sync` method.
246246
///
@@ -264,7 +264,7 @@ impl OfflineAudioContext {
264264
///
265265
/// let mut context = OfflineAudioContext::new(1, 512, 44_100.);
266266
///
267-
/// context.suspend_at_sync(128. / 44_100., |context| {
267+
/// context.suspend_sync(128. / 44_100., |context| {
268268
/// let mut src = context.create_constant_source();
269269
/// src.connect(&context.destination());
270270
/// src.start();
@@ -274,7 +274,7 @@ impl OfflineAudioContext {
274274
/// assert_eq!(buffer.number_of_channels(), 1);
275275
/// assert_eq!(buffer.length(), 512);
276276
/// ```
277-
pub fn suspend_at_sync<F: FnOnce(&mut Self) + Send + Sync + 'static>(
277+
pub fn suspend_sync<F: FnOnce(&mut Self) + Send + Sync + 'static>(
278278
&mut self,
279279
suspend_time: f64,
280280
callback: F,
@@ -340,13 +340,13 @@ mod tests {
340340

341341
let mut context = OfflineAudioContext::new(1, len, sample_rate as f32);
342342

343-
context.suspend_at_sync(RENDER_QUANTUM_SIZE as f64 / sample_rate, |context| {
343+
context.suspend_sync(RENDER_QUANTUM_SIZE as f64 / sample_rate, |context| {
344344
let mut src = context.create_constant_source();
345345
src.connect(&context.destination());
346346
src.start();
347347
});
348348

349-
context.suspend_at_sync((3 * RENDER_QUANTUM_SIZE) as f64 / sample_rate, |context| {
349+
context.suspend_sync((3 * RENDER_QUANTUM_SIZE) as f64 / sample_rate, |context| {
350350
context.destination().disconnect();
351351
});
352352

@@ -378,7 +378,7 @@ mod tests {
378378
let context = Arc::new(OfflineAudioContext::new(1, 512, 44_100.));
379379
let context_clone = Arc::clone(&context);
380380

381-
let suspend_promise = context.suspend_at(128. / 44_100.).then(|_| async move {
381+
let suspend_promise = context.suspend(128. / 44_100.).then(|_| async move {
382382
let mut src = context_clone.create_constant_source();
383383
src.connect(&context_clone.destination());
384384
src.start();

0 commit comments

Comments
 (0)