Tightened the source code and README documentations in the library.
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
extension Sound {
|
||||
/// A source that produces audio by calling back into Swift.
|
||||
/// A source rendered by a Swift callback every audio cycle. Create with
|
||||
/// `Sound.addSource(stereo:_:)`; it stays alive until removed with `removeSource`.
|
||||
public final class CallbackSource: Source {
|
||||
let callback: Callback
|
||||
|
||||
/// Every callback source is kept alive here while the C side may
|
||||
/// still invoke its trampoline: from creation until it is removed
|
||||
/// with `Sound.removeSource`/`Channel.removeSource`, or until its
|
||||
/// owning channel is freed.
|
||||
/// Keeps sources alive for the C trampoline until removed (`Sound`/`Channel`
|
||||
/// `.removeSource`) or their channel is freed.
|
||||
nonisolated(unsafe) static var live: [CallbackSource] = []
|
||||
|
||||
/// Releases the registration added by `adopt(pointer:)`.
|
||||
/// Drops the reference added by `adopt(pointer:)`.
|
||||
static func release(_ source: Source) {
|
||||
live.removeAll { $0 === source }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user