feat(mac,ios,playback,store): initial macos implementation
This commit is contained in:
1 parent
e5bb559d7f
commit
d2d7166cf0
72 files changed
+4452
-318
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import Domain
|
||||
import Foundation
|
||||
|
||||
public struct OutputDeviceInfo: Hashable, Sendable {
|
||||
public var id: UInt32
|
||||
public var name: String
|
||||
public var nominalRate: Double
|
||||
public var availableRates: [Double]
|
||||
|
||||
public init(id: UInt32, name: String, nominalRate: Double, availableRates: [Double]) {
|
||||
self.id = id
|
||||
self.name = name
|
||||
self.nominalRate = nominalRate
|
||||
self.availableRates = availableRates
|
||||
}
|
||||
}
|
||||
|
||||
public struct SampleRateMatcher: Sendable {
|
||||
public var isEnabled: Bool
|
||||
|
||||
public init(isEnabled: Bool) {
|
||||
self.isEnabled = isEnabled
|
||||
}
|
||||
|
||||
public func targetRate(for format: AudioFormat?, on device: OutputDeviceInfo?) -> Double? {
|
||||
guard isEnabled, let device, let rate = format?.sampleRate.map(Double.init) else { return nil }
|
||||
guard rate != device.nominalRate, device.availableRates.contains(rate) else { return nil }
|
||||
return rate
|
||||
}
|
||||
}
|
||||
|
||||
public protocol PlaybackTuning: Sendable {
|
||||
func setMatchesSampleRate(_ isOn: Bool) async
|
||||
}
|
||||
Reference in new issue
Block a user