Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions CalenTask/Services/SpeechCaptureService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Foundation
import Speech
import AVFoundation
import Observation
import os

/// Voice capture (S6/D66): dettatura on-device → testo nella cattura.
/// Italiano, offline quando il modello locale è disponibile.
Expand Down Expand Up @@ -74,7 +75,11 @@ final class SpeechCaptureService {
request = nil
isRecording = false
#if os(iOS)
try? AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
do {
try AVAudioSession.sharedInstance().setActive(false, options: .notifyOthersOnDeactivation)
} catch {
Log.app.error("Sessione audio: disattivazione fallita: \(error.localizedDescription, privacy: .public)")
}
#endif
}

Expand All @@ -87,8 +92,12 @@ final class SpeechCaptureService {

#if os(iOS)
let session = AVAudioSession.sharedInstance()
try? session.setCategory(.record, mode: .measurement, options: .duckOthers)
try? session.setActive(true, options: .notifyOthersOnDeactivation)
do {
try session.setCategory(.record, mode: .measurement, options: .duckOthers)
try session.setActive(true, options: .notifyOthersOnDeactivation)
} catch {
Log.app.error("Sessione audio: attivazione fallita: \(error.localizedDescription, privacy: .public)")
}
#endif

let request = SFSpeechAudioBufferRecognitionRequest()
Expand Down
Loading