-
-
Notifications
You must be signed in to change notification settings - Fork 620
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
60 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,7 @@ | ||
import AVFAudio | ||
import Foundation | ||
|
||
class IOUnit<C: IOCaptureUnit> { | ||
let lockQueue = DispatchQueue(label: "com.haishinkit.HaishinKit.IOUnit.lock") | ||
weak var mixer: IOMixer? | ||
|
||
#if os(tvOS) | ||
private var _captures: [UInt8: Any] = [:] | ||
@available(tvOS 17.0, *) | ||
var captures: [UInt8: C] { | ||
return _captures as! [UInt8: C] | ||
} | ||
#elseif os(iOS) || os(macOS) || os(visionOS) | ||
var captures: [UInt8: C] = [:] | ||
#endif | ||
|
||
@available(tvOS 17.0, *) | ||
func capture(for track: UInt8) -> C? { | ||
#if os(tvOS) | ||
if _captures[track] == nil { | ||
_captures[track] = .init(track) | ||
} | ||
return _captures[track] as? C | ||
#else | ||
if captures[track] == nil { | ||
captures[track] = .init(track) | ||
} | ||
return captures[track] | ||
#endif | ||
} | ||
protocol IOUnit { | ||
var lockQueue: DispatchQueue { get } | ||
var mixer: IOMixer? { get } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters