Skip to content

Pause semanticsΒ #284

@ishitatsuyuki

Description

@ishitatsuyuki

Each platform has its own way of abstracting pauses, and cpal currently only expose a simple API (which probably has inconsistent behavior wrt following description).

Many driver seems to implement hardware level pauses, which IIUC can stop processing even in the middle of the buffer. When paused though there are two choices regarding the remaining buffer: flush (drain) until they're fully played, drop them completely (resetting the stream), or just keep them until the stream is resumed.

Interaction with OS mixers, though, is unknown as in theory hardware pause won't be used if another application is playing audio.

  • On Windows, only Start and Stop is exposed, with a Reset function that clears playback position, achieving the "drop" behavior above.
  • ALSA exposes a variety of APIs, but portability of those are unknown. The exposed API covers all of the behavior listed above.
  • Android (AAudio) has a rather strange API that distinguish between a "pause" operation (output stream only) and a "stop" operation. Neither of them closes (destroys) the stream. The paused state has an additional option of getting flushed.

How should we expose these behaviors? Or if we decide to not do so, which behavior should we consistently achieve on every platform?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions