Skip to content

Commit

Permalink
Updated example projects
Browse files Browse the repository at this point in the history
  • Loading branch information
orchetect committed Nov 14, 2024
1 parent 38731e2 commit f671a0d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,9 @@ extension Array where Element: FixedWidthInteger {
.map { _ in Element.random(in: Element.min ... Element.max) }
}
}

extension Comparable {
func clamped(to limits: ClosedRange<Self>) -> Self {
min(max(self, limits.lowerBound), limits.upperBound)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ struct MTCGenContentView: View {

// MARK: - MIDI state

@State var mtcGen: MTCGenerator = .init()
@State var mtcGen = MTCGenerator()

@AppStorage("mtcGen-localFrameRate")
var localFrameRate: TimecodeFrameRate = .fps24
Expand All @@ -28,7 +28,7 @@ struct MTCGenContentView: View {
// MARK: - UI state

@State var mtcGenState = false
@TimecodeState var generatorTC: Timecode = .init(.zero, at: .fps24)
@TimecodeState var generatorTC = Timecode(.zero, at: .fps24)

// MARK: - Internal State

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ struct MTCRecContentView: View {

// MARK: - MIDI state

@State var mtcRec: MTCReceiver = .init(name: "dummy - will be set in .onAppear{} below")
@State var mtcRec = MTCReceiver(name: "dummy - will be set in .onAppear{} below")

// MARK: - UI state

Expand Down Expand Up @@ -59,7 +59,7 @@ struct MTCRecContentView: View {
mtcRec = MTCReceiver(
name: "main",
initialLocalFrameRate: .fps24,
syncPolicy: .init(
syncPolicy: MTCReceiver.SyncPolicy(
lockFrames: 16,
dropOutFrames: 10
)
Expand Down Expand Up @@ -90,7 +90,7 @@ struct MTCRecContentView: View {
after: DispatchQueue.SchedulerTimeType(lockTime),
interval: .seconds(1),
tolerance: .zero,
options: .init(
options: DispatchQueue.SchedulerOptions(
qos: .userInitiated,
flags: [],
group: nil
Expand Down

0 comments on commit f671a0d

Please sign in to comment.