react-native-davoice-tts 1.0.251 → 1.0.253
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/STTRNBridge/STTBridge.m +1 -0
- package/ios/SpeechBridge/SpeechBridge.m +50 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +5 -5
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +3 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +142 -7
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +2 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +2 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +6 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +142 -7
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +2 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +2 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +142 -7
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +2 -0
- package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +2 -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 +27 -27
- package/package.json +1 -1
- package/speech/index.ts +128 -18
package/TTSRNBridge.podspec
CHANGED
|
@@ -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.
|
|
5
|
+
s.version = "1.0.126" # 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 .
|
|
@@ -161,6 +161,24 @@ RCT_EXPORT_MODULE(SpeechBridge)
|
|
|
161
161
|
- (NSURL *)resolveLocalURLFromPathOrURL:(NSString *)pathOrURL
|
|
162
162
|
{
|
|
163
163
|
if (!pathOrURL || (id)pathOrURL == [NSNull null] || pathOrURL.length == 0) return nil;
|
|
164
|
+
// ✅ Handle http(s): download to tmp and return file URL
|
|
165
|
+
if ([pathOrURL hasPrefix:@"http://"] || [pathOrURL hasPrefix:@"https://"]) {
|
|
166
|
+
NSURL *remoteURL = [NSURL URLWithString:pathOrURL];
|
|
167
|
+
if (!remoteURL) return nil;
|
|
168
|
+
|
|
169
|
+
NSData *data = [NSData dataWithContentsOfURL:remoteURL];
|
|
170
|
+
if (!data) return nil;
|
|
171
|
+
|
|
172
|
+
// keep extension if possible
|
|
173
|
+
NSString *ext = remoteURL.pathExtension.length ? remoteURL.pathExtension : @"bin";
|
|
174
|
+
NSString *tempName = [NSString stringWithFormat:@"rn_asset_%f.%@", [[NSDate date] timeIntervalSince1970], ext];
|
|
175
|
+
NSString *tempPath = [NSTemporaryDirectory() stringByAppendingPathComponent:tempName];
|
|
176
|
+
|
|
177
|
+
[[NSFileManager defaultManager] removeItemAtPath:tempPath error:nil];
|
|
178
|
+
if (![data writeToFile:tempPath atomically:YES]) return nil;
|
|
179
|
+
|
|
180
|
+
return [NSURL fileURLWithPath:tempPath];
|
|
181
|
+
}
|
|
164
182
|
|
|
165
183
|
// Already a file URL
|
|
166
184
|
if ([pathOrURL hasPrefix:@"file://"]) {
|
|
@@ -299,6 +317,38 @@ RCT_EXPORT_METHOD(initAll:(NSDictionary *)opts
|
|
|
299
317
|
});
|
|
300
318
|
}
|
|
301
319
|
|
|
320
|
+
// Promise-based pause that resolves ONLY when iOS is actually settled in playback (mic released)
|
|
321
|
+
RCT_EXPORT_METHOD(pauseMicrophoneAsync:(nonnull NSNumber *)timeoutMs
|
|
322
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
323
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
324
|
+
{
|
|
325
|
+
if (!self.stt) { resolve(@{@"ok": @(NO), @"reason": @"no_stt"}); return; }
|
|
326
|
+
|
|
327
|
+
// Default if caller passes null/0
|
|
328
|
+
NSNumber *t = timeoutMs ?: @(1500);
|
|
329
|
+
if (t.doubleValue <= 0) t = @(1500);
|
|
330
|
+
|
|
331
|
+
// STT.swift will do the main-queue polling internally
|
|
332
|
+
[self.stt pauseMicrophoneAndWait:t completion:^(BOOL ok, NSString * _Nullable reason) {
|
|
333
|
+
resolve(@{@"ok": @(ok), @"reason": reason ?: @""});
|
|
334
|
+
}];
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// Promise-based unpause that resolves ONLY when engine+task are live again
|
|
338
|
+
RCT_EXPORT_METHOD(unPauseMicrophoneAsync:(nonnull NSNumber *)timeoutMs
|
|
339
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
340
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
341
|
+
{
|
|
342
|
+
if (!self.stt) { resolve(@{@"ok": @(NO), @"reason": @"no_stt"}); return; }
|
|
343
|
+
|
|
344
|
+
NSNumber *t = timeoutMs ?: @(2500);
|
|
345
|
+
if (t.doubleValue <= 0) t = @(2500);
|
|
346
|
+
|
|
347
|
+
[self.stt unPauseMicrophoneAndWait:t completion:^(BOOL ok, NSString * _Nullable reason) {
|
|
348
|
+
resolve(@{@"ok": @(ok), @"reason": reason ?: @""});
|
|
349
|
+
}];
|
|
350
|
+
}
|
|
351
|
+
|
|
302
352
|
// ADD — pause mic
|
|
303
353
|
RCT_EXPORT_METHOD(pauseMicrophone:(RCTResponseSenderBlock)callback)
|
|
304
354
|
{
|
|
@@ -8,32 +8,32 @@
|
|
|
8
8
|
<key>BinaryPath</key>
|
|
9
9
|
<string>DavoiceTTS.framework/DavoiceTTS</string>
|
|
10
10
|
<key>LibraryIdentifier</key>
|
|
11
|
-
<string>ios-
|
|
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-
|
|
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>
|
|
Binary file
|
|
@@ -335,6 +335,7 @@ SWIFT_CLASS("_TtC10DavoiceTTS10DaVoiceTTS")
|
|
|
335
335
|
@end
|
|
336
336
|
|
|
337
337
|
@protocol STTDelegate;
|
|
338
|
+
@class NSNumber;
|
|
338
339
|
@class SFSpeechRecognizer;
|
|
339
340
|
SWIFT_CLASS("_TtC10DavoiceTTS3STT")
|
|
340
341
|
@interface STT : NSObject <SFSpeechRecognizerDelegate>
|
|
@@ -343,6 +344,8 @@ SWIFT_CLASS("_TtC10DavoiceTTS3STT")
|
|
|
343
344
|
@property (nonatomic) BOOL aecEnabled;
|
|
344
345
|
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSString *> * _Nonnull supportedEvents;)
|
|
345
346
|
+ (NSArray<NSString *> * _Nonnull)supportedEvents SWIFT_WARN_UNUSED_RESULT;
|
|
347
|
+
- (void)pauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
348
|
+
- (void)unPauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
346
349
|
- (void)pauseMicrophone;
|
|
347
350
|
- (void)unPauseMicrophone;
|
|
348
351
|
/// Enable/disable iOS voice-processing (AEC + ducking).
|
|
@@ -529,6 +529,141 @@
|
|
|
529
529
|
}
|
|
530
530
|
]
|
|
531
531
|
},
|
|
532
|
+
{
|
|
533
|
+
"kind": "Function",
|
|
534
|
+
"name": "pauseMicrophoneAndWait",
|
|
535
|
+
"printedName": "pauseMicrophoneAndWait(_:completion:)",
|
|
536
|
+
"children": [
|
|
537
|
+
{
|
|
538
|
+
"kind": "TypeNominal",
|
|
539
|
+
"name": "Void",
|
|
540
|
+
"printedName": "()"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
"kind": "TypeNominal",
|
|
544
|
+
"name": "NSNumber",
|
|
545
|
+
"printedName": "Foundation.NSNumber",
|
|
546
|
+
"usr": "c:objc(cs)NSNumber"
|
|
547
|
+
},
|
|
548
|
+
{
|
|
549
|
+
"kind": "TypeFunc",
|
|
550
|
+
"name": "Function",
|
|
551
|
+
"printedName": "(Swift.Bool, Swift.String?) -> ()",
|
|
552
|
+
"children": [
|
|
553
|
+
{
|
|
554
|
+
"kind": "TypeNominal",
|
|
555
|
+
"name": "Void",
|
|
556
|
+
"printedName": "()"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
"kind": "TypeNominal",
|
|
560
|
+
"name": "Tuple",
|
|
561
|
+
"printedName": "(Swift.Bool, Swift.String?)",
|
|
562
|
+
"children": [
|
|
563
|
+
{
|
|
564
|
+
"kind": "TypeNominal",
|
|
565
|
+
"name": "Bool",
|
|
566
|
+
"printedName": "Swift.Bool",
|
|
567
|
+
"usr": "s:Sb"
|
|
568
|
+
},
|
|
569
|
+
{
|
|
570
|
+
"kind": "TypeNominal",
|
|
571
|
+
"name": "Optional",
|
|
572
|
+
"printedName": "Swift.String?",
|
|
573
|
+
"children": [
|
|
574
|
+
{
|
|
575
|
+
"kind": "TypeNominal",
|
|
576
|
+
"name": "String",
|
|
577
|
+
"printedName": "Swift.String",
|
|
578
|
+
"usr": "s:SS"
|
|
579
|
+
}
|
|
580
|
+
],
|
|
581
|
+
"usr": "s:Sq"
|
|
582
|
+
}
|
|
583
|
+
]
|
|
584
|
+
}
|
|
585
|
+
]
|
|
586
|
+
}
|
|
587
|
+
],
|
|
588
|
+
"declKind": "Func",
|
|
589
|
+
"usr": "c:@M@DavoiceTTS@objc(cs)STT(im)pauseMicrophoneAndWait:completion:",
|
|
590
|
+
"mangledName": "$s10DavoiceTTS3STTC22pauseMicrophoneAndWait_10completionySo8NSNumberC_ySb_SSSgtctF",
|
|
591
|
+
"moduleName": "DavoiceTTS",
|
|
592
|
+
"declAttributes": [
|
|
593
|
+
"Final",
|
|
594
|
+
"AccessControl",
|
|
595
|
+
"ObjC",
|
|
596
|
+
"RawDocComment"
|
|
597
|
+
],
|
|
598
|
+
"funcSelfKind": "NonMutating"
|
|
599
|
+
},
|
|
600
|
+
{
|
|
601
|
+
"kind": "Function",
|
|
602
|
+
"name": "unPauseMicrophoneAndWait",
|
|
603
|
+
"printedName": "unPauseMicrophoneAndWait(_:completion:)",
|
|
604
|
+
"children": [
|
|
605
|
+
{
|
|
606
|
+
"kind": "TypeNominal",
|
|
607
|
+
"name": "Void",
|
|
608
|
+
"printedName": "()"
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
"kind": "TypeNominal",
|
|
612
|
+
"name": "NSNumber",
|
|
613
|
+
"printedName": "Foundation.NSNumber",
|
|
614
|
+
"usr": "c:objc(cs)NSNumber"
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
"kind": "TypeFunc",
|
|
618
|
+
"name": "Function",
|
|
619
|
+
"printedName": "(Swift.Bool, Swift.String?) -> ()",
|
|
620
|
+
"children": [
|
|
621
|
+
{
|
|
622
|
+
"kind": "TypeNominal",
|
|
623
|
+
"name": "Void",
|
|
624
|
+
"printedName": "()"
|
|
625
|
+
},
|
|
626
|
+
{
|
|
627
|
+
"kind": "TypeNominal",
|
|
628
|
+
"name": "Tuple",
|
|
629
|
+
"printedName": "(Swift.Bool, Swift.String?)",
|
|
630
|
+
"children": [
|
|
631
|
+
{
|
|
632
|
+
"kind": "TypeNominal",
|
|
633
|
+
"name": "Bool",
|
|
634
|
+
"printedName": "Swift.Bool",
|
|
635
|
+
"usr": "s:Sb"
|
|
636
|
+
},
|
|
637
|
+
{
|
|
638
|
+
"kind": "TypeNominal",
|
|
639
|
+
"name": "Optional",
|
|
640
|
+
"printedName": "Swift.String?",
|
|
641
|
+
"children": [
|
|
642
|
+
{
|
|
643
|
+
"kind": "TypeNominal",
|
|
644
|
+
"name": "String",
|
|
645
|
+
"printedName": "Swift.String",
|
|
646
|
+
"usr": "s:SS"
|
|
647
|
+
}
|
|
648
|
+
],
|
|
649
|
+
"usr": "s:Sq"
|
|
650
|
+
}
|
|
651
|
+
]
|
|
652
|
+
}
|
|
653
|
+
]
|
|
654
|
+
}
|
|
655
|
+
],
|
|
656
|
+
"declKind": "Func",
|
|
657
|
+
"usr": "c:@M@DavoiceTTS@objc(cs)STT(im)unPauseMicrophoneAndWait:completion:",
|
|
658
|
+
"mangledName": "$s10DavoiceTTS3STTC24unPauseMicrophoneAndWait_10completionySo8NSNumberC_ySb_SSSgtctF",
|
|
659
|
+
"moduleName": "DavoiceTTS",
|
|
660
|
+
"declAttributes": [
|
|
661
|
+
"Final",
|
|
662
|
+
"AccessControl",
|
|
663
|
+
"ObjC"
|
|
664
|
+
],
|
|
665
|
+
"funcSelfKind": "NonMutating"
|
|
666
|
+
},
|
|
532
667
|
{
|
|
533
668
|
"kind": "Function",
|
|
534
669
|
"name": "pauseMicrophone",
|
|
@@ -4223,49 +4358,49 @@
|
|
|
4223
4358
|
{
|
|
4224
4359
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4225
4360
|
"kind": "IntegerLiteral",
|
|
4226
|
-
"offset":
|
|
4361
|
+
"offset": 14749,
|
|
4227
4362
|
"length": 1,
|
|
4228
4363
|
"value": "0"
|
|
4229
4364
|
},
|
|
4230
4365
|
{
|
|
4231
4366
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4232
4367
|
"kind": "BooleanLiteral",
|
|
4233
|
-
"offset":
|
|
4368
|
+
"offset": 14909,
|
|
4234
4369
|
"length": 5,
|
|
4235
4370
|
"value": "false"
|
|
4236
4371
|
},
|
|
4237
4372
|
{
|
|
4238
4373
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4239
4374
|
"kind": "BooleanLiteral",
|
|
4240
|
-
"offset":
|
|
4375
|
+
"offset": 16441,
|
|
4241
4376
|
"length": 4,
|
|
4242
4377
|
"value": "true"
|
|
4243
4378
|
},
|
|
4244
4379
|
{
|
|
4245
4380
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4246
4381
|
"kind": "IntegerLiteral",
|
|
4247
|
-
"offset":
|
|
4382
|
+
"offset": 17238,
|
|
4248
4383
|
"length": 1,
|
|
4249
4384
|
"value": "0"
|
|
4250
4385
|
},
|
|
4251
4386
|
{
|
|
4252
4387
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4253
4388
|
"kind": "BooleanLiteral",
|
|
4254
|
-
"offset":
|
|
4389
|
+
"offset": 26545,
|
|
4255
4390
|
"length": 4,
|
|
4256
4391
|
"value": "true"
|
|
4257
4392
|
},
|
|
4258
4393
|
{
|
|
4259
4394
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4260
4395
|
"kind": "BooleanLiteral",
|
|
4261
|
-
"offset":
|
|
4396
|
+
"offset": 45380,
|
|
4262
4397
|
"length": 5,
|
|
4263
4398
|
"value": "false"
|
|
4264
4399
|
},
|
|
4265
4400
|
{
|
|
4266
4401
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4267
4402
|
"kind": "FloatLiteral",
|
|
4268
|
-
"offset":
|
|
4403
|
+
"offset": 59870,
|
|
4269
4404
|
"length": 3,
|
|
4270
4405
|
"value": "0.7"
|
|
4271
4406
|
},
|
|
@@ -22,6 +22,8 @@ import phonemes
|
|
|
22
22
|
@objc final public var continuous: Swift.Bool
|
|
23
23
|
@objc final public var aecEnabled: Swift.Bool
|
|
24
24
|
@objc public static let supportedEvents: [Swift.String]
|
|
25
|
+
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
26
|
+
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
25
27
|
@objc final public func pauseMicrophone()
|
|
26
28
|
@objc final public func unPauseMicrophone()
|
|
27
29
|
@objc final public func setAECEnabled(_ enabled: Swift.Bool)
|
|
@@ -22,6 +22,8 @@ import phonemes
|
|
|
22
22
|
@objc final public var continuous: Swift.Bool
|
|
23
23
|
@objc final public var aecEnabled: Swift.Bool
|
|
24
24
|
@objc public static let supportedEvents: [Swift.String]
|
|
25
|
+
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
26
|
+
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
25
27
|
@objc final public func pauseMicrophone()
|
|
26
28
|
@objc final public func unPauseMicrophone()
|
|
27
29
|
@objc final public func setAECEnabled(_ enabled: Swift.Bool)
|
|
Binary file
|
|
@@ -335,6 +335,7 @@ SWIFT_CLASS("_TtC10DavoiceTTS10DaVoiceTTS")
|
|
|
335
335
|
@end
|
|
336
336
|
|
|
337
337
|
@protocol STTDelegate;
|
|
338
|
+
@class NSNumber;
|
|
338
339
|
@class SFSpeechRecognizer;
|
|
339
340
|
SWIFT_CLASS("_TtC10DavoiceTTS3STT")
|
|
340
341
|
@interface STT : NSObject <SFSpeechRecognizerDelegate>
|
|
@@ -343,6 +344,8 @@ SWIFT_CLASS("_TtC10DavoiceTTS3STT")
|
|
|
343
344
|
@property (nonatomic) BOOL aecEnabled;
|
|
344
345
|
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSString *> * _Nonnull supportedEvents;)
|
|
345
346
|
+ (NSArray<NSString *> * _Nonnull)supportedEvents SWIFT_WARN_UNUSED_RESULT;
|
|
347
|
+
- (void)pauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
348
|
+
- (void)unPauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
346
349
|
- (void)pauseMicrophone;
|
|
347
350
|
- (void)unPauseMicrophone;
|
|
348
351
|
/// Enable/disable iOS voice-processing (AEC + ducking).
|
|
@@ -718,6 +721,7 @@ SWIFT_CLASS("_TtC10DavoiceTTS10DaVoiceTTS")
|
|
|
718
721
|
@end
|
|
719
722
|
|
|
720
723
|
@protocol STTDelegate;
|
|
724
|
+
@class NSNumber;
|
|
721
725
|
@class SFSpeechRecognizer;
|
|
722
726
|
SWIFT_CLASS("_TtC10DavoiceTTS3STT")
|
|
723
727
|
@interface STT : NSObject <SFSpeechRecognizerDelegate>
|
|
@@ -726,6 +730,8 @@ SWIFT_CLASS("_TtC10DavoiceTTS3STT")
|
|
|
726
730
|
@property (nonatomic) BOOL aecEnabled;
|
|
727
731
|
SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSString *> * _Nonnull supportedEvents;)
|
|
728
732
|
+ (NSArray<NSString *> * _Nonnull)supportedEvents SWIFT_WARN_UNUSED_RESULT;
|
|
733
|
+
- (void)pauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
734
|
+
- (void)unPauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
|
|
729
735
|
- (void)pauseMicrophone;
|
|
730
736
|
- (void)unPauseMicrophone;
|
|
731
737
|
/// Enable/disable iOS voice-processing (AEC + ducking).
|
|
@@ -1423,6 +1423,141 @@
|
|
|
1423
1423
|
}
|
|
1424
1424
|
]
|
|
1425
1425
|
},
|
|
1426
|
+
{
|
|
1427
|
+
"kind": "Function",
|
|
1428
|
+
"name": "pauseMicrophoneAndWait",
|
|
1429
|
+
"printedName": "pauseMicrophoneAndWait(_:completion:)",
|
|
1430
|
+
"children": [
|
|
1431
|
+
{
|
|
1432
|
+
"kind": "TypeNominal",
|
|
1433
|
+
"name": "Void",
|
|
1434
|
+
"printedName": "()"
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
"kind": "TypeNominal",
|
|
1438
|
+
"name": "NSNumber",
|
|
1439
|
+
"printedName": "Foundation.NSNumber",
|
|
1440
|
+
"usr": "c:objc(cs)NSNumber"
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
"kind": "TypeFunc",
|
|
1444
|
+
"name": "Function",
|
|
1445
|
+
"printedName": "(Swift.Bool, Swift.String?) -> ()",
|
|
1446
|
+
"children": [
|
|
1447
|
+
{
|
|
1448
|
+
"kind": "TypeNominal",
|
|
1449
|
+
"name": "Void",
|
|
1450
|
+
"printedName": "()"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
"kind": "TypeNominal",
|
|
1454
|
+
"name": "Tuple",
|
|
1455
|
+
"printedName": "(Swift.Bool, Swift.String?)",
|
|
1456
|
+
"children": [
|
|
1457
|
+
{
|
|
1458
|
+
"kind": "TypeNominal",
|
|
1459
|
+
"name": "Bool",
|
|
1460
|
+
"printedName": "Swift.Bool",
|
|
1461
|
+
"usr": "s:Sb"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
"kind": "TypeNominal",
|
|
1465
|
+
"name": "Optional",
|
|
1466
|
+
"printedName": "Swift.String?",
|
|
1467
|
+
"children": [
|
|
1468
|
+
{
|
|
1469
|
+
"kind": "TypeNominal",
|
|
1470
|
+
"name": "String",
|
|
1471
|
+
"printedName": "Swift.String",
|
|
1472
|
+
"usr": "s:SS"
|
|
1473
|
+
}
|
|
1474
|
+
],
|
|
1475
|
+
"usr": "s:Sq"
|
|
1476
|
+
}
|
|
1477
|
+
]
|
|
1478
|
+
}
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
],
|
|
1482
|
+
"declKind": "Func",
|
|
1483
|
+
"usr": "c:@M@DavoiceTTS@objc(cs)STT(im)pauseMicrophoneAndWait:completion:",
|
|
1484
|
+
"mangledName": "$s10DavoiceTTS3STTC22pauseMicrophoneAndWait_10completionySo8NSNumberC_ySb_SSSgtctF",
|
|
1485
|
+
"moduleName": "DavoiceTTS",
|
|
1486
|
+
"declAttributes": [
|
|
1487
|
+
"Final",
|
|
1488
|
+
"AccessControl",
|
|
1489
|
+
"ObjC",
|
|
1490
|
+
"RawDocComment"
|
|
1491
|
+
],
|
|
1492
|
+
"funcSelfKind": "NonMutating"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
"kind": "Function",
|
|
1496
|
+
"name": "unPauseMicrophoneAndWait",
|
|
1497
|
+
"printedName": "unPauseMicrophoneAndWait(_:completion:)",
|
|
1498
|
+
"children": [
|
|
1499
|
+
{
|
|
1500
|
+
"kind": "TypeNominal",
|
|
1501
|
+
"name": "Void",
|
|
1502
|
+
"printedName": "()"
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
"kind": "TypeNominal",
|
|
1506
|
+
"name": "NSNumber",
|
|
1507
|
+
"printedName": "Foundation.NSNumber",
|
|
1508
|
+
"usr": "c:objc(cs)NSNumber"
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
"kind": "TypeFunc",
|
|
1512
|
+
"name": "Function",
|
|
1513
|
+
"printedName": "(Swift.Bool, Swift.String?) -> ()",
|
|
1514
|
+
"children": [
|
|
1515
|
+
{
|
|
1516
|
+
"kind": "TypeNominal",
|
|
1517
|
+
"name": "Void",
|
|
1518
|
+
"printedName": "()"
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
"kind": "TypeNominal",
|
|
1522
|
+
"name": "Tuple",
|
|
1523
|
+
"printedName": "(Swift.Bool, Swift.String?)",
|
|
1524
|
+
"children": [
|
|
1525
|
+
{
|
|
1526
|
+
"kind": "TypeNominal",
|
|
1527
|
+
"name": "Bool",
|
|
1528
|
+
"printedName": "Swift.Bool",
|
|
1529
|
+
"usr": "s:Sb"
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
"kind": "TypeNominal",
|
|
1533
|
+
"name": "Optional",
|
|
1534
|
+
"printedName": "Swift.String?",
|
|
1535
|
+
"children": [
|
|
1536
|
+
{
|
|
1537
|
+
"kind": "TypeNominal",
|
|
1538
|
+
"name": "String",
|
|
1539
|
+
"printedName": "Swift.String",
|
|
1540
|
+
"usr": "s:SS"
|
|
1541
|
+
}
|
|
1542
|
+
],
|
|
1543
|
+
"usr": "s:Sq"
|
|
1544
|
+
}
|
|
1545
|
+
]
|
|
1546
|
+
}
|
|
1547
|
+
]
|
|
1548
|
+
}
|
|
1549
|
+
],
|
|
1550
|
+
"declKind": "Func",
|
|
1551
|
+
"usr": "c:@M@DavoiceTTS@objc(cs)STT(im)unPauseMicrophoneAndWait:completion:",
|
|
1552
|
+
"mangledName": "$s10DavoiceTTS3STTC24unPauseMicrophoneAndWait_10completionySo8NSNumberC_ySb_SSSgtctF",
|
|
1553
|
+
"moduleName": "DavoiceTTS",
|
|
1554
|
+
"declAttributes": [
|
|
1555
|
+
"Final",
|
|
1556
|
+
"AccessControl",
|
|
1557
|
+
"ObjC"
|
|
1558
|
+
],
|
|
1559
|
+
"funcSelfKind": "NonMutating"
|
|
1560
|
+
},
|
|
1426
1561
|
{
|
|
1427
1562
|
"kind": "Function",
|
|
1428
1563
|
"name": "pauseMicrophone",
|
|
@@ -4223,49 +4358,49 @@
|
|
|
4223
4358
|
{
|
|
4224
4359
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4225
4360
|
"kind": "IntegerLiteral",
|
|
4226
|
-
"offset":
|
|
4361
|
+
"offset": 14749,
|
|
4227
4362
|
"length": 1,
|
|
4228
4363
|
"value": "0"
|
|
4229
4364
|
},
|
|
4230
4365
|
{
|
|
4231
4366
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4232
4367
|
"kind": "BooleanLiteral",
|
|
4233
|
-
"offset":
|
|
4368
|
+
"offset": 14909,
|
|
4234
4369
|
"length": 5,
|
|
4235
4370
|
"value": "false"
|
|
4236
4371
|
},
|
|
4237
4372
|
{
|
|
4238
4373
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4239
4374
|
"kind": "BooleanLiteral",
|
|
4240
|
-
"offset":
|
|
4375
|
+
"offset": 16441,
|
|
4241
4376
|
"length": 4,
|
|
4242
4377
|
"value": "true"
|
|
4243
4378
|
},
|
|
4244
4379
|
{
|
|
4245
4380
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4246
4381
|
"kind": "IntegerLiteral",
|
|
4247
|
-
"offset":
|
|
4382
|
+
"offset": 17238,
|
|
4248
4383
|
"length": 1,
|
|
4249
4384
|
"value": "0"
|
|
4250
4385
|
},
|
|
4251
4386
|
{
|
|
4252
4387
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4253
4388
|
"kind": "BooleanLiteral",
|
|
4254
|
-
"offset":
|
|
4389
|
+
"offset": 26545,
|
|
4255
4390
|
"length": 4,
|
|
4256
4391
|
"value": "true"
|
|
4257
4392
|
},
|
|
4258
4393
|
{
|
|
4259
4394
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4260
4395
|
"kind": "BooleanLiteral",
|
|
4261
|
-
"offset":
|
|
4396
|
+
"offset": 45380,
|
|
4262
4397
|
"length": 5,
|
|
4263
4398
|
"value": "false"
|
|
4264
4399
|
},
|
|
4265
4400
|
{
|
|
4266
4401
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4267
4402
|
"kind": "FloatLiteral",
|
|
4268
|
-
"offset":
|
|
4403
|
+
"offset": 59870,
|
|
4269
4404
|
"length": 3,
|
|
4270
4405
|
"value": "0.7"
|
|
4271
4406
|
},
|
|
@@ -34,6 +34,8 @@ public enum AudioPlaybackHook {
|
|
|
34
34
|
@objc final public var continuous: Swift.Bool
|
|
35
35
|
@objc final public var aecEnabled: Swift.Bool
|
|
36
36
|
@objc public static let supportedEvents: [Swift.String]
|
|
37
|
+
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
38
|
+
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
37
39
|
@objc final public func pauseMicrophone()
|
|
38
40
|
@objc final public func unPauseMicrophone()
|
|
39
41
|
@objc final public func setAECEnabled(_ enabled: Swift.Bool)
|
|
@@ -34,6 +34,8 @@ public enum AudioPlaybackHook {
|
|
|
34
34
|
@objc final public var continuous: Swift.Bool
|
|
35
35
|
@objc final public var aecEnabled: Swift.Bool
|
|
36
36
|
@objc public static let supportedEvents: [Swift.String]
|
|
37
|
+
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
38
|
+
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
37
39
|
@objc final public func pauseMicrophone()
|
|
38
40
|
@objc final public func unPauseMicrophone()
|
|
39
41
|
@objc final public func setAECEnabled(_ enabled: Swift.Bool)
|
|
@@ -1423,6 +1423,141 @@
|
|
|
1423
1423
|
}
|
|
1424
1424
|
]
|
|
1425
1425
|
},
|
|
1426
|
+
{
|
|
1427
|
+
"kind": "Function",
|
|
1428
|
+
"name": "pauseMicrophoneAndWait",
|
|
1429
|
+
"printedName": "pauseMicrophoneAndWait(_:completion:)",
|
|
1430
|
+
"children": [
|
|
1431
|
+
{
|
|
1432
|
+
"kind": "TypeNominal",
|
|
1433
|
+
"name": "Void",
|
|
1434
|
+
"printedName": "()"
|
|
1435
|
+
},
|
|
1436
|
+
{
|
|
1437
|
+
"kind": "TypeNominal",
|
|
1438
|
+
"name": "NSNumber",
|
|
1439
|
+
"printedName": "Foundation.NSNumber",
|
|
1440
|
+
"usr": "c:objc(cs)NSNumber"
|
|
1441
|
+
},
|
|
1442
|
+
{
|
|
1443
|
+
"kind": "TypeFunc",
|
|
1444
|
+
"name": "Function",
|
|
1445
|
+
"printedName": "(Swift.Bool, Swift.String?) -> ()",
|
|
1446
|
+
"children": [
|
|
1447
|
+
{
|
|
1448
|
+
"kind": "TypeNominal",
|
|
1449
|
+
"name": "Void",
|
|
1450
|
+
"printedName": "()"
|
|
1451
|
+
},
|
|
1452
|
+
{
|
|
1453
|
+
"kind": "TypeNominal",
|
|
1454
|
+
"name": "Tuple",
|
|
1455
|
+
"printedName": "(Swift.Bool, Swift.String?)",
|
|
1456
|
+
"children": [
|
|
1457
|
+
{
|
|
1458
|
+
"kind": "TypeNominal",
|
|
1459
|
+
"name": "Bool",
|
|
1460
|
+
"printedName": "Swift.Bool",
|
|
1461
|
+
"usr": "s:Sb"
|
|
1462
|
+
},
|
|
1463
|
+
{
|
|
1464
|
+
"kind": "TypeNominal",
|
|
1465
|
+
"name": "Optional",
|
|
1466
|
+
"printedName": "Swift.String?",
|
|
1467
|
+
"children": [
|
|
1468
|
+
{
|
|
1469
|
+
"kind": "TypeNominal",
|
|
1470
|
+
"name": "String",
|
|
1471
|
+
"printedName": "Swift.String",
|
|
1472
|
+
"usr": "s:SS"
|
|
1473
|
+
}
|
|
1474
|
+
],
|
|
1475
|
+
"usr": "s:Sq"
|
|
1476
|
+
}
|
|
1477
|
+
]
|
|
1478
|
+
}
|
|
1479
|
+
]
|
|
1480
|
+
}
|
|
1481
|
+
],
|
|
1482
|
+
"declKind": "Func",
|
|
1483
|
+
"usr": "c:@M@DavoiceTTS@objc(cs)STT(im)pauseMicrophoneAndWait:completion:",
|
|
1484
|
+
"mangledName": "$s10DavoiceTTS3STTC22pauseMicrophoneAndWait_10completionySo8NSNumberC_ySb_SSSgtctF",
|
|
1485
|
+
"moduleName": "DavoiceTTS",
|
|
1486
|
+
"declAttributes": [
|
|
1487
|
+
"Final",
|
|
1488
|
+
"AccessControl",
|
|
1489
|
+
"ObjC",
|
|
1490
|
+
"RawDocComment"
|
|
1491
|
+
],
|
|
1492
|
+
"funcSelfKind": "NonMutating"
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
"kind": "Function",
|
|
1496
|
+
"name": "unPauseMicrophoneAndWait",
|
|
1497
|
+
"printedName": "unPauseMicrophoneAndWait(_:completion:)",
|
|
1498
|
+
"children": [
|
|
1499
|
+
{
|
|
1500
|
+
"kind": "TypeNominal",
|
|
1501
|
+
"name": "Void",
|
|
1502
|
+
"printedName": "()"
|
|
1503
|
+
},
|
|
1504
|
+
{
|
|
1505
|
+
"kind": "TypeNominal",
|
|
1506
|
+
"name": "NSNumber",
|
|
1507
|
+
"printedName": "Foundation.NSNumber",
|
|
1508
|
+
"usr": "c:objc(cs)NSNumber"
|
|
1509
|
+
},
|
|
1510
|
+
{
|
|
1511
|
+
"kind": "TypeFunc",
|
|
1512
|
+
"name": "Function",
|
|
1513
|
+
"printedName": "(Swift.Bool, Swift.String?) -> ()",
|
|
1514
|
+
"children": [
|
|
1515
|
+
{
|
|
1516
|
+
"kind": "TypeNominal",
|
|
1517
|
+
"name": "Void",
|
|
1518
|
+
"printedName": "()"
|
|
1519
|
+
},
|
|
1520
|
+
{
|
|
1521
|
+
"kind": "TypeNominal",
|
|
1522
|
+
"name": "Tuple",
|
|
1523
|
+
"printedName": "(Swift.Bool, Swift.String?)",
|
|
1524
|
+
"children": [
|
|
1525
|
+
{
|
|
1526
|
+
"kind": "TypeNominal",
|
|
1527
|
+
"name": "Bool",
|
|
1528
|
+
"printedName": "Swift.Bool",
|
|
1529
|
+
"usr": "s:Sb"
|
|
1530
|
+
},
|
|
1531
|
+
{
|
|
1532
|
+
"kind": "TypeNominal",
|
|
1533
|
+
"name": "Optional",
|
|
1534
|
+
"printedName": "Swift.String?",
|
|
1535
|
+
"children": [
|
|
1536
|
+
{
|
|
1537
|
+
"kind": "TypeNominal",
|
|
1538
|
+
"name": "String",
|
|
1539
|
+
"printedName": "Swift.String",
|
|
1540
|
+
"usr": "s:SS"
|
|
1541
|
+
}
|
|
1542
|
+
],
|
|
1543
|
+
"usr": "s:Sq"
|
|
1544
|
+
}
|
|
1545
|
+
]
|
|
1546
|
+
}
|
|
1547
|
+
]
|
|
1548
|
+
}
|
|
1549
|
+
],
|
|
1550
|
+
"declKind": "Func",
|
|
1551
|
+
"usr": "c:@M@DavoiceTTS@objc(cs)STT(im)unPauseMicrophoneAndWait:completion:",
|
|
1552
|
+
"mangledName": "$s10DavoiceTTS3STTC24unPauseMicrophoneAndWait_10completionySo8NSNumberC_ySb_SSSgtctF",
|
|
1553
|
+
"moduleName": "DavoiceTTS",
|
|
1554
|
+
"declAttributes": [
|
|
1555
|
+
"Final",
|
|
1556
|
+
"AccessControl",
|
|
1557
|
+
"ObjC"
|
|
1558
|
+
],
|
|
1559
|
+
"funcSelfKind": "NonMutating"
|
|
1560
|
+
},
|
|
1426
1561
|
{
|
|
1427
1562
|
"kind": "Function",
|
|
1428
1563
|
"name": "pauseMicrophone",
|
|
@@ -4223,49 +4358,49 @@
|
|
|
4223
4358
|
{
|
|
4224
4359
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4225
4360
|
"kind": "IntegerLiteral",
|
|
4226
|
-
"offset":
|
|
4361
|
+
"offset": 14749,
|
|
4227
4362
|
"length": 1,
|
|
4228
4363
|
"value": "0"
|
|
4229
4364
|
},
|
|
4230
4365
|
{
|
|
4231
4366
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4232
4367
|
"kind": "BooleanLiteral",
|
|
4233
|
-
"offset":
|
|
4368
|
+
"offset": 14909,
|
|
4234
4369
|
"length": 5,
|
|
4235
4370
|
"value": "false"
|
|
4236
4371
|
},
|
|
4237
4372
|
{
|
|
4238
4373
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4239
4374
|
"kind": "BooleanLiteral",
|
|
4240
|
-
"offset":
|
|
4375
|
+
"offset": 16441,
|
|
4241
4376
|
"length": 4,
|
|
4242
4377
|
"value": "true"
|
|
4243
4378
|
},
|
|
4244
4379
|
{
|
|
4245
4380
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4246
4381
|
"kind": "IntegerLiteral",
|
|
4247
|
-
"offset":
|
|
4382
|
+
"offset": 17238,
|
|
4248
4383
|
"length": 1,
|
|
4249
4384
|
"value": "0"
|
|
4250
4385
|
},
|
|
4251
4386
|
{
|
|
4252
4387
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4253
4388
|
"kind": "BooleanLiteral",
|
|
4254
|
-
"offset":
|
|
4389
|
+
"offset": 26545,
|
|
4255
4390
|
"length": 4,
|
|
4256
4391
|
"value": "true"
|
|
4257
4392
|
},
|
|
4258
4393
|
{
|
|
4259
4394
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4260
4395
|
"kind": "BooleanLiteral",
|
|
4261
|
-
"offset":
|
|
4396
|
+
"offset": 45380,
|
|
4262
4397
|
"length": 5,
|
|
4263
4398
|
"value": "false"
|
|
4264
4399
|
},
|
|
4265
4400
|
{
|
|
4266
4401
|
"filePath": "\/Volumes\/T9\/projects\/DavoiceTTSPrivate\/Sources\/DaVoiceSTT.swift",
|
|
4267
4402
|
"kind": "FloatLiteral",
|
|
4268
|
-
"offset":
|
|
4403
|
+
"offset": 59870,
|
|
4269
4404
|
"length": 3,
|
|
4270
4405
|
"value": "0.7"
|
|
4271
4406
|
},
|
|
@@ -34,6 +34,8 @@ public enum AudioPlaybackHook {
|
|
|
34
34
|
@objc final public var continuous: Swift.Bool
|
|
35
35
|
@objc final public var aecEnabled: Swift.Bool
|
|
36
36
|
@objc public static let supportedEvents: [Swift.String]
|
|
37
|
+
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
38
|
+
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
37
39
|
@objc final public func pauseMicrophone()
|
|
38
40
|
@objc final public func unPauseMicrophone()
|
|
39
41
|
@objc final public func setAECEnabled(_ enabled: Swift.Bool)
|
|
@@ -34,6 +34,8 @@ public enum AudioPlaybackHook {
|
|
|
34
34
|
@objc final public var continuous: Swift.Bool
|
|
35
35
|
@objc final public var aecEnabled: Swift.Bool
|
|
36
36
|
@objc public static let supportedEvents: [Swift.String]
|
|
37
|
+
@objc final public func pauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
38
|
+
@objc final public func unPauseMicrophoneAndWait(_ timeoutMs: Foundation.NSNumber, completion: @escaping (Swift.Bool, Swift.String?) -> Swift.Void)
|
|
37
39
|
@objc final public func pauseMicrophone()
|
|
38
40
|
@objc final public func unPauseMicrophone()
|
|
39
41
|
@objc final public func setAECEnabled(_ enabled: Swift.Bool)
|
|
Binary file
|
|
Binary file
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<dict>
|
|
7
7
|
<key>Headers/DavoiceTTS-Swift.h</key>
|
|
8
8
|
<data>
|
|
9
|
-
|
|
9
|
+
vgul7Uo5jdjZJrmsj5QJXgOQR0Y=
|
|
10
10
|
</data>
|
|
11
11
|
<key>Info.plist</key>
|
|
12
12
|
<data>
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
</data>
|
|
15
15
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
|
|
16
16
|
<data>
|
|
17
|
-
|
|
17
|
+
pl0/I0fTwjgInd3o8lQY3oiF8qY=
|
|
18
18
|
</data>
|
|
19
19
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
|
|
20
20
|
<data>
|
|
21
|
-
|
|
21
|
+
4O+ZELfFqgN6Wieq1IiRQfAtoN4=
|
|
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
|
-
|
|
29
|
+
4O+ZELfFqgN6Wieq1IiRQfAtoN4=
|
|
30
30
|
</data>
|
|
31
31
|
<key>Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
|
|
32
32
|
<data>
|
|
33
|
-
|
|
33
|
+
p8Tye5WOUNf8BwTNJtr50lW5DXo=
|
|
34
34
|
</data>
|
|
35
35
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
|
|
36
36
|
<data>
|
|
37
|
-
|
|
37
|
+
pl0/I0fTwjgInd3o8lQY3oiF8qY=
|
|
38
38
|
</data>
|
|
39
39
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
|
|
40
40
|
<data>
|
|
41
|
-
|
|
41
|
+
1Vb2U866a0w0XTRJKjUPBKyutls=
|
|
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
|
-
|
|
49
|
+
1Vb2U866a0w0XTRJKjUPBKyutls=
|
|
50
50
|
</data>
|
|
51
51
|
<key>Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
|
|
52
52
|
<data>
|
|
53
|
-
|
|
53
|
+
kPqRg7okrMhKWL9REJ3ZcWd6yY0=
|
|
54
54
|
</data>
|
|
55
55
|
<key>Modules/module.modulemap</key>
|
|
56
56
|
<data>
|
|
@@ -63,33 +63,33 @@
|
|
|
63
63
|
<dict>
|
|
64
64
|
<key>hash</key>
|
|
65
65
|
<data>
|
|
66
|
-
|
|
66
|
+
vgul7Uo5jdjZJrmsj5QJXgOQR0Y=
|
|
67
67
|
</data>
|
|
68
68
|
<key>hash2</key>
|
|
69
69
|
<data>
|
|
70
|
-
|
|
70
|
+
IiNhallKyMzCJhm/+IYaIIVxx7OUg3USEKNJkaFT6wc=
|
|
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
|
+
pl0/I0fTwjgInd3o8lQY3oiF8qY=
|
|
78
78
|
</data>
|
|
79
79
|
<key>hash2</key>
|
|
80
80
|
<data>
|
|
81
|
-
|
|
81
|
+
P1GBd+pLv625GA0UXIYec4OzZ+VqlHHXS3Bmb1OIX/U=
|
|
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
|
-
|
|
88
|
+
4O+ZELfFqgN6Wieq1IiRQfAtoN4=
|
|
89
89
|
</data>
|
|
90
90
|
<key>hash2</key>
|
|
91
91
|
<data>
|
|
92
|
-
|
|
92
|
+
m6+AXAvSKhaIawhOn0Oa+LfqZr0mwnH+e49WljlXBDQ=
|
|
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
|
-
|
|
110
|
+
4O+ZELfFqgN6Wieq1IiRQfAtoN4=
|
|
111
111
|
</data>
|
|
112
112
|
<key>hash2</key>
|
|
113
113
|
<data>
|
|
114
|
-
|
|
114
|
+
m6+AXAvSKhaIawhOn0Oa+LfqZr0mwnH+e49WljlXBDQ=
|
|
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
|
-
|
|
121
|
+
p8Tye5WOUNf8BwTNJtr50lW5DXo=
|
|
122
122
|
</data>
|
|
123
123
|
<key>hash2</key>
|
|
124
124
|
<data>
|
|
125
|
-
|
|
125
|
+
EYvRg97ehw2g2BfyOnAThJMSm8BVlhg7nQaPZh97/kY=
|
|
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
|
-
|
|
132
|
+
pl0/I0fTwjgInd3o8lQY3oiF8qY=
|
|
133
133
|
</data>
|
|
134
134
|
<key>hash2</key>
|
|
135
135
|
<data>
|
|
136
|
-
|
|
136
|
+
P1GBd+pLv625GA0UXIYec4OzZ+VqlHHXS3Bmb1OIX/U=
|
|
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
|
-
|
|
143
|
+
1Vb2U866a0w0XTRJKjUPBKyutls=
|
|
144
144
|
</data>
|
|
145
145
|
<key>hash2</key>
|
|
146
146
|
<data>
|
|
147
|
-
|
|
147
|
+
xnT9sHQ+AlnAVwienpdc3CibbdtRRl60kSp3a3bXvKw=
|
|
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
|
-
|
|
165
|
+
1Vb2U866a0w0XTRJKjUPBKyutls=
|
|
166
166
|
</data>
|
|
167
167
|
<key>hash2</key>
|
|
168
168
|
<data>
|
|
169
|
-
|
|
169
|
+
xnT9sHQ+AlnAVwienpdc3CibbdtRRl60kSp3a3bXvKw=
|
|
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
|
-
|
|
176
|
+
kPqRg7okrMhKWL9REJ3ZcWd6yY0=
|
|
177
177
|
</data>
|
|
178
178
|
<key>hash2</key>
|
|
179
179
|
<data>
|
|
180
|
-
|
|
180
|
+
pYy++lFgpVUbdIF7GeybSfFxxMk8z7QLMflxejA9h64=
|
|
181
181
|
</data>
|
|
182
182
|
</dict>
|
|
183
183
|
<key>Modules/module.modulemap</key>
|
package/package.json
CHANGED
package/speech/index.ts
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
2
2
|
import { NativeModules, NativeEventEmitter, DeviceEventEmitter, Platform } from 'react-native';
|
|
3
3
|
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
|
|
4
4
|
|
|
5
|
+
// -------------------- VERBOSE LOGGING --------------------
|
|
6
|
+
const VERBOSE = true;
|
|
7
|
+
const PFX = '[SpeechJS]';
|
|
8
|
+
function ts() {
|
|
9
|
+
const d = new Date();
|
|
10
|
+
return `${d.toISOString()}`;
|
|
11
|
+
}
|
|
12
|
+
function dbg(...args: any[]) {
|
|
13
|
+
if (!VERBOSE) return;
|
|
14
|
+
// eslint-disable-next-line no-console
|
|
15
|
+
console.log(ts(), PFX, ...args);
|
|
16
|
+
}
|
|
17
|
+
function dbgErr(...args: any[]) {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.log(ts(), PFX, '❌', ...args);
|
|
20
|
+
}
|
|
21
|
+
function safeJson(x: any) {
|
|
22
|
+
try {
|
|
23
|
+
return JSON.stringify(x);
|
|
24
|
+
} catch {
|
|
25
|
+
return String(x);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
5
29
|
// If you use typed-array -> base64, Buffer is convenient (works in RN)
|
|
6
30
|
let toBase64: (u8: Uint8Array) => string;
|
|
7
31
|
try {
|
|
@@ -22,6 +46,12 @@ const NativeSTT =
|
|
|
22
46
|
NativeModules.RCTVoice;
|
|
23
47
|
const NativeTTS = NativeModules.DaVoiceTTSBridge;
|
|
24
48
|
|
|
49
|
+
// Print what we actually have at module load
|
|
50
|
+
dbg('Platform=', Platform.OS);
|
|
51
|
+
dbg('NativeSpeech (SpeechBridge) exists?', !!NativeSpeech, 'keys=', NativeSpeech ? Object.keys(NativeSpeech) : null);
|
|
52
|
+
dbg('NativeSTT exists?', !!NativeSTT, 'keys=', NativeSTT ? Object.keys(NativeSTT) : null);
|
|
53
|
+
dbg('NativeTTS (DaVoiceTTSBridge) exists?', !!NativeTTS, 'keys=', NativeTTS ? Object.keys(NativeTTS) : null);
|
|
54
|
+
|
|
25
55
|
// ---- Types ----
|
|
26
56
|
export type SpeechStartEvent = {};
|
|
27
57
|
export type SpeechEndEvent = {};
|
|
@@ -78,6 +108,47 @@ export type ExternalPCM = {
|
|
|
78
108
|
};
|
|
79
109
|
|
|
80
110
|
class Speech {
|
|
111
|
+
// ---- MIN: serialize TTS + wait-for-finished ----
|
|
112
|
+
private ttsChain: Promise<void> = Promise.resolve();
|
|
113
|
+
private ttsPendingResolve: (() => void) | null = null;
|
|
114
|
+
private ttsPendingTimeout: any = null;
|
|
115
|
+
|
|
116
|
+
private _onNativeFinishedSpeaking() {
|
|
117
|
+
dbg('[EVENT onFinishedSpeaking]');
|
|
118
|
+
// 1) let app callback run
|
|
119
|
+
try { this.handlers.onFinishedSpeaking(); } catch (e) { dbgErr('onFinishedSpeaking handler error', String(e)); }
|
|
120
|
+
|
|
121
|
+
// 2) resolve the internal await (if any)
|
|
122
|
+
if (this.ttsPendingTimeout) { clearTimeout(this.ttsPendingTimeout); this.ttsPendingTimeout = null; }
|
|
123
|
+
const r = this.ttsPendingResolve;
|
|
124
|
+
this.ttsPendingResolve = null;
|
|
125
|
+
if (r) r();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
private _nativeSpeak(text: string, speakerId: number, s: number) {
|
|
129
|
+
if (Platform.OS === 'ios' && NativeSpeech?.speak) return (NativeSpeech as any).speak(text, speakerId, s);
|
|
130
|
+
if (!NativeTTS?.speak) throw new Error('TTS speak not available');
|
|
131
|
+
return (NativeTTS as any).speak(text, speakerId, s);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
private _speakAndWait(text: string, speakerId: number, s: number, timeoutMs = 60000) {
|
|
135
|
+
return new Promise<void>((resolve, reject) => {
|
|
136
|
+
this.ttsPendingResolve = resolve;
|
|
137
|
+
// safety: never hang forever
|
|
138
|
+
this.ttsPendingTimeout = setTimeout(() => {
|
|
139
|
+
this.ttsPendingResolve = null;
|
|
140
|
+
reject(new Error('TTS timeout waiting for onFinishedSpeaking'));
|
|
141
|
+
}, timeoutMs);
|
|
142
|
+
try {
|
|
143
|
+
this._nativeSpeak(text, speakerId, s);
|
|
144
|
+
} catch (e) {
|
|
145
|
+
if (this.ttsPendingTimeout) { clearTimeout(this.ttsPendingTimeout); this.ttsPendingTimeout = null; }
|
|
146
|
+
this.ttsPendingResolve = null;
|
|
147
|
+
reject(e as any);
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
81
152
|
private sttEmitter: NativeEventEmitter | null = null;
|
|
82
153
|
private ttsEmitter: NativeEventEmitter | typeof DeviceEventEmitter | null = null;
|
|
83
154
|
private unifiedEmitter: NativeEventEmitter | null = null;
|
|
@@ -88,6 +159,11 @@ class Speech {
|
|
|
88
159
|
private lastModel: string | null = null;
|
|
89
160
|
private iosTtsOnly = false; // when true, use NativeTTS directly on iOS
|
|
90
161
|
|
|
162
|
+
|
|
163
|
+
private logCall(name: string, payload?: any) {
|
|
164
|
+
dbg(`[CALL ${name}]`, payload !== undefined ? safeJson(payload) : '');
|
|
165
|
+
}
|
|
166
|
+
|
|
91
167
|
// ✅ NEW: resolve require() assets to a usable URI/path string
|
|
92
168
|
private resolveModelToPath(model: ModelRef): string {
|
|
93
169
|
// ✅ Backward compatible: plain strings are passed through unchanged
|
|
@@ -95,6 +171,8 @@ class Speech {
|
|
|
95
171
|
|
|
96
172
|
try {
|
|
97
173
|
const asset = resolveAssetSource(model);
|
|
174
|
+
dbg('[resolveModelToPath] resolveAssetSource ->', asset);
|
|
175
|
+
|
|
98
176
|
const uri = asset?.uri;
|
|
99
177
|
if (uri) return String(uri);
|
|
100
178
|
} catch {
|
|
@@ -120,15 +198,23 @@ class Speech {
|
|
|
120
198
|
if (Platform.OS !== 'web') {
|
|
121
199
|
if (Platform.OS === 'ios' && NativeSpeech) {
|
|
122
200
|
this.unifiedEmitter = new NativeEventEmitter(NativeSpeech);
|
|
201
|
+
dbg('[constructor] iOS unifiedEmitter created');
|
|
123
202
|
} else {
|
|
124
203
|
// Android (and iOS fallback): separate modules
|
|
125
|
-
if (NativeSTT)
|
|
204
|
+
if (NativeSTT) {
|
|
205
|
+
this.sttEmitter = new NativeEventEmitter(NativeSTT);
|
|
206
|
+
dbg('[constructor] sttEmitter created');
|
|
207
|
+
}
|
|
126
208
|
// ANDROID: Native module emits through DeviceEventEmitter
|
|
127
209
|
if (Platform.OS === 'android') {
|
|
128
210
|
this.ttsEmitter = DeviceEventEmitter;
|
|
211
|
+
dbg('[constructor] android ttsEmitter=DeviceEventEmitter');
|
|
129
212
|
} else {
|
|
130
213
|
// non-unified iOS fallback (if ever used)
|
|
131
|
-
if (NativeTTS)
|
|
214
|
+
if (NativeTTS) {
|
|
215
|
+
this.ttsEmitter = new NativeEventEmitter(NativeTTS);
|
|
216
|
+
dbg('[constructor] iOS fallback ttsEmitter created');
|
|
217
|
+
}
|
|
132
218
|
}
|
|
133
219
|
}
|
|
134
220
|
}
|
|
@@ -322,6 +408,21 @@ class Speech {
|
|
|
322
408
|
|
|
323
409
|
/** Pause mic/STT (Android native; iOS unified if present) */
|
|
324
410
|
async pauseMicrophone(): Promise<void> {
|
|
411
|
+
console.log('[pauseMicrophone] called');
|
|
412
|
+
this.logCall('pauseMicrophone');
|
|
413
|
+
// iOS: prefer async first, fallback to callback if missing
|
|
414
|
+
if (Platform.OS === 'ios' && (NativeSpeech as any)?.pauseMicrophoneAsync) {
|
|
415
|
+
dbg('IOS [pauseMicrophone] using NativeSpeech.pauseMicrophoneAsync()');
|
|
416
|
+
try {
|
|
417
|
+
const r = await (NativeSpeech as any).pauseMicrophoneAsync(1000);
|
|
418
|
+
dbg('pauseMicrophoneAsync result', r);
|
|
419
|
+
if (r?.ok === false) dbgErr('pauseMicrophoneAsync failed', r?.reason);
|
|
420
|
+
return;
|
|
421
|
+
} catch (e) {
|
|
422
|
+
dbgErr('IOS [pauseMicrophone] NativeSpeech.pauseMicrophoneAsync() ERROR:', String(e));
|
|
423
|
+
throw e;
|
|
424
|
+
}
|
|
425
|
+
}
|
|
325
426
|
if (Platform.OS === 'ios' && NativeSpeech?.pauseMicrophone) {
|
|
326
427
|
console.log('IOS [pauseMicrophone] called');
|
|
327
428
|
return new Promise((resolve, reject) => {
|
|
@@ -329,7 +430,6 @@ class Speech {
|
|
|
329
430
|
catch (e) { reject(e as any); }
|
|
330
431
|
});
|
|
331
432
|
}
|
|
332
|
-
console.log('[pauseMicrophone] called');
|
|
333
433
|
if (!(NativeSTT as any)?.pauseMicrophone) return Promise.resolve();
|
|
334
434
|
return new Promise((resolve, reject) => {
|
|
335
435
|
try { (NativeSTT as any).pauseMicrophone(() => resolve()); }
|
|
@@ -339,6 +439,21 @@ class Speech {
|
|
|
339
439
|
|
|
340
440
|
/** Resume mic/STT (Android native; iOS unified if present) */
|
|
341
441
|
async unPauseMicrophone(): Promise<void> {
|
|
442
|
+
this.logCall('unPauseMicrophone');
|
|
443
|
+
// iOS: prefer async first, fallback to callback if missing
|
|
444
|
+
if (Platform.OS === 'ios' && (NativeSpeech as any)?.unPauseMicrophoneAsync) {
|
|
445
|
+
dbg('IOS [unPauseMicrophone] using NativeSpeech.unPauseMicrophoneAsync()');
|
|
446
|
+
try {
|
|
447
|
+
const r = await (NativeSpeech as any).unPauseMicrophoneAsync(1000);
|
|
448
|
+
if (r?.ok === false) dbgErr('pauseMicrophoneAsync failed', r?.reason);
|
|
449
|
+
dbg('IOS [unPauseMicrophone] NativeSpeech.unPauseMicrophoneAsync() DONE');
|
|
450
|
+
return;
|
|
451
|
+
} catch (e) {
|
|
452
|
+
dbgErr('IOS [unPauseMicrophone] NativeSpeech.unPauseMicrophoneAsync() ERROR:', String(e));
|
|
453
|
+
throw e;
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
|
|
342
457
|
if (Platform.OS === 'ios' && NativeSpeech?.unPauseMicrophone) {
|
|
343
458
|
console.log('IOS [unPauseMicrophone] called');
|
|
344
459
|
return new Promise((resolve, reject) => {
|
|
@@ -422,17 +537,10 @@ class Speech {
|
|
|
422
537
|
// sanitize and invert (avoid NaN/undefined/null)
|
|
423
538
|
// Reverse speed to length.
|
|
424
539
|
const s = Number.isFinite(speed as number) && speed !== 0 ? 1.0 / (speed as number) : 1.0;
|
|
425
|
-
|
|
426
|
-
//
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
return (NativeSpeech as any).speak(text, speakerId, s);
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
if (!NativeTTS?.speak) throw new Error('TTS speak not available');
|
|
433
|
-
|
|
434
|
-
// ✅ always call native with 3 args (text, speakerId, speed)
|
|
435
|
-
return (NativeTTS as any).speak(text, speakerId, s);
|
|
540
|
+
this.ensureListeners();
|
|
541
|
+
// MIN: serialize + await actual completion (event-driven)
|
|
542
|
+
this.ttsChain = this.ttsChain.then(() => this._speakAndWait(text, speakerId, s));
|
|
543
|
+
return this.ttsChain;
|
|
436
544
|
}
|
|
437
545
|
|
|
438
546
|
async stopSpeaking() {
|
|
@@ -572,7 +680,7 @@ class Speech {
|
|
|
572
680
|
onSpeechResults: (e) => this.handlers.onSpeechResults(e),
|
|
573
681
|
onSpeechPartialResults: (e) => this.handlers.onSpeechPartialResults(e),
|
|
574
682
|
onSpeechVolumeChanged: (e) => this.handlers.onSpeechVolumeChanged(e),
|
|
575
|
-
onFinishedSpeaking: () => this.
|
|
683
|
+
onFinishedSpeaking: () => this._onNativeFinishedSpeaking(),
|
|
576
684
|
};
|
|
577
685
|
(Object.keys(map) as NativeEventName[]).forEach((name) => {
|
|
578
686
|
try {
|
|
@@ -604,9 +712,11 @@ class Speech {
|
|
|
604
712
|
}
|
|
605
713
|
if (this.ttsEmitter) {
|
|
606
714
|
try {
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
);
|
|
715
|
+
// MIN: prevent duplicate listeners across Fast Refresh / reload
|
|
716
|
+
const g: any = globalThis as any;
|
|
717
|
+
try { g.__SpeechJS_finishedSub?.remove?.(); } catch {}
|
|
718
|
+
const sub = this.ttsEmitter.addListener('onFinishedSpeaking', () => this._onNativeFinishedSpeaking());
|
|
719
|
+
g.__SpeechJS_finishedSub = sub;
|
|
610
720
|
this.subs.push(sub);
|
|
611
721
|
} catch {}
|
|
612
722
|
}
|