Skip to content

Commit

Permalink
Merge pull request #9 from veedstudio/blaze/thread-safety
Browse files Browse the repository at this point in the history
Sync updates
  • Loading branch information
aure authored Oct 15, 2024
2 parents bacd3ef + 202b5a9 commit 357de19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion Sources/Waveform/Renderer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class Renderer: NSObject, MTKViewDelegate {
commandBuffer.commit()
}

func set(samples: SampleBuffer, start: Int, length: Int) async {
func set(samples: SampleBuffer, start: Int, length: Int) {
self.start = start
self.length = length
if samples === self.samples {
Expand Down
14 changes: 2 additions & 12 deletions Sources/Waveform/Waveform.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,7 @@ public struct Waveform: NSViewRepresentable {
public func updateNSView(_ nsView: NSViewType, context: Context) {
let renderer = context.coordinator.renderer
renderer.constants = constants
Task {
await renderer.set(samples: samples,
start: start,
length: length)
nsView.setNeedsDisplay(nsView.bounds)
}
renderer.set(samples: samples, start: start, length: length)
nsView.setNeedsDisplay(nsView.bounds)
}
}
Expand Down Expand Up @@ -121,12 +116,7 @@ public struct Waveform: UIViewRepresentable {
public func updateUIView(_ uiView: UIViewType, context: Context) {
let renderer = context.coordinator.renderer
renderer.constants = constants
Task {
await renderer.set(samples: samples,
start: start,
length: length)
uiView.setNeedsDisplay()
}
renderer.set(samples: samples, start: start, length: length)
uiView.setNeedsDisplay()
}
}
Expand Down

0 comments on commit 357de19

Please sign in to comment.