Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
laves committed Aug 1, 2023
1 parent b96a832 commit eefc92c
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions demo/ios/CheetahDemo/CheetahDemo/ViewModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,10 @@ class ViewModel: ObservableObject {
accessKey: ACCESS_KEY,
modelPath: modelPath,
enableAutomaticPunctuation: true)

VoiceProcessor.instance.addFrameListener(VoiceProcessorFrameListener(audioCallback))
VoiceProcessor.instance.addErrorListener(VoiceProcessorErrorListener(errorCallback))

state = UIState.READY
} catch let error as CheetahInvalidArgumentError {
errorMessage = "\(error.localizedDescription)\nEnsure your AccessKey '\(ACCESS_KEY)' is valid."
Expand Down Expand Up @@ -85,8 +85,7 @@ class ViewModel: ObservableObject {
try VoiceProcessor.instance.stop()
state = UIState.FINALIZED
isListening = false
}
catch {
} catch {
errorMessage = "\(error.localizedDescription)"
}
}
Expand Down Expand Up @@ -129,7 +128,7 @@ class ViewModel: ObservableObject {
public func setAutoScroll(_ value: Bool) {
autoScroll = value
}

private func audioCallback(frame: [Int16]) {
guard let cheetah = self.cheetah else {
return
Expand All @@ -151,7 +150,7 @@ class ViewModel: ObservableObject {
}
}
}

private func errorCallback(error: VoiceProcessorError) {
DispatchQueue.main.async {
self.errorMessage = "\(error)"
Expand Down

0 comments on commit eefc92c

Please sign in to comment.