You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.8 KiB
59 lines
1.8 KiB
import Foundation
|
|
|
|
/// PTT / wake-word path. Mirrors `feature/voice/SpeechFeature.kt`.
|
|
///
|
|
/// **STUBBED on iOS.** The Android implementation drives
|
|
/// `RecordOpImpl.startVoiceRecord(...)` plus an OPUS decoder that emits
|
|
/// `speechAudio` PCM frames. The iOS counterpart sits on
|
|
/// `JL_SpeechAIttsHandler` / `JL_SpeexManager`, which need explicit wiring
|
|
/// against the SDK's stream callbacks. Until that path is implemented:
|
|
///
|
|
/// - `start(...)` / `stop(...)` invoke the completion with `false` + an
|
|
/// explanatory message;
|
|
/// - `isRecording()` returns `false`.
|
|
///
|
|
/// The MethodChannel surface is preserved so the Dart layer (which already
|
|
/// expects errors here on missing devices) sees a clean `SPEECH_START_ERR`.
|
|
public class SpeechFeature {
|
|
|
|
public static let voiceTypePcm = 0
|
|
public static let voiceTypeSpeex = 1
|
|
public static let voiceTypeOpus = 2
|
|
|
|
public static let sampleRate8k = 8
|
|
public static let sampleRate16k = 16
|
|
|
|
public static let vadWayDevice = 0
|
|
public static let vadWaySdk = 1
|
|
|
|
public static let reasonNormal = 0
|
|
public static let reasonStop = 1
|
|
|
|
weak var server: JieliHomeServer?
|
|
init(server: JieliHomeServer) { self.server = server }
|
|
|
|
public func isRecording(address: String?) -> Bool { false }
|
|
|
|
public func start(
|
|
address: String?,
|
|
voiceType: Int,
|
|
sampleRate: Int,
|
|
vadWay: Int,
|
|
completion: @escaping (Bool, String?) -> Void
|
|
) {
|
|
// TODO: wire to JL_SpeechAIttsHandler / JL_SpeexManager.
|
|
completion(false, "speech.start not yet implemented on iOS")
|
|
}
|
|
|
|
public func stop(
|
|
address: String?,
|
|
reason: Int,
|
|
completion: @escaping (Bool, String?) -> Void
|
|
) {
|
|
completion(false, "speech.stop not yet implemented on iOS")
|
|
}
|
|
|
|
public func detach() {
|
|
// No resources held while stubbed.
|
|
}
|
|
}
|
|
|