Extracted the error types in the Recording package target into the Errors folder.
This commit is contained in:
@@ -0,0 +1,9 @@
|
|||||||
|
/// The errors thrown by ``AudioCapturing``.
|
||||||
|
public enum AudioCapturingError: Error {
|
||||||
|
/// The recorder failed to start or resume the audio capture.
|
||||||
|
case captureNotStarted
|
||||||
|
/// No recording is in progress.
|
||||||
|
case noOngoingRecording
|
||||||
|
/// The user denied the app permission to record audio from the microphone.
|
||||||
|
case permissionNotGranted
|
||||||
|
}
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
/// The errors thrown by ``AudioTranscribing``.
|
||||||
|
public enum AudioTranscribingError: Error {
|
||||||
|
/// The speech model assets for the locale failed to reserve, download, or install.
|
||||||
|
case assetsNotInstalled
|
||||||
|
/// The transcriber supports no equivalent of the locale the transcription was requested with.
|
||||||
|
case localeNotSupported
|
||||||
|
}
|
||||||
@@ -172,18 +172,6 @@ private extension AudioCapturing {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// MARK: - Errors
|
|
||||||
|
|
||||||
/// The errors thrown by ``AudioCapturing``.
|
|
||||||
public enum AudioCapturingError: Error {
|
|
||||||
/// The recorder failed to start or resume the audio capture.
|
|
||||||
case captureNotStarted
|
|
||||||
/// No recording is in progress.
|
|
||||||
case noOngoingRecording
|
|
||||||
/// The user denied the app permission to record audio from the microphone.
|
|
||||||
case permissionNotGranted
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Constants
|
// MARK: - Constants
|
||||||
|
|
||||||
/// The constant values used across the audio recording service.
|
/// The constant values used across the audio recording service.
|
||||||
|
|||||||
@@ -57,9 +57,10 @@ public struct AudioTranscribing: Transcribing {
|
|||||||
|
|
||||||
let analyzer = SpeechAnalyzer(modules: [transcriber])
|
let analyzer = SpeechAnalyzer(modules: [transcriber])
|
||||||
|
|
||||||
async let text = transcriber.results.reduce(into: "") { text, result in
|
async let text = transcriber.results
|
||||||
text += String(result.text.characters)
|
.reduce(into: "") { text, result in
|
||||||
}
|
text += String(result.text.characters)
|
||||||
|
}
|
||||||
|
|
||||||
let file = try AVAudioFile(forReading: audio)
|
let file = try AVAudioFile(forReading: audio)
|
||||||
|
|
||||||
@@ -74,16 +75,6 @@ public struct AudioTranscribing: Transcribing {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// MARK: - Errors
|
|
||||||
|
|
||||||
/// The errors thrown by ``AudioTranscribing``.
|
|
||||||
public enum AudioTranscribingError: Error {
|
|
||||||
/// The speech model assets for the locale failed to reserve, download, or install.
|
|
||||||
case assetsNotInstalled
|
|
||||||
/// The transcriber supports no equivalent of the locale the transcription was requested with.
|
|
||||||
case localeNotSupported
|
|
||||||
}
|
|
||||||
|
|
||||||
// MARK: - Constants
|
// MARK: - Constants
|
||||||
|
|
||||||
/// The logger that records the failures of the audio transcribing service.
|
/// The logger that records the failures of the audio transcribing service.
|
||||||
|
|||||||
Reference in New Issue
Block a user