react-native-davoice-tts 1.0.324 → 1.0.326

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/TTSRNBridge.podspec +1 -1
  2. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
  3. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -1
  4. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -1
  5. package/android/src/main/java/com/davoice/stt/rn/STTModule.kt +35 -12
  6. package/ios/SpeechBridge/SpeechBridge.m +96 -1
  7. package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
  8. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  9. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +8736 -8687
  10. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +51 -51
  11. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +51 -51
  12. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
  13. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +2245 -2196
  14. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +12 -12
  15. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +12 -12
  16. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +2245 -2196
  17. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +12 -12
  18. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +12 -12
  19. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  20. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  21. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +24 -24
  22. package/package.json +1 -1
  23. package/speech/index.ts +93 -0
@@ -155,18 +155,6 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
155
155
  @objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
156
156
  @objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
157
157
  }
158
- public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
159
- public typealias IsEngineReady = () -> Swift.Bool
160
- public typealias useOnlyEnginePlayback = () -> Swift.Bool
161
- public typealias StopEnginePlayback = () -> Swift.Void
162
- public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
163
- public enum AudioPlaybackHook {
164
- public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
165
- public static var isEngineReady: DavoiceTTS.IsEngineReady?
166
- public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
167
- public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
168
- public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
169
- }
170
158
  @objc public protocol STTDelegate {
171
159
  @objc func stt(_ stt: DavoiceTTS.STT, didEmitEvent name: Swift.String, body: [Swift.String : Any]?)
172
160
  }
@@ -211,6 +199,18 @@ public enum AudioPlaybackHook {
211
199
  @objc override dynamic public init()
212
200
  @objc deinit
213
201
  }
202
+ public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
203
+ public typealias IsEngineReady = () -> Swift.Bool
204
+ public typealias useOnlyEnginePlayback = () -> Swift.Bool
205
+ public typealias StopEnginePlayback = () -> Swift.Void
206
+ public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
207
+ public enum AudioPlaybackHook {
208
+ public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
209
+ public static var isEngineReady: DavoiceTTS.IsEngineReady?
210
+ public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
211
+ public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
212
+ public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
213
+ }
214
214
  extension DavoiceTTS.SVLogLevel : Swift.Equatable {}
215
215
  extension DavoiceTTS.SVLogLevel : Swift.Hashable {}
216
216
  extension DavoiceTTS.SVLogLevel : Swift.RawRepresentable {}
@@ -155,18 +155,6 @@ public enum SpeakerVerificationError : Swift.Error, Swift.CustomStringConvertibl
155
155
  @objc final public func playWav(_ url: Foundation.URL, markAsLastUtterance: Swift.Bool = true)
156
156
  @objc final public func playBuffer(_ buffer: AVFAudio.AVAudioPCMBuffer, markAsLastUtterance: Swift.Bool = true)
157
157
  }
158
- public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
159
- public typealias IsEngineReady = () -> Swift.Bool
160
- public typealias useOnlyEnginePlayback = () -> Swift.Bool
161
- public typealias StopEnginePlayback = () -> Swift.Void
162
- public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
163
- public enum AudioPlaybackHook {
164
- public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
165
- public static var isEngineReady: DavoiceTTS.IsEngineReady?
166
- public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
167
- public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
168
- public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
169
- }
170
158
  @objc public protocol STTDelegate {
171
159
  @objc func stt(_ stt: DavoiceTTS.STT, didEmitEvent name: Swift.String, body: [Swift.String : Any]?)
172
160
  }
@@ -211,6 +199,18 @@ public enum AudioPlaybackHook {
211
199
  @objc override dynamic public init()
212
200
  @objc deinit
213
201
  }
202
+ public typealias EngineSchedule = (_ url: Foundation.URL, _ onDone: @escaping () -> Swift.Void) -> Swift.Bool
203
+ public typealias IsEngineReady = () -> Swift.Bool
204
+ public typealias useOnlyEnginePlayback = () -> Swift.Bool
205
+ public typealias StopEnginePlayback = () -> Swift.Void
206
+ public typealias CurrentEngineProvider = () -> AVFAudio.AVAudioEngine?
207
+ public enum AudioPlaybackHook {
208
+ public static var engineScheduleFile: DavoiceTTS.EngineSchedule?
209
+ public static var isEngineReady: DavoiceTTS.IsEngineReady?
210
+ public static var useOnlyEnginePlayback: DavoiceTTS.useOnlyEnginePlayback?
211
+ public static var stopEnginePlayback: DavoiceTTS.StopEnginePlayback?
212
+ public static var currentEngine: DavoiceTTS.CurrentEngineProvider?
213
+ }
214
214
  extension DavoiceTTS.SVLogLevel : Swift.Equatable {}
215
215
  extension DavoiceTTS.SVLogLevel : Swift.Hashable {}
216
216
  extension DavoiceTTS.SVLogLevel : Swift.RawRepresentable {}
@@ -14,11 +14,11 @@
14
14
  </data>
15
15
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
16
16
  <data>
17
- NyZQjxkgBe0aYMmXpROiTR3HVWc=
17
+ XazQRW+sRlakOQm+ZkmgxCELI3A=
18
18
  </data>
19
19
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
20
20
  <data>
21
- Lo1kzdiQW3MbRnpL5NwtlDmQ4K4=
21
+ yuxQtvPVHlWEIZ4YBCuHNEji7G0=
22
22
  </data>
23
23
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
24
24
  <data>
@@ -26,19 +26,19 @@
26
26
  </data>
27
27
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
28
28
  <data>
29
- Lo1kzdiQW3MbRnpL5NwtlDmQ4K4=
29
+ yuxQtvPVHlWEIZ4YBCuHNEji7G0=
30
30
  </data>
31
31
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
32
32
  <data>
33
- B0DpEx1+cQEYUNECDRTpw4Y1gHc=
33
+ ZVHNSHjaKTRLmdl5hy6vMDqCFoE=
34
34
  </data>
35
35
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
36
36
  <data>
37
- NyZQjxkgBe0aYMmXpROiTR3HVWc=
37
+ XazQRW+sRlakOQm+ZkmgxCELI3A=
38
38
  </data>
39
39
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
40
40
  <data>
41
- PM9HWpPEWdJL9LG7TjGr/AwbGT0=
41
+ ANI+8vNjeuF1duN64GMda3kBxiQ=
42
42
  </data>
43
43
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
44
44
  <data>
@@ -46,11 +46,11 @@
46
46
  </data>
47
47
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
48
48
  <data>
49
- PM9HWpPEWdJL9LG7TjGr/AwbGT0=
49
+ ANI+8vNjeuF1duN64GMda3kBxiQ=
50
50
  </data>
51
51
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
52
52
  <data>
53
- p3IiobYG+ZvpPwHSNHft2wlgZLc=
53
+ xzJ9RDb5PQNBc3B6cG2mloKiyqI=
54
54
  </data>
55
55
  <key>Modules/module.modulemap</key>
56
56
  <data>
@@ -74,22 +74,22 @@
74
74
  <dict>
75
75
  <key>hash</key>
76
76
  <data>
77
- NyZQjxkgBe0aYMmXpROiTR3HVWc=
77
+ XazQRW+sRlakOQm+ZkmgxCELI3A=
78
78
  </data>
79
79
  <key>hash2</key>
80
80
  <data>
81
- 75X9Mri9hnaxHQl+c0Skf9IlFn6cOt7CtViyPIrZj30=
81
+ 5R8C/YiV6GCgwRclk21yJC698+/qQrjzAK4EtwCEqkI=
82
82
  </data>
83
83
  </dict>
84
84
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
85
85
  <dict>
86
86
  <key>hash</key>
87
87
  <data>
88
- Lo1kzdiQW3MbRnpL5NwtlDmQ4K4=
88
+ yuxQtvPVHlWEIZ4YBCuHNEji7G0=
89
89
  </data>
90
90
  <key>hash2</key>
91
91
  <data>
92
- j8+s75uljv0PS7d4LD/ypBvNZtFZcUqryonzH8gx/2s=
92
+ mB/DirwzRQ1U/FVeCVITbYm/SZfmW076uH9A9Nm0iI0=
93
93
  </data>
94
94
  </dict>
95
95
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
@@ -107,44 +107,44 @@
107
107
  <dict>
108
108
  <key>hash</key>
109
109
  <data>
110
- Lo1kzdiQW3MbRnpL5NwtlDmQ4K4=
110
+ yuxQtvPVHlWEIZ4YBCuHNEji7G0=
111
111
  </data>
112
112
  <key>hash2</key>
113
113
  <data>
114
- j8+s75uljv0PS7d4LD/ypBvNZtFZcUqryonzH8gx/2s=
114
+ mB/DirwzRQ1U/FVeCVITbYm/SZfmW076uH9A9Nm0iI0=
115
115
  </data>
116
116
  </dict>
117
117
  <key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
118
118
  <dict>
119
119
  <key>hash</key>
120
120
  <data>
121
- B0DpEx1+cQEYUNECDRTpw4Y1gHc=
121
+ ZVHNSHjaKTRLmdl5hy6vMDqCFoE=
122
122
  </data>
123
123
  <key>hash2</key>
124
124
  <data>
125
- ps10bzmbuIoMAQ0Qci+BAUOD+eewbBdhOEA9Y7unj6Q=
125
+ L2ENsbjrpVpjUfD10cmKITlEM1Sb3+VBZhEr6HDy2kM=
126
126
  </data>
127
127
  </dict>
128
128
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
129
129
  <dict>
130
130
  <key>hash</key>
131
131
  <data>
132
- NyZQjxkgBe0aYMmXpROiTR3HVWc=
132
+ XazQRW+sRlakOQm+ZkmgxCELI3A=
133
133
  </data>
134
134
  <key>hash2</key>
135
135
  <data>
136
- 75X9Mri9hnaxHQl+c0Skf9IlFn6cOt7CtViyPIrZj30=
136
+ 5R8C/YiV6GCgwRclk21yJC698+/qQrjzAK4EtwCEqkI=
137
137
  </data>
138
138
  </dict>
139
139
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
140
140
  <dict>
141
141
  <key>hash</key>
142
142
  <data>
143
- PM9HWpPEWdJL9LG7TjGr/AwbGT0=
143
+ ANI+8vNjeuF1duN64GMda3kBxiQ=
144
144
  </data>
145
145
  <key>hash2</key>
146
146
  <data>
147
- Uj3ElHF6IPtVK02/4zC5iHu2TnrSnWZfa6X7kGKlfJI=
147
+ nFWAKEe39Kye8DAcxIY6Fz1Gk7d/K40dNLOxY1M83IQ=
148
148
  </data>
149
149
  </dict>
150
150
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
@@ -162,22 +162,22 @@
162
162
  <dict>
163
163
  <key>hash</key>
164
164
  <data>
165
- PM9HWpPEWdJL9LG7TjGr/AwbGT0=
165
+ ANI+8vNjeuF1duN64GMda3kBxiQ=
166
166
  </data>
167
167
  <key>hash2</key>
168
168
  <data>
169
- Uj3ElHF6IPtVK02/4zC5iHu2TnrSnWZfa6X7kGKlfJI=
169
+ nFWAKEe39Kye8DAcxIY6Fz1Gk7d/K40dNLOxY1M83IQ=
170
170
  </data>
171
171
  </dict>
172
172
  <key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
173
173
  <dict>
174
174
  <key>hash</key>
175
175
  <data>
176
- p3IiobYG+ZvpPwHSNHft2wlgZLc=
176
+ xzJ9RDb5PQNBc3B6cG2mloKiyqI=
177
177
  </data>
178
178
  <key>hash2</key>
179
179
  <data>
180
- ZiAlyDaM8G4qNZi/8OS/Rn5qe6FiEKjozIgTHIZSxCA=
180
+ MZmq3tYR6fQtt+6TgXgI1S3BThahGBR6QH0J/RnjS1Y=
181
181
  </data>
182
182
  </dict>
183
183
  <key>Modules/module.modulemap</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.324",
3
+ "version": "1.0.326",
4
4
  "description": "tts library for React Native",
5
5
  "main": "tts/index.js",
6
6
  "types": "tts/index.d.ts",
package/speech/index.ts CHANGED
@@ -190,6 +190,8 @@ class Speech {
190
190
  // top of file (new state)
191
191
  private lastLocale: string | null = null;
192
192
  private lastModel: string | null = null;
193
+ private lastOnboardingJsonPath: string | null = null;
194
+ private hasCompletedFullInit = false;
193
195
  private iosTtsOnly = false; // when true, use NativeTTS directly on iOS
194
196
 
195
197
 
@@ -392,11 +394,13 @@ class Speech {
392
394
 
393
395
  this.lastLocale = opts.locale;
394
396
  this.lastModel = modelPath;
397
+ this.lastOnboardingJsonPath = opts.onboardingJsonPath ?? null;
395
398
 
396
399
  if (Platform.OS === 'ios' && NativeSpeech?.initAll) {
397
400
  this.iosTtsOnly = false; // full unified mode
398
401
  this.teardownListeners(); // re-wire listeners for unified
399
402
  const r = await NativeSpeech.initAll({ ...opts, model: modelPath });
403
+ this.hasCompletedFullInit = true;
400
404
  this.ensureListeners();
401
405
  return r;
402
406
  }
@@ -446,6 +450,7 @@ class Speech {
446
450
  const modelExt = this.resolveModelExt(opts.model);
447
451
  console.log('[MODELDBG] initAll.modelExt (resolved)=', modelExt);
448
452
  await NativeTTS.initTTS({ model: modelPath, modelExt });
453
+ this.hasCompletedFullInit = true;
449
454
  }
450
455
 
451
456
  async destroyAll() {
@@ -456,6 +461,7 @@ class Speech {
456
461
  // iOS unified
457
462
  if (Platform.OS === 'ios' && NativeSpeech?.destroyAll) {
458
463
  const r = await NativeSpeech.destroyAll();
464
+ this.hasCompletedFullInit = false;
459
465
  this.iosTtsOnly = false;
460
466
  this.lastLocale = this.lastLocale ?? null;
461
467
  this.teardownListeners();
@@ -469,10 +475,97 @@ class Speech {
469
475
  NativeSTT.destroySpeech(() => res());
470
476
  });
471
477
  } catch {}
478
+ this.hasCompletedFullInit = false;
472
479
  this.teardownListeners();
473
480
  return 'Destroyed';
474
481
  }
475
482
 
483
+ async initWithoutModel() {
484
+ if (!this.hasCompletedFullInit || !this.lastLocale) {
485
+ throw new Error('initWithoutModel() requires a successful initAll() first.');
486
+ }
487
+
488
+ if (Platform.OS === 'ios' && NativeSpeech?.initWithoutModel) {
489
+ this.iosTtsOnly = false;
490
+ this.teardownListeners();
491
+ const r = await NativeSpeech.initWithoutModel({
492
+ locale: this.lastLocale,
493
+ onboardingJsonPath: this.lastOnboardingJsonPath,
494
+ });
495
+ this.ensureListeners();
496
+ return r;
497
+ }
498
+
499
+ if (!NativeSTT) {
500
+ throw new Error('Missing native STT bridge.');
501
+ }
502
+
503
+ this.ensureListeners();
504
+ return new Promise<void>((resolve, reject) => {
505
+ try {
506
+ if (typeof NativeSTT.initWithoutModel === 'function') {
507
+ NativeSTT.initWithoutModel(
508
+ this.lastLocale,
509
+ { onboardingJsonPath: this.lastOnboardingJsonPath ?? null },
510
+ (err: string) => (err ? reject(new Error(err)) : resolve()),
511
+ );
512
+ return;
513
+ }
514
+
515
+ if (Platform.OS === 'android') {
516
+ NativeSTT.startSpeech(
517
+ this.lastLocale,
518
+ {
519
+ EXTRA_LANGUAGE_MODEL: 'LANGUAGE_MODEL_FREE_FORM',
520
+ EXTRA_MAX_RESULTS: 5,
521
+ EXTRA_PARTIAL_RESULTS: true,
522
+ REQUEST_PERMISSIONS_AUTO: true,
523
+ onboardingJsonPath: this.lastOnboardingJsonPath ?? null,
524
+ },
525
+ (err: string) => (err ? reject(new Error(err)) : resolve()),
526
+ );
527
+ return;
528
+ }
529
+
530
+ NativeSTT.startSpeech(this.lastLocale, (err: string) =>
531
+ err ? reject(new Error(err)) : resolve(),
532
+ );
533
+ } catch (e) {
534
+ reject(e as any);
535
+ }
536
+ });
537
+ }
538
+
539
+ async destroyWihtouModel() {
540
+ if (!this.hasCompletedFullInit) {
541
+ throw new Error('destroyWihtouModel() requires a successful initAll() first.');
542
+ }
543
+
544
+ if (Platform.OS === 'ios' && NativeSpeech?.destroyWihtouModel) {
545
+ return NativeSpeech.destroyWihtouModel();
546
+ }
547
+
548
+ return new Promise<void>((resolve) => {
549
+ try {
550
+ if (typeof NativeSTT?.destroyWihtouModel === 'function') {
551
+ NativeSTT.destroyWihtouModel(() => resolve());
552
+ return;
553
+ }
554
+ if (!NativeSTT?.destroySpeech) {
555
+ resolve();
556
+ return;
557
+ }
558
+ NativeSTT.destroySpeech(() => resolve());
559
+ } catch {
560
+ resolve();
561
+ }
562
+ });
563
+ }
564
+
565
+ async destroyWithoutModel() {
566
+ return this.destroyWihtouModel();
567
+ }
568
+
476
569
  // ---------- STT ----------
477
570
  async start(locale: string, options: Record<string, any> = {}) {
478
571
  this.ensureListeners();