react-native-davoice-tts 1.0.416 → 1.0.418
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.
- package/TTSRNBridge.podspec +1 -1
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +0 -82
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +540 -540
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +0 -164
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +540 -540
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +540 -540
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +15 -15
- package/package.json +1 -1
- package/speech/index.d.ts +11 -1
- package/speech/index.ts +45 -24
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/DavoiceTTS-Swift.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
Q2XyvfydwNU3JNGF6wk63Up6aKE=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Info.plist</key>
|
|
12
12
|
<data>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
O63HvKnrlAg1FO1UVI1kp6yoOCY=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
</data>
|
|
23
23
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
|
|
24
24
|
<data>
|
|
25
|
-
|
|
25
|
+
7k5UFU0VKirpYFIRunlliBIHL1o=
|
|
26
26
|
</data>
|
|
27
27
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
28
28
|
<data>
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
O63HvKnrlAg1FO1UVI1kp6yoOCY=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
</data>
|
|
43
43
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
|
|
44
44
|
<data>
|
|
45
|
-
|
|
45
|
+
eS9T1ZYAn+xLScjKP2bpqIpMYrY=
|
|
46
46
|
</data>
|
|
47
47
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
|
48
48
|
<data>
|
|
@@ -63,22 +63,22 @@
|
|
|
63
63
|
<dict>
|
|
64
64
|
<key>hash</key>
|
|
65
65
|
<data>
|
|
66
|
-
|
|
66
|
+
Q2XyvfydwNU3JNGF6wk63Up6aKE=
|
|
67
67
|
</data>
|
|
68
68
|
<key>hash2</key>
|
|
69
69
|
<data>
|
|
70
|
-
|
|
70
|
+
AthueO1O6cexeZK4ZfeVLmt/LqhO6D/Et8IsQ/xoflE=
|
|
71
71
|
</data>
|
|
72
72
|
</dict>
|
|
73
73
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
74
74
|
<dict>
|
|
75
75
|
<key>hash</key>
|
|
76
76
|
<data>
|
|
77
|
-
|
|
77
|
+
O63HvKnrlAg1FO1UVI1kp6yoOCY=
|
|
78
78
|
</data>
|
|
79
79
|
<key>hash2</key>
|
|
80
80
|
<data>
|
|
81
|
-
|
|
81
|
+
zcbpuYRRmRG6cNAVG2A4fkJBBOd0dPH3u/1NMvkZqeM=
|
|
82
82
|
</data>
|
|
83
83
|
</dict>
|
|
84
84
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
@@ -96,11 +96,11 @@
|
|
|
96
96
|
<dict>
|
|
97
97
|
<key>hash</key>
|
|
98
98
|
<data>
|
|
99
|
-
|
|
99
|
+
7k5UFU0VKirpYFIRunlliBIHL1o=
|
|
100
100
|
</data>
|
|
101
101
|
<key>hash2</key>
|
|
102
102
|
<data>
|
|
103
|
-
|
|
103
|
+
pf5qrxCXbftxQ7yXOymTUQbyezZ6+KXKE4r61K9f0XI=
|
|
104
104
|
</data>
|
|
105
105
|
</dict>
|
|
106
106
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
|
|
@@ -129,11 +129,11 @@
|
|
|
129
129
|
<dict>
|
|
130
130
|
<key>hash</key>
|
|
131
131
|
<data>
|
|
132
|
-
|
|
132
|
+
O63HvKnrlAg1FO1UVI1kp6yoOCY=
|
|
133
133
|
</data>
|
|
134
134
|
<key>hash2</key>
|
|
135
135
|
<data>
|
|
136
|
-
|
|
136
|
+
zcbpuYRRmRG6cNAVG2A4fkJBBOd0dPH3u/1NMvkZqeM=
|
|
137
137
|
</data>
|
|
138
138
|
</dict>
|
|
139
139
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
@@ -151,11 +151,11 @@
|
|
|
151
151
|
<dict>
|
|
152
152
|
<key>hash</key>
|
|
153
153
|
<data>
|
|
154
|
-
|
|
154
|
+
eS9T1ZYAn+xLScjKP2bpqIpMYrY=
|
|
155
155
|
</data>
|
|
156
156
|
<key>hash2</key>
|
|
157
157
|
<data>
|
|
158
|
-
|
|
158
|
+
NejMEctREOpazPZmdBdVctGGgujh0Wsd3xYnAY1eh3Y=
|
|
159
159
|
</data>
|
|
160
160
|
</dict>
|
|
161
161
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
|
package/package.json
CHANGED
package/speech/index.d.ts
CHANGED
|
@@ -146,6 +146,9 @@ declare class Speech {
|
|
|
146
146
|
private ttsChain;
|
|
147
147
|
private ttsPendingResolve;
|
|
148
148
|
private ttsPendingTimeout;
|
|
149
|
+
private speakWaiters;
|
|
150
|
+
private speakWaitTimeout;
|
|
151
|
+
private ttsEpoch;
|
|
149
152
|
private sttTransitionChain;
|
|
150
153
|
private dbgAsset;
|
|
151
154
|
private _onNativeFinishedSpeaking;
|
|
@@ -196,7 +199,6 @@ declare class Speech {
|
|
|
196
199
|
changeVoice(name: string): Promise<number>;
|
|
197
200
|
private _nativeSpeak;
|
|
198
201
|
private enqueueSttTransition;
|
|
199
|
-
private _speakAndWait;
|
|
200
202
|
private sttEmitter;
|
|
201
203
|
private ttsEmitter;
|
|
202
204
|
private unifiedEmitter;
|
|
@@ -309,7 +311,15 @@ declare class Speech {
|
|
|
309
311
|
initTTS(modelOrConfig: ModelRef | {
|
|
310
312
|
model: ModelRef;
|
|
311
313
|
}): Promise<any>;
|
|
314
|
+
/**
|
|
315
|
+
* Speaks `text`. The text goes to the native speech queue right away, so call
|
|
316
|
+
* it for each sentence as soon as you have it: the queue prepares the next
|
|
317
|
+
* sentences while the current one plays, and they follow each other without
|
|
318
|
+
* gaps. Resolves when everything queued so far has been spoken (native
|
|
319
|
+
* onFinishedSpeaking: the queue is empty).
|
|
320
|
+
*/
|
|
312
321
|
speak(text: string, speakerId?: number, speed?: number): Promise<void>;
|
|
322
|
+
private _releaseSpeakWaiters;
|
|
313
323
|
private _cancelTtsWait;
|
|
314
324
|
stopSpeaking(): Promise<any>;
|
|
315
325
|
private wavChain;
|
package/speech/index.ts
CHANGED
|
@@ -280,6 +280,10 @@ class Speech {
|
|
|
280
280
|
private ttsChain: Promise<void> = Promise.resolve();
|
|
281
281
|
private ttsPendingResolve: (() => void) | null = null;
|
|
282
282
|
private ttsPendingTimeout: any = null;
|
|
283
|
+
// speak(): texts native has queued, waiting for the queue to be spoken
|
|
284
|
+
private speakWaiters: Array<() => void> = [];
|
|
285
|
+
private speakWaitTimeout: any = null;
|
|
286
|
+
private ttsEpoch = 0; // bumped by stopSpeaking/initAll/destroyAll
|
|
283
287
|
private sttTransitionChain: Promise<void> = Promise.resolve();
|
|
284
288
|
|
|
285
289
|
private dbgAsset(label: string, x: any) {
|
|
@@ -308,6 +312,8 @@ class Speech {
|
|
|
308
312
|
const r = this.ttsPendingResolve;
|
|
309
313
|
this.ttsPendingResolve = null;
|
|
310
314
|
if (r) r();
|
|
315
|
+
// 3) speak(): everything queued has been spoken
|
|
316
|
+
this._releaseSpeakWaiters();
|
|
311
317
|
}
|
|
312
318
|
|
|
313
319
|
/** Voices available in the loaded .dm (the names changeVoice() accepts; the
|
|
@@ -458,27 +464,6 @@ class Speech {
|
|
|
458
464
|
return run;
|
|
459
465
|
}
|
|
460
466
|
|
|
461
|
-
private _speakAndWait(text: string, speakerId: number, s: number, timeoutMs = 600000) {
|
|
462
|
-
return new Promise<void>((resolve, reject) => {
|
|
463
|
-
this.ttsPendingResolve = resolve;
|
|
464
|
-
// safety: never hang forever
|
|
465
|
-
this.ttsPendingTimeout = setTimeout(() => {
|
|
466
|
-
dbg('Timeout waiting for onFinishedSpeaking — releasing wait');
|
|
467
|
-
if (this.ttsPendingTimeout) { clearTimeout(this.ttsPendingTimeout); this.ttsPendingTimeout = null; }
|
|
468
|
-
const r = this.ttsPendingResolve;
|
|
469
|
-
this.ttsPendingResolve = null;
|
|
470
|
-
if (r) r(); // ✅ accept after timeout
|
|
471
|
-
}, timeoutMs);
|
|
472
|
-
try {
|
|
473
|
-
this._nativeSpeak(text, speakerId, s);
|
|
474
|
-
} catch (e) {
|
|
475
|
-
if (this.ttsPendingTimeout) { clearTimeout(this.ttsPendingTimeout); this.ttsPendingTimeout = null; }
|
|
476
|
-
this.ttsPendingResolve = null;
|
|
477
|
-
reject(e as any);
|
|
478
|
-
}
|
|
479
|
-
});
|
|
480
|
-
}
|
|
481
|
-
|
|
482
467
|
private sttEmitter: NativeEventEmitter | null = null;
|
|
483
468
|
private ttsEmitter: NativeEventEmitter | typeof DeviceEventEmitter | null = null;
|
|
484
469
|
private unifiedEmitter: NativeEventEmitter | null = null;
|
|
@@ -1473,14 +1458,46 @@ class Speech {
|
|
|
1473
1458
|
return r;
|
|
1474
1459
|
}
|
|
1475
1460
|
|
|
1461
|
+
/**
|
|
1462
|
+
* Speaks `text`. The text goes to the native speech queue right away, so call
|
|
1463
|
+
* it for each sentence as soon as you have it: the queue prepares the next
|
|
1464
|
+
* sentences while the current one plays, and they follow each other without
|
|
1465
|
+
* gaps. Resolves when everything queued so far has been spoken (native
|
|
1466
|
+
* onFinishedSpeaking: the queue is empty).
|
|
1467
|
+
*/
|
|
1476
1468
|
async speak(text: string, speakerId = 0, speed = 1.0) {
|
|
1477
1469
|
// sanitize and invert (avoid NaN/undefined/null)
|
|
1478
1470
|
// Reverse speed to length.
|
|
1479
1471
|
const s = Number.isFinite(speed as number) && speed !== 0 ? 1.0 / (speed as number) : 1.0;
|
|
1480
1472
|
this.ensureListeners();
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1473
|
+
const epoch = this.ttsEpoch;
|
|
1474
|
+
let release!: () => void;
|
|
1475
|
+
const spoken = new Promise<void>((resolve) => { release = resolve; });
|
|
1476
|
+
// Only the sends are serialized (in order); none waits for the previous
|
|
1477
|
+
// text to be spoken. A stop drops the texts not sent yet.
|
|
1478
|
+
const send = this.ttsChain.then(async () => {
|
|
1479
|
+
if (epoch !== this.ttsEpoch) return release();
|
|
1480
|
+
await this._nativeSpeak(text, speakerId, s);
|
|
1481
|
+
if (epoch !== this.ttsEpoch) return release();
|
|
1482
|
+
// Waits from now: a queue-empty event sent before native had this text
|
|
1483
|
+
// has already arrived.
|
|
1484
|
+
this.speakWaiters.push(release);
|
|
1485
|
+
if (this.speakWaitTimeout) clearTimeout(this.speakWaitTimeout);
|
|
1486
|
+
this.speakWaitTimeout = setTimeout(() => {
|
|
1487
|
+
dbg('Timeout waiting for onFinishedSpeaking — releasing speak waits');
|
|
1488
|
+
this._releaseSpeakWaiters();
|
|
1489
|
+
}, 600000);
|
|
1490
|
+
});
|
|
1491
|
+
this.ttsChain = send.catch(() => {});
|
|
1492
|
+
await send;
|
|
1493
|
+
return spoken;
|
|
1494
|
+
}
|
|
1495
|
+
|
|
1496
|
+
private _releaseSpeakWaiters() {
|
|
1497
|
+
if (this.speakWaitTimeout) { clearTimeout(this.speakWaitTimeout); this.speakWaitTimeout = null; }
|
|
1498
|
+
const waiters = this.speakWaiters;
|
|
1499
|
+
this.speakWaiters = [];
|
|
1500
|
+
waiters.forEach((release) => release());
|
|
1484
1501
|
}
|
|
1485
1502
|
|
|
1486
1503
|
// --- NEW: cancel any pending "wait for finished" immediately ---
|
|
@@ -1498,6 +1515,10 @@ class Speech {
|
|
|
1498
1515
|
this.ttsPendingResolve = null;
|
|
1499
1516
|
if (r) r();
|
|
1500
1517
|
|
|
1518
|
+
// speak(): drop the texts not sent yet, release the ones waiting
|
|
1519
|
+
this.ttsEpoch++;
|
|
1520
|
+
this._releaseSpeakWaiters();
|
|
1521
|
+
|
|
1501
1522
|
// IMPORTANT: do NOT call app callback here (stopSpeaking should not emit "finished")
|
|
1502
1523
|
// this.handlers.onFinishedSpeaking() <-- DO NOT
|
|
1503
1524
|
}
|