Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Macbook Air, which only supports f32 sample type #1

Merged
merged 1 commit into from
Aug 25, 2023
Merged

Add support for Macbook Air, which only supports f32 sample type #1

merged 1 commit into from
Aug 25, 2023

Conversation

simon-frankau
Copy link
Contributor

cpal claims that Macbook Airs only support f32 sample type, so, uh, let's support it!

Prefer f32 on the grounds it's the app's native format, allows for better fidelity when shoveled through a mixer, etc.

I have no idea if you actually want to take PRs, but given I was hacking it up locally I might as well share it.

Nice little project!

}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

My editor believes in newlines at the end of files, and I just gave up fighting it. Sorry!

Copy link
Owner

Choose a reason for hiding this comment

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

Newlines for the newline gods. It's okay :)

move |data: &mut [i16], info: &cpal::OutputCallbackInfo| {
let mut audio_sink = audio_sink.lock().unwrap();
audio_sink.fill_sound_buffer(data, info);
let stream = match s.config.sample_format() {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Dunno if there's a prettier/cleaner way to do this...

Copy link
Owner

Choose a reason for hiding this comment

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

This isn't just good, it's good enough :).

@simon-frankau simon-frankau marked this pull request as ready for review April 18, 2023 16:49
@simon-frankau
Copy link
Contributor Author

(I should probably also mention that I've not tested this on hardware that supports i16 samples. Works for f32.)

@q3k
Copy link
Owner

q3k commented Aug 25, 2023

Sorry, I only noticed this PR now! I blame GitHub notifications.

Let me take a look.

}
Copy link
Owner

Choose a reason for hiding this comment

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

Newlines for the newline gods. It's okay :)

move |data: &mut [i16], info: &cpal::OutputCallbackInfo| {
let mut audio_sink = audio_sink.lock().unwrap();
audio_sink.fill_sound_buffer(data, info);
let stream = match s.config.sample_format() {
Copy link
Owner

Choose a reason for hiding this comment

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

This isn't just good, it's good enough :).

@q3k q3k merged commit 33a9266 into q3k:main Aug 25, 2023
@simon-frankau
Copy link
Contributor Author

Sorry, I only noticed this PR now! I blame GitHub notifications.

Likewise, only just noticed your response. :)

Cheers!

@simon-frankau simon-frankau deleted the apple-support branch September 10, 2023 16:17
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.

None yet

2 participants