Skip to content

Commit

Permalink
fix stop not working in Swift
Browse files Browse the repository at this point in the history
  • Loading branch information
landtanin committed Dec 24, 2023
1 parent c838ddb commit 66aafbb
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions examples/whisper.objc/whisper.objc/SwiftViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,6 @@ class SwiftViewController: UIViewController, TrancribeVC {

var audioQueue: AudioQueueRef?
var audioBuffers: [AudioQueueBufferRef?] = Array(repeating: nil, count: NUM_BUFFERS)
var isCapturing = false
var isTranscribing = false
var isRealtime = false
// TODO: Memory should be managed smartly using malloc and free
Expand Down Expand Up @@ -243,7 +242,7 @@ class SwiftViewController: UIViewController, TrancribeVC {
}

@objc func toggleCapture(_ sender: UIButton) {
guard !isCapturing else {
guard !stateInp.isCapturing else {
stopCapturing()
return
}
Expand Down Expand Up @@ -302,6 +301,10 @@ class SwiftViewController: UIViewController, TrancribeVC {
}
AudioQueueDispose(queue, true)
stateInp.queue = nil

print("Stop capturing done")
} else {
print("Stop capturing failed")
}
}

Expand Down

0 comments on commit 66aafbb

Please sign in to comment.