Skip to content

Commit

Permalink
Merge pull request #390 from james-pellow/darwin-fixes
Browse files Browse the repository at this point in the history
Darwin fixes
  • Loading branch information
llfbandit authored Aug 27, 2024
2 parents aebeac5 + 04b478b commit 97f4032
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
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

0 comments on commit 97f4032

Please sign in to comment.