Skip to content

Commit 6902607

Browse files
committed
MIDIKitSync: MTCReceiver & MTCDecoder: Updated inline docs (#232)
1 parent 37455af commit 6902607

File tree

2 files changed

+47
-6
lines changed

2 files changed

+47
-6
lines changed

Sources/MIDIKitSync/MTC/MTCReceiver/MTCDecoder.swift

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ public final class MTCDecoder: @unchecked Sendable { // @unchecked required for
9090
///
9191
/// Implement this closure for when you only want to display timecode and do not need to sync to
9292
/// MTC.
93+
///
94+
/// - Parameters:
95+
/// - timecode: Current display timecode.
96+
/// - event: The MTC event that triggered the callback.
97+
/// - direction: The current MTC playback or scrub direction.
98+
/// - isFrameChanged: Boolean indicating that there has been a change to the four main timecode
99+
/// components (`HH:MM:SS:FF`, ignoring subframes) since the last time this callback was called.
93100
nonisolated(unsafe) var timecodeChangedHandler: (@Sendable (
94101
_ timecode: Timecode,
95102
_ event: MTCMessageType,
@@ -102,6 +109,14 @@ public final class MTCDecoder: @unchecked Sendable { // @unchecked required for
102109
///
103110
/// Implement this closure for when you only want to display timecode and do not need to sync to
104111
/// MTC.
112+
///
113+
/// - Parameters:
114+
/// - handler: Closure containing the following parameters:
115+
/// - `timecode`: Current display timecode.
116+
/// - `event`: The MTC event that triggered the callback.
117+
/// - `direction`: The current MTC playback or scrub direction.
118+
/// - `isFrameChanged`: Boolean indicating that there has been a change to the four main timecode
119+
/// components (`HH:MM:SS:FF`, ignoring subframes) since the last time this callback was called.
105120
public func setTimecodeChangedHandler(
106121
_ handler: (@Sendable (
107122
_ timecode: Timecode,
@@ -170,6 +185,16 @@ public final class MTCDecoder: @unchecked Sendable { // @unchecked required for
170185

171186
// MARK: - init
172187

188+
/// Initialize a new MTC decoder object, optionally supplying initial local frame rate and
189+
/// callback handlers.
190+
///
191+
/// - Parameters:
192+
/// - initialLocalFrameRate: Initial local timecode frame rate (scaled from MTC timecode and
193+
/// frame rate)
194+
/// - timecodeChanged: Timecode changed callback handler. See ``setTimecodeChangedHandler(_:)``
195+
/// for more information.
196+
/// - mtcFrameRateChanged: Callback called when the incoming MTC stream changes its frame rate
197+
/// classification. See ``setMTCFrameRateChangedHandler(_:)`` for more information.
173198
public init(
174199
initialLocalFrameRate: TimecodeFrameRate? = nil,
175200
timecodeChanged: (@Sendable (

Sources/MIDIKitSync/MTC/MTCReceiver/MTCReceiver.swift

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ public final class MTCReceiver: @unchecked Sendable { // @unchecked required for
8888
/// >
8989
/// > This closure may be executed on a background thread. If the logic in the closure results in
9090
/// > user interface updates, ensure that they are performed on the main actor/thread.
91+
///
92+
/// - Parameters:
93+
/// - timecode: Current display timecode.
94+
/// - event: The MTC event that triggered the callback.
95+
/// - direction: The current MTC playback or scrub direction.
96+
/// - isFrameChanged: Boolean indicating that there has been a change to the four main timecode
97+
/// components (`HH:MM:SS:FF`, ignoring subframes) since the last time this callback was called.
9198
nonisolated(unsafe) var timecodeChangedHandler: (@Sendable (
9299
_ timecode: Timecode,
93100
_ event: MTCMessageType,
@@ -105,6 +112,14 @@ public final class MTCReceiver: @unchecked Sendable { // @unchecked required for
105112
/// >
106113
/// > This closure may be executed on a background thread. If the logic in the closure results in
107114
/// > user interface updates, ensure that they are performed on the main actor/thread.
115+
///
116+
/// - Parameters:
117+
/// - handler: Closure containing the following parameters:
118+
/// - `timecode`: Current display timecode.
119+
/// - `event`: The MTC event that triggered the callback.
120+
/// - `direction`: The current MTC playback or scrub direction.
121+
/// - `isFrameChanged`: Boolean indicating that there has been a change to the four main timecode
122+
/// components (`HH:MM:SS:FF`, ignoring subframes) since the last time this callback was called.
108123
public func setTimecodeChangedHandler(
109124
_ handler: (@Sendable (
110125
_ timecode: Timecode,
@@ -151,12 +166,13 @@ public final class MTCReceiver: @unchecked Sendable { // @unchecked required for
151166
/// > actor/thread.
152167
///
153168
/// - Parameters:
154-
/// - name: optionally supply a simple, unique alphanumeric name for the instance, used
155-
/// internally to identify the dispatch thread; random UUID will be used if `nil`
156-
/// - initialLocalFrameRate: set an initial local frame rate
157-
/// - syncPolicy: set the MTC sync policy
158-
/// - timecodeChanged: handle timecode change callbacks, pass `nil` if not needed
159-
/// - stateChanged: handle receiver state change callbacks, pass `nil` if not needed
169+
/// - name: Optionally supply a simple, unique alphanumeric name for the instance, used
170+
/// internally to identify the dispatch thread. A random UUID will be used if `nil`.
171+
/// - initialLocalFrameRate: Set an initial local frame rate.
172+
/// - syncPolicy: Set the MTC sync policy.
173+
/// - timecodeChanged: Timecode changed callback handler. See ``setTimecodeChangedHandler(_:)``
174+
/// for more information.
175+
/// - stateChanged: Receiver state change callback handler.
160176
public init(
161177
name: String? = nil,
162178
initialLocalFrameRate: TimecodeFrameRate? = nil,

0 commit comments

Comments
 (0)