Skip to content

Add support for IAudioClient3::InitializeSharedAudioStream() #68

Closed

Description

@LastExceed

See RustAudio/cpal#1360 for the motivation

Activity

  1. HEnquist commented on Oct 4, 2026

    @HEnquist
    Owner

    Thanks for the suggestion. This looks like a reasonable addition and it doesn't conflict with anything in the crate, so I'm happy to have it. I will queue it for the next release, but I can't say when I will get to it.

    If you want to try it, a PR is welcome. It should follow the convention in the crate and add a new initialize method, like the application capture support has its own method, not a new StreamMode variant. The engine period functions work in frames while the rest of the API uses 100 ns units, so that needs some care. The new method also needs to set the same internal state that initialize_client sets, and it needs a check of which stream flags are allowed with this call. The device tests run on VB-Cable, which may not allow periods below the default, so a test might only be able to check that the returned values are consistent.

    About the device format mentioned in the cpal discussion. As far as I can tell from the docs, the format passed to this call must be one that the shared mode engine supports, so it does not work like exclusive mode where the device takes any format it supports. Asking the engine to switch format is done with StreamOption::MatchFormat via SetClientProperties, and that is already available in the crate. So I think the main new thing here is the shorter period. Do you know of anything more about the format behavior that we might have missed? If you have tested it, I would like to hear what you saw.

  2. LastExceed commented on Oct 4, 2026

    @LastExceed
    ContributorAuthor

    If you want to try it, a PR is welcome

    Yes, I plan to do this

    it does not work like exclusive mode where the device takes any format it supports

    Oops yeah now that I think about it, changing the engine format still means that all other existing streams need to be converted, so obviously the format needs to be supported by the converter 😅 nvm that part then

    Asking the engine to switch format is done with StreamOption::MatchFormat via SetClientProperties

    Oh interesting, I didn't know this yet

    I guess it is really just for the period size then

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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