RustAudio / cpal

Cross-platform audio I/O library in pure Rust
Apache License 2.0
2.62k stars 348 forks source link

Add `stream.now()` method for allowing the user to produce `StreamInstant`s #408

Open mitchmindtree opened 4 years ago

mitchmindtree commented 4 years ago

As of #397 the callback now emits timestamps associated with:

  1. The moment the callback is called and
  2. The moment audio is delivered/received to/from the device.

As mentioned in #363, it would be very useful to allow the user to retrieve timestamps from the same source of time as used by the stream to produce these timestamps. That work did not make it into #397, so I've opened this as a reminder to address this step.

FeldrinH commented 1 year ago

Is there any news on this? This would be very useful for synchronizing audio playback with other things (video playback, stage lighting etc).

AustinHellerRepo commented 3 months ago

I am also very curious about this extremely useful feature. Is there an agreed upon solution that just needs a PR written up and submitted? I've seen conversations about adding a now function to the Stream object that returns the Instant that the last Stream::play call was made (less useful for my purposes) or adding a now function to the StreamInstant that returns the Instant instance (exactly what I need). I'm going to dig into the second idea and see what it would take to implement it. Thoughts?