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

Fix handling of integer input formats on macOS #891

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/host/coreaudio/mod.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
extern crate coreaudio;

use self::coreaudio::sys::{
kAudioFormatFlagIsFloat, kAudioFormatFlagIsPacked, kAudioFormatLinearPCM,
AudioStreamBasicDescription, OSStatus,
kAudioFormatFlagIsFloat, kAudioFormatFlagIsPacked, kAudioFormatFlagIsSignedInteger,
kAudioFormatLinearPCM, AudioStreamBasicDescription, OSStatus,
};

use crate::DefaultStreamConfigError;
Expand Down Expand Up @@ -52,7 +52,10 @@ fn asbd_from_config(
let frames_per_packet = 1;
let bytes_per_packet = frames_per_packet * bytes_per_frame;
let format_flags = match sample_format {
SampleFormat::F32 => kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked,
SampleFormat::F32 | SampleFormat::F64 => kAudioFormatFlagIsFloat | kAudioFormatFlagIsPacked,
SampleFormat::I16 | SampleFormat::I32 | SampleFormat::I64 => {
kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked
}
_ => kAudioFormatFlagIsPacked,
};
AudioStreamBasicDescription {
Expand Down