Skip to content

Allow selecting portaudio device by name. - #4732

Merged
toots merged 6 commits into
mainfrom
portaudio-name
Nov 12, 2025
Merged

toots merged 6 commits into
mainfrom
portaudio-name

Conversation

@smimram

@smimram smimram commented Nov 11, 2025

Copy link
Copy Markdown
Member

Fixes #4731.

@smimram
smimram marked this pull request as ready for review November 11, 2025 10:12
@smimram

smimram commented Nov 11, 2025

Copy link
Copy Markdown
Member Author

The only thing I am not sure of is how to properly raise the exception instead of the failwith which gives a badly formatted message.

Comment thread src/core/io/portaudio_io.ml Outdated
@toots

toots commented Nov 11, 2025

Copy link
Copy Markdown
Member

Looking great!

For the error I would raise a Lang.Invalid_value. It takes the name value (for position) so it's a bit annoying to carry but shouldn't be too hard.

In fact, I would pick the winner earlier on during argument parameters parsing and pass the corresponding value along with a polymorphic variant [Id of int | Name of string] so you can raise an Invalid_value on any error during open regardless of wether id or name was used.

@smimram

smimram commented Nov 12, 2025

Copy link
Copy Markdown
Member Author

I now raise Error.Invalid_value. This cannot be done during the parsing of arguments because we need portaudio to be initialized when computing the id from the name...

@toots toots left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good thank you!

@toots
toots enabled auto-merge November 12, 2025 14:38
@toots
toots added this pull request to the merge queue Nov 12, 2025
Merged via the queue into main with commit 41af60e Nov 12, 2025
52 checks passed
@toots
toots deleted the portaudio-name branch November 12, 2025 15:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support selecting PortAudio devices by name instead of numeric ID

2 participants