react-native-davoice-tts 1.0.371 → 1.0.373

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.
@@ -2,7 +2,7 @@ require 'json'
2
2
 
3
3
  Pod::Spec.new do |s|
4
4
  s.name = "TTSRNBridge"
5
- s.version = "1.0.306" # Update to your package version
5
+ s.version = "1.0.310" # Update to your package version
6
6
  s.summary = "TTS for React Native."
7
7
  s.description = <<-DESC
8
8
  A React Native module for tts .
@@ -1 +1 @@
1
- c74f2a1a66110cce02e155b3fe2b7be1 tts-1.0.0.aar
1
+ 48eb25eb244e12e6e3c3ae21c49d7f21 tts-1.0.0.aar
@@ -1 +1 @@
1
- 63f168215f50d203c886df6fe81f0183c525df84 tts-1.0.0.aar
1
+ 45f4f98c37f21f15c8d04d0297b2ea30788a8f2e tts-1.0.0.aar
@@ -334,6 +334,15 @@ public class DaVoiceTTSBridge extends ReactContextBaseJavaModule {
334
334
  return null;
335
335
  }
336
336
 
337
+ @ReactMethod
338
+ public void changeVoice(String name, Promise promise) {
339
+ try {
340
+ promise.resolve(tts == null || name == null ? -1 : tts.changeVoice(name));
341
+ } catch (Exception ignored) {
342
+ promise.resolve(-1);
343
+ }
344
+ }
345
+
337
346
  @ReactMethod
338
347
  public void speak(String text, int speakerId, double speed, Promise promise) {
339
348
  try {
@@ -8,32 +8,32 @@
8
8
  <key>BinaryPath</key>
9
9
  <string>DavoiceTTS.framework/DavoiceTTS</string>
10
10
  <key>LibraryIdentifier</key>
11
- <string>ios-arm64_x86_64-simulator</string>
11
+ <string>ios-arm64</string>
12
12
  <key>LibraryPath</key>
13
13
  <string>DavoiceTTS.framework</string>
14
14
  <key>SupportedArchitectures</key>
15
15
  <array>
16
16
  <string>arm64</string>
17
- <string>x86_64</string>
18
17
  </array>
19
18
  <key>SupportedPlatform</key>
20
19
  <string>ios</string>
21
- <key>SupportedPlatformVariant</key>
22
- <string>simulator</string>
23
20
  </dict>
24
21
  <dict>
25
22
  <key>BinaryPath</key>
26
23
  <string>DavoiceTTS.framework/DavoiceTTS</string>
27
24
  <key>LibraryIdentifier</key>
28
- <string>ios-arm64</string>
25
+ <string>ios-arm64_x86_64-simulator</string>
29
26
  <key>LibraryPath</key>
30
27
  <string>DavoiceTTS.framework</string>
31
28
  <key>SupportedArchitectures</key>
32
29
  <array>
33
30
  <string>arm64</string>
31
+ <string>x86_64</string>
34
32
  </array>
35
33
  <key>SupportedPlatform</key>
36
34
  <string>ios</string>
35
+ <key>SupportedPlatformVariant</key>
36
+ <string>simulator</string>
37
37
  </dict>
38
38
  </array>
39
39
  <key>CFBundlePackageType</key>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-davoice-tts",
3
- "version": "1.0.371",
3
+ "version": "1.0.373",
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
@@ -285,6 +285,19 @@ class Speech {
285
285
  if (r) r();
286
286
  }
287
287
 
288
+ /** Android reference voice, matched case-insensitively without .wav.
289
+ * Returns 0 on match; -1 on fallback/unavailability. Missing names select the
290
+ * first WAV (alphabetical order). Already generated audio keeps its voice.
291
+ */
292
+ async changeVoice(name: string): Promise<number> {
293
+ if (Platform.OS !== 'android' || typeof NativeTTS?.changeVoice !== 'function') return -1;
294
+ try {
295
+ return (await NativeTTS.changeVoice(name)) === 0 ? 0 : -1;
296
+ } catch {
297
+ return -1;
298
+ }
299
+ }
300
+
288
301
  private _nativeSpeak(text: string, speakerId: number, s: number) {
289
302
  const nativeTtsSpeak = () => {
290
303
  if (!NativeTTS?.speak) throw new Error('TTS speak not available');