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

Darwin fixes #390

Merged
merged 2 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
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
4 changes: 4 additions & 0 deletions record_darwin/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 1.1.3
* fix: Exception where format.sampleRate != hwFormat.sampleRate
* feat(macOS): Support device by deviceID as well as deviceUID

## 1.1.2
* fix: Remove print on conversion error.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class RecorderStreamDelegate: NSObject, AudioRecordingStreamDelegate {
}
#endif

let srcFormat = audioEngine.inputNode.outputFormat(forBus: 0)
let srcFormat = audioEngine.inputNode.inputFormat(forBus: 0)

let dstFormat = AVAudioFormat(
commonFormat: .pcmFormatInt16,
Expand Down
5 changes: 5 additions & 0 deletions record_darwin/macos/Classes/RecorderMacOS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,11 @@ func getAudioDeviceIDFromUID(uid: String) -> AudioDeviceID? {

// Get device UID
for deviceID in deviceIDs {
// Support lookup by devicezID rather than uid
if String(deviceID) == uid {
return deviceID
}

propertyAddress.mSelector = kAudioDevicePropertyDeviceUID
propertySize = UInt32(MemoryLayout<CFString>.size)
var deviceUID: Unmanaged<CFString>?
Expand Down