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
// Free to use | |
// Written by Alexis Bridoux - https://github.com/ABridoux | |
import AppKit | |
#if canImport(SwiftUI) | |
import SwiftUI | |
#endif | |
// MARK: Model |
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
// Free to use | |
// Written by Alexis Bridoux - https://github.com/ABridoux | |
/// Observes a notification and executes the provided block upon reception | |
/// | |
/// Unregister the stored observer upon deinitialization | |
final class NotificationObserver { | |
var name: Notification.Name | |
var observer: NSObjectProtocol |
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
// Free to use | |
// Written by Alexis Bridoux - https://github.com/ABridoux | |
import AppKit | |
import Foundation | |
/// Service to shut down, restart, or put the computer to sleep. Also log out the user. | |
/// | |
/// ### Resources | |
/// - [Apple doc](https://developer.apple.com/library/archive/qa/qa1134/_index.html) |
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
struct ReducedReplayAsyncStream<Element> { | |
typealias Reduce = (_ partialResult: inout Element, _ nextResult: Element) -> Void | |
private let storage: _Storage | |
private var originalStream: AsyncStream<Element> | |
init( | |
bufferingPolicy limit: AsyncStream<Element>.Continuation.BufferingPolicy = .unbounded, | |
initialResult: Element, |
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
import AVFoundation | |
// MARK: - MatrixMixerNodeWrapper | |
/// Wrapper around an audio unit node of type `kAudioUnitSubType_MatrixMixer` for convenience. | |
public final class MatrixMixerNodeWrapper { | |
// MARK: Properties | |
/// Matrix mixer to map input channels |
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
// MARK: - Queue | |
struct Queue<Element> { | |
private var enqueueArray: [Element] = [] | |
private var dequeueArray: [Element] = [] | |
var isEmpty: Bool { | |
enqueueArray.isEmpty && dequeueArray.isEmpty | |
} | |
} |
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
// MARK: - Check error | |
extension OSStatus { | |
/// Error mapped from an `OSStatus`. | |
public struct StatusError: Error { | |
// MARK: Properties | |
let status: OSStatus |