Skip to content
This repository has been archived by the owner on Aug 19, 2019. It is now read-only.

SoundStream API Reform Draft #37

Open
mitchmindtree opened this issue Apr 23, 2015 · 0 comments
Open

SoundStream API Reform Draft #37

mitchmindtree opened this issue Apr 23, 2015 · 0 comments

Comments

@mitchmindtree
Copy link
Member

Currently SoundStream currently offers very limited options for setup - It constructs a duplex, ordered stream with no options to choose any devices other than the defaults. Here I'm going to try and list all of the options we'd like to expose to the user that are currently unexposed:

Pre-SoundStream construction

  • Retrieve a list of available hosts along with their IDs.
  • Retrieve a list of available devices along with their IDs.
  • Default host.
  • Default device.

For these, we should be able to provide simple functions:

let hosts = sound_stream::available_hosts();
let devices = sound_stream::available_devices();

Where each is an iterator over structs containing ID and info about each host/device.

SoundStream construction

  • Blocking / Non-blocking.
  • Duplex / Input-only / Output-only.
  • If Duplex, unique input and output parameters.
  • pa::StreamFlags.

Here is what I imagine constructing a custom duplex, non-blocking stream would look like:

let stream = SoundStream::new()
    .input(Some(input_device_id), Params { ... })
    .output(Some(output_device_id), Params { ... })
    .flags(flags)
    .callback(|args| { ... });

Duplex / Input / Output could be determined by whether both input and output, only input or only output methods have been called respectively. If neither method is called, the default output device will be constructed with two channels (unless there is a max of 1, in which case 1 channel), f32 sample format and default latency.

Blocking / Non-Blocking could be determined by whether .callback is given as the last method or .blocking. .callback could return a handle to the stream (with methods for checking whether or not it's still running, stopping/starting the stream, etc).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant