react-native-davoice 1.0.4

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 (67) hide show
  1. package/README.md +319 -0
  2. package/TTSRNBridge.podspec +38 -0
  3. package/android/.gradle/8.9/checksums/checksums.lock +0 -0
  4. package/android/.gradle/8.9/dependencies-accessors/gc.properties +0 -0
  5. package/android/.gradle/8.9/fileChanges/last-build.bin +0 -0
  6. package/android/.gradle/8.9/fileHashes/fileHashes.lock +0 -0
  7. package/android/.gradle/8.9/gc.properties +0 -0
  8. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  9. package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
  10. package/android/.gradle/vcs-1/gc.properties +0 -0
  11. package/android/build.gradle +47 -0
  12. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar +0 -0
  13. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.md5 +1 -0
  14. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.aar.sha1 +1 -0
  15. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.pom +38 -0
  16. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.pom.md5 +1 -0
  17. package/android/libs/com/davoice/tts/1.0.0/tts-1.0.0.pom.sha1 +1 -0
  18. package/android/settings.gradle +2 -0
  19. package/android/src/main/AndroidManifest.xml +14 -0
  20. package/android/src/main/java/com/davoice/rn/DaVoicePackage.java +29 -0
  21. package/android/src/main/java/com/davoice/stt/rn/STTModule.kt +208 -0
  22. package/android/src/main/java/com/davoice/tts/rn/DaVoiceTTSBridge.java +733 -0
  23. package/android/src/main/libs/MyLibrary-release.aar +0 -0
  24. package/app.plugin.js +60 -0
  25. package/ios/STTRNBridge/STTBridge.h +7 -0
  26. package/ios/STTRNBridge/STTBridge.m +130 -0
  27. package/ios/SpeechBridge/SpeechBridge.h +7 -0
  28. package/ios/SpeechBridge/SpeechBridge.m +761 -0
  29. package/ios/TTSRNBridge/DaVoiceTTSBridge.h +7 -0
  30. package/ios/TTSRNBridge/DaVoiceTTSBridge.m +177 -0
  31. package/ios/TTSRNBridge/DavoiceTTS.xcframework/Info.plist +44 -0
  32. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/DavoiceTTS +0 -0
  33. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +424 -0
  34. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Info.plist +0 -0
  35. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.abi.json +13253 -0
  36. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.private.swiftinterface +213 -0
  37. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  38. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios.swiftinterface +213 -0
  39. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64/DavoiceTTS.framework/Modules/module.modulemap +4 -0
  40. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/DavoiceTTS +0 -0
  41. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Headers/DavoiceTTS-Swift.h +844 -0
  42. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Info.plist +0 -0
  43. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.abi.json +13253 -0
  44. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +213 -0
  45. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  46. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/arm64-apple-ios-simulator.swiftinterface +213 -0
  47. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.abi.json +13253 -0
  48. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +213 -0
  49. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  50. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/DavoiceTTS.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +213 -0
  51. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/Modules/module.modulemap +4 -0
  52. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeDirectory +0 -0
  53. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements +0 -0
  54. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeRequirements-1 +0 -0
  55. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeResources +282 -0
  56. package/ios/TTSRNBridge/DavoiceTTS.xcframework/ios-arm64_x86_64-simulator/DavoiceTTS.framework/_CodeSignature/CodeSignature +0 -0
  57. package/ios/TTSRNBridge/libphonemes.a +0 -0
  58. package/ios/TTSRNBridge/libucd.a +0 -0
  59. package/package.json +46 -0
  60. package/react-native.config.js +10 -0
  61. package/speech/index.ts +1055 -0
  62. package/stt/index.d.ts +54 -0
  63. package/stt/index.ts +222 -0
  64. package/tts/DaVoiceTTSBridge.d.ts +18 -0
  65. package/tts/DaVoiceTTSBridge.js +71 -0
  66. package/tts/index.d.ts +3 -0
  67. package/tts/index.js +4 -0
@@ -0,0 +1,7 @@
1
+ #import <React/RCTBridgeModule.h>
2
+ #import <React/RCTEventEmitter.h>
3
+
4
+ #import <DaVoiceTTS/DaVoiceTTS-Swift.h>
5
+
6
+ @interface DaVoiceTTSBridge : RCTEventEmitter <RCTBridgeModule>
7
+ @end
@@ -0,0 +1,177 @@
1
+ // DaVoiceTTSBridge.m
2
+ #import "DaVoiceTTSBridge.h"
3
+ #import <React/RCTLog.h>
4
+ #import <React/RCTConvert.h>
5
+
6
+ @interface DaVoiceTTSBridge()
7
+ @property (nonatomic, strong, nullable) DaVoiceTTS *ttsInstance;
8
+ @property (nonatomic, assign) BOOL hasListeners;
9
+ @end
10
+
11
+ @implementation DaVoiceTTSBridge
12
+
13
+ RCT_EXPORT_MODULE();
14
+
15
+ + (BOOL)requiresMainQueueSetup {
16
+ RCTLogInfo(@"[DaVoiceTTSBridge] requiresMainQueueSetup called (module loaded).");
17
+ NSLog(@"[DaVoiceTTSBridge] requiresMainQueueSetup called (module loaded).");
18
+
19
+ return YES;
20
+ }
21
+
22
+ #pragma mark - RCTEventEmitter
23
+
24
+ - (NSArray<NSString *> *)supportedEvents
25
+ {
26
+ // Single event exposed to JS.
27
+ return @[@"onFinishedSpeaking"];
28
+ }
29
+
30
+ - (void)startObserving
31
+ {
32
+ self.hasListeners = YES;
33
+ }
34
+
35
+ - (void)stopObserving
36
+ {
37
+ self.hasListeners = NO;
38
+ }
39
+
40
+ - (void)dealloc
41
+ {
42
+ if (_ttsInstance) {
43
+ [_ttsInstance destroy];
44
+ _ttsInstance = nil;
45
+ }
46
+ }
47
+
48
+ #pragma mark - API
49
+
50
+ - (instancetype)init {
51
+ self = [super init];
52
+ if (self) {
53
+ RCTLogInfo(@"[DaVoiceTTSBridge] init called.");
54
+ NSLog(@"[DaVoiceTTSBridge] init called.");
55
+ }
56
+ return self;
57
+ }
58
+
59
+ RCT_EXPORT_METHOD(setLicense:(NSString *)licenseKey
60
+ resolver:(RCTPromiseResolveBlock)resolve
61
+ rejecter:(RCTPromiseRejectBlock)reject)
62
+ {
63
+ if (licenseKey == nil || (id)licenseKey == [NSNull null] || licenseKey.length == 0) {
64
+ reject(@"invalid_args", @"Missing licenseKey", nil);
65
+ return;
66
+ }
67
+
68
+ dispatch_async(dispatch_get_main_queue(), ^{
69
+ BOOL ok = [DaVoiceTTS activateLicenseWithLicenseKey:licenseKey];
70
+ resolve(@(ok));
71
+ });
72
+ }
73
+
74
+ RCT_EXPORT_METHOD(isLicenseValid:(NSString *)licenseKey
75
+ resolver:(RCTPromiseResolveBlock)resolve
76
+ rejecter:(RCTPromiseRejectBlock)reject)
77
+ {
78
+ if (licenseKey == nil || (id)licenseKey == [NSNull null] || licenseKey.length == 0) {
79
+ reject(@"invalid_args", @"Missing licenseKey", nil);
80
+ return;
81
+ }
82
+
83
+ dispatch_async(dispatch_get_main_queue(), ^{
84
+ BOOL ok = [LicenseManager isLicenseValidWithLicenseKey:licenseKey];
85
+ resolve(@(ok));
86
+ });
87
+ }
88
+
89
+ RCT_EXPORT_METHOD(initTTS:(NSDictionary *)configDict
90
+ resolver:(RCTPromiseResolveBlock)resolve
91
+ rejecter:(RCTPromiseRejectBlock)reject)
92
+ {
93
+ RCTLogInfo(@"[DaVoiceTTSBridge] initTTS called with configDict: %@", configDict);
94
+ NSLog(@"[DaVoiceTTSBridge] initTTS called with configDict: %@", configDict);
95
+ NSString *modelPath = configDict[@"model"];
96
+
97
+ if (!modelPath) {
98
+ reject(@"invalid_config", @"Missing required 'model' key", nil);
99
+ return;
100
+ }
101
+
102
+ NSURL *modelURL = [NSURL fileURLWithPath:modelPath];
103
+
104
+ NSError *error = nil;
105
+ // Ensure we touch AVAudio/ORT from main.
106
+ dispatch_async(dispatch_get_main_queue(), ^{
107
+ NSError *error = nil;
108
+ self.ttsInstance = [[DaVoiceTTS alloc] initWithModel:modelURL error:&error];
109
+ if (error || !self.ttsInstance) {
110
+ reject(@"init_failed", error.localizedDescription ?: @"Failed to initialize", error);
111
+ return;
112
+ }
113
+
114
+ __weak typeof(self) weakSelf = self;
115
+ // Bridge Swift callback -> RN event
116
+ self.ttsInstance.onLastUtteranceFinished = ^{
117
+ __strong typeof(weakSelf) strongSelf = weakSelf;
118
+ if (!strongSelf) return;
119
+ if (!strongSelf.hasListeners) return;
120
+
121
+ // Send on main just to be extra safe for JS listeners doing UI work.
122
+ dispatch_async(dispatch_get_main_queue(), ^{
123
+ [strongSelf sendEventWithName:@"onFinishedSpeaking" body:@{}];
124
+ });
125
+ };
126
+
127
+ resolve(@"TTS initialized");
128
+ });
129
+ }
130
+
131
+ RCT_EXPORT_METHOD(speak:(NSString *)text
132
+ speakerId:(nonnull NSNumber *)speakerId
133
+ resolver:(RCTPromiseResolveBlock)resolve
134
+ rejecter:(RCTPromiseRejectBlock)reject)
135
+ {
136
+ if (!self.ttsInstance) {
137
+ reject(@"no_instance", @"TTS not initialized", nil);
138
+ return;
139
+ }
140
+
141
+ dispatch_async(dispatch_get_main_queue(), ^{
142
+ [self.ttsInstance speak:text sid:speakerId.intValue];
143
+ resolve(@"Speaking");
144
+ });
145
+ }
146
+
147
+ RCT_EXPORT_METHOD(stopSpeaking:(RCTPromiseResolveBlock)resolve
148
+ rejecter:(RCTPromiseRejectBlock)reject)
149
+ {
150
+ if (!self.ttsInstance) {
151
+ reject(@"no_instance", @"TTS not initialized", nil);
152
+ return;
153
+ }
154
+
155
+ dispatch_async(dispatch_get_main_queue(), ^{
156
+ [self.ttsInstance stopSpeaking];
157
+ resolve(@"Stopped");
158
+ });
159
+ }
160
+
161
+ RCT_EXPORT_METHOD(destroy:(RCTPromiseResolveBlock)resolve
162
+ rejecter:(RCTPromiseRejectBlock)reject)
163
+ {
164
+ if (!self.ttsInstance) {
165
+ // Idempotent: resolve anyway.
166
+ resolve(@"Already destroyed");
167
+ return;
168
+ }
169
+
170
+ dispatch_async(dispatch_get_main_queue(), ^{
171
+ [self.ttsInstance destroy];
172
+ self.ttsInstance = nil;
173
+ resolve(@"Destroyed");
174
+ });
175
+ }
176
+
177
+ @end
@@ -0,0 +1,44 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>AvailableLibraries</key>
6
+ <array>
7
+ <dict>
8
+ <key>BinaryPath</key>
9
+ <string>DavoiceTTS.framework/DavoiceTTS</string>
10
+ <key>LibraryIdentifier</key>
11
+ <string>ios-arm64_x86_64-simulator</string>
12
+ <key>LibraryPath</key>
13
+ <string>DavoiceTTS.framework</string>
14
+ <key>SupportedArchitectures</key>
15
+ <array>
16
+ <string>arm64</string>
17
+ <string>x86_64</string>
18
+ </array>
19
+ <key>SupportedPlatform</key>
20
+ <string>ios</string>
21
+ <key>SupportedPlatformVariant</key>
22
+ <string>simulator</string>
23
+ </dict>
24
+ <dict>
25
+ <key>BinaryPath</key>
26
+ <string>DavoiceTTS.framework/DavoiceTTS</string>
27
+ <key>LibraryIdentifier</key>
28
+ <string>ios-arm64</string>
29
+ <key>LibraryPath</key>
30
+ <string>DavoiceTTS.framework</string>
31
+ <key>SupportedArchitectures</key>
32
+ <array>
33
+ <string>arm64</string>
34
+ </array>
35
+ <key>SupportedPlatform</key>
36
+ <string>ios</string>
37
+ </dict>
38
+ </array>
39
+ <key>CFBundlePackageType</key>
40
+ <string>XFWK</string>
41
+ <key>XCFrameworkFormatVersion</key>
42
+ <string>1.0</string>
43
+ </dict>
44
+ </plist>
@@ -0,0 +1,424 @@
1
+ #if 0
2
+ #elif defined(__arm64__) && __arm64__
3
+ // Generated by Apple Swift version 6.1.2 effective-5.10 (swiftlang-6.1.2.1.2 clang-1700.0.13.5)
4
+ #ifndef DAVOICETTS_SWIFT_H
5
+ #define DAVOICETTS_SWIFT_H
6
+ #pragma clang diagnostic push
7
+ #pragma clang diagnostic ignored "-Wgcc-compat"
8
+
9
+ #if !defined(__has_include)
10
+ # define __has_include(x) 0
11
+ #endif
12
+ #if !defined(__has_attribute)
13
+ # define __has_attribute(x) 0
14
+ #endif
15
+ #if !defined(__has_feature)
16
+ # define __has_feature(x) 0
17
+ #endif
18
+ #if !defined(__has_warning)
19
+ # define __has_warning(x) 0
20
+ #endif
21
+
22
+ #if __has_include(<swift/objc-prologue.h>)
23
+ # include <swift/objc-prologue.h>
24
+ #endif
25
+
26
+ #pragma clang diagnostic ignored "-Wauto-import"
27
+ #if defined(__OBJC__)
28
+ #include <Foundation/Foundation.h>
29
+ #endif
30
+ #if defined(__cplusplus)
31
+ #include <cstdint>
32
+ #include <cstddef>
33
+ #include <cstdbool>
34
+ #include <cstring>
35
+ #include <stdlib.h>
36
+ #include <new>
37
+ #include <type_traits>
38
+ #else
39
+ #include <stdint.h>
40
+ #include <stddef.h>
41
+ #include <stdbool.h>
42
+ #include <string.h>
43
+ #endif
44
+ #if defined(__cplusplus)
45
+ #pragma clang diagnostic push
46
+ #pragma clang diagnostic ignored "-Wnon-modular-include-in-framework-module"
47
+ #if defined(__arm64e__) && __has_include(<ptrauth.h>)
48
+ # include <ptrauth.h>
49
+ #else
50
+ #pragma clang diagnostic push
51
+ #pragma clang diagnostic ignored "-Wreserved-macro-identifier"
52
+ # ifndef __ptrauth_swift_value_witness_function_pointer
53
+ # define __ptrauth_swift_value_witness_function_pointer(x)
54
+ # endif
55
+ # ifndef __ptrauth_swift_class_method_pointer
56
+ # define __ptrauth_swift_class_method_pointer(x)
57
+ # endif
58
+ #pragma clang diagnostic pop
59
+ #endif
60
+ #pragma clang diagnostic pop
61
+ #endif
62
+
63
+ #if !defined(SWIFT_TYPEDEFS)
64
+ # define SWIFT_TYPEDEFS 1
65
+ # if __has_include(<uchar.h>)
66
+ # include <uchar.h>
67
+ # elif !defined(__cplusplus)
68
+ typedef unsigned char char8_t;
69
+ typedef uint_least16_t char16_t;
70
+ typedef uint_least32_t char32_t;
71
+ # endif
72
+ typedef float swift_float2 __attribute__((__ext_vector_type__(2)));
73
+ typedef float swift_float3 __attribute__((__ext_vector_type__(3)));
74
+ typedef float swift_float4 __attribute__((__ext_vector_type__(4)));
75
+ typedef double swift_double2 __attribute__((__ext_vector_type__(2)));
76
+ typedef double swift_double3 __attribute__((__ext_vector_type__(3)));
77
+ typedef double swift_double4 __attribute__((__ext_vector_type__(4)));
78
+ typedef int swift_int2 __attribute__((__ext_vector_type__(2)));
79
+ typedef int swift_int3 __attribute__((__ext_vector_type__(3)));
80
+ typedef int swift_int4 __attribute__((__ext_vector_type__(4)));
81
+ typedef unsigned int swift_uint2 __attribute__((__ext_vector_type__(2)));
82
+ typedef unsigned int swift_uint3 __attribute__((__ext_vector_type__(3)));
83
+ typedef unsigned int swift_uint4 __attribute__((__ext_vector_type__(4)));
84
+ #endif
85
+
86
+ #if !defined(SWIFT_PASTE)
87
+ # define SWIFT_PASTE_HELPER(x, y) x##y
88
+ # define SWIFT_PASTE(x, y) SWIFT_PASTE_HELPER(x, y)
89
+ #endif
90
+ #if !defined(SWIFT_METATYPE)
91
+ # define SWIFT_METATYPE(X) Class
92
+ #endif
93
+ #if !defined(SWIFT_CLASS_PROPERTY)
94
+ # if __has_feature(objc_class_property)
95
+ # define SWIFT_CLASS_PROPERTY(...) __VA_ARGS__
96
+ # else
97
+ # define SWIFT_CLASS_PROPERTY(...)
98
+ # endif
99
+ #endif
100
+ #if !defined(SWIFT_RUNTIME_NAME)
101
+ # if __has_attribute(objc_runtime_name)
102
+ # define SWIFT_RUNTIME_NAME(X) __attribute__((objc_runtime_name(X)))
103
+ # else
104
+ # define SWIFT_RUNTIME_NAME(X)
105
+ # endif
106
+ #endif
107
+ #if !defined(SWIFT_COMPILE_NAME)
108
+ # if __has_attribute(swift_name)
109
+ # define SWIFT_COMPILE_NAME(X) __attribute__((swift_name(X)))
110
+ # else
111
+ # define SWIFT_COMPILE_NAME(X)
112
+ # endif
113
+ #endif
114
+ #if !defined(SWIFT_METHOD_FAMILY)
115
+ # if __has_attribute(objc_method_family)
116
+ # define SWIFT_METHOD_FAMILY(X) __attribute__((objc_method_family(X)))
117
+ # else
118
+ # define SWIFT_METHOD_FAMILY(X)
119
+ # endif
120
+ #endif
121
+ #if !defined(SWIFT_NOESCAPE)
122
+ # if __has_attribute(noescape)
123
+ # define SWIFT_NOESCAPE __attribute__((noescape))
124
+ # else
125
+ # define SWIFT_NOESCAPE
126
+ # endif
127
+ #endif
128
+ #if !defined(SWIFT_RELEASES_ARGUMENT)
129
+ # if __has_attribute(ns_consumed)
130
+ # define SWIFT_RELEASES_ARGUMENT __attribute__((ns_consumed))
131
+ # else
132
+ # define SWIFT_RELEASES_ARGUMENT
133
+ # endif
134
+ #endif
135
+ #if !defined(SWIFT_WARN_UNUSED_RESULT)
136
+ # if __has_attribute(warn_unused_result)
137
+ # define SWIFT_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
138
+ # else
139
+ # define SWIFT_WARN_UNUSED_RESULT
140
+ # endif
141
+ #endif
142
+ #if !defined(SWIFT_NORETURN)
143
+ # if __has_attribute(noreturn)
144
+ # define SWIFT_NORETURN __attribute__((noreturn))
145
+ # else
146
+ # define SWIFT_NORETURN
147
+ # endif
148
+ #endif
149
+ #if !defined(SWIFT_CLASS_EXTRA)
150
+ # define SWIFT_CLASS_EXTRA
151
+ #endif
152
+ #if !defined(SWIFT_PROTOCOL_EXTRA)
153
+ # define SWIFT_PROTOCOL_EXTRA
154
+ #endif
155
+ #if !defined(SWIFT_ENUM_EXTRA)
156
+ # define SWIFT_ENUM_EXTRA
157
+ #endif
158
+ #if !defined(SWIFT_CLASS)
159
+ # if __has_attribute(objc_subclassing_restricted)
160
+ # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_CLASS_EXTRA
161
+ # define SWIFT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_subclassing_restricted)) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
162
+ # else
163
+ # define SWIFT_CLASS(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
164
+ # define SWIFT_CLASS_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_CLASS_EXTRA
165
+ # endif
166
+ #endif
167
+ #if !defined(SWIFT_RESILIENT_CLASS)
168
+ # if __has_attribute(objc_class_stub)
169
+ # define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME) __attribute__((objc_class_stub))
170
+ # define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) __attribute__((objc_class_stub)) SWIFT_CLASS_NAMED(SWIFT_NAME)
171
+ # else
172
+ # define SWIFT_RESILIENT_CLASS(SWIFT_NAME) SWIFT_CLASS(SWIFT_NAME)
173
+ # define SWIFT_RESILIENT_CLASS_NAMED(SWIFT_NAME) SWIFT_CLASS_NAMED(SWIFT_NAME)
174
+ # endif
175
+ #endif
176
+ #if !defined(SWIFT_PROTOCOL)
177
+ # define SWIFT_PROTOCOL(SWIFT_NAME) SWIFT_RUNTIME_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
178
+ # define SWIFT_PROTOCOL_NAMED(SWIFT_NAME) SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_PROTOCOL_EXTRA
179
+ #endif
180
+ #if !defined(SWIFT_EXTENSION)
181
+ # define SWIFT_EXTENSION(M) SWIFT_PASTE(M##_Swift_, __LINE__)
182
+ #endif
183
+ #if !defined(OBJC_DESIGNATED_INITIALIZER)
184
+ # if __has_attribute(objc_designated_initializer)
185
+ # define OBJC_DESIGNATED_INITIALIZER __attribute__((objc_designated_initializer))
186
+ # else
187
+ # define OBJC_DESIGNATED_INITIALIZER
188
+ # endif
189
+ #endif
190
+ #if !defined(SWIFT_ENUM_ATTR)
191
+ # if __has_attribute(enum_extensibility)
192
+ # define SWIFT_ENUM_ATTR(_extensibility) __attribute__((enum_extensibility(_extensibility)))
193
+ # else
194
+ # define SWIFT_ENUM_ATTR(_extensibility)
195
+ # endif
196
+ #endif
197
+ #if !defined(SWIFT_ENUM)
198
+ # define SWIFT_ENUM(_type, _name, _extensibility) enum _name : _type _name; enum SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
199
+ # if __has_feature(generalized_swift_name)
200
+ # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) enum _name : _type _name SWIFT_COMPILE_NAME(SWIFT_NAME); enum SWIFT_COMPILE_NAME(SWIFT_NAME) SWIFT_ENUM_ATTR(_extensibility) SWIFT_ENUM_EXTRA _name : _type
201
+ # else
202
+ # define SWIFT_ENUM_NAMED(_type, _name, SWIFT_NAME, _extensibility) SWIFT_ENUM(_type, _name, _extensibility)
203
+ # endif
204
+ #endif
205
+ #if !defined(SWIFT_UNAVAILABLE)
206
+ # define SWIFT_UNAVAILABLE __attribute__((unavailable))
207
+ #endif
208
+ #if !defined(SWIFT_UNAVAILABLE_MSG)
209
+ # define SWIFT_UNAVAILABLE_MSG(msg) __attribute__((unavailable(msg)))
210
+ #endif
211
+ #if !defined(SWIFT_AVAILABILITY)
212
+ # define SWIFT_AVAILABILITY(plat, ...) __attribute__((availability(plat, __VA_ARGS__)))
213
+ #endif
214
+ #if !defined(SWIFT_WEAK_IMPORT)
215
+ # define SWIFT_WEAK_IMPORT __attribute__((weak_import))
216
+ #endif
217
+ #if !defined(SWIFT_DEPRECATED)
218
+ # define SWIFT_DEPRECATED __attribute__((deprecated))
219
+ #endif
220
+ #if !defined(SWIFT_DEPRECATED_MSG)
221
+ # define SWIFT_DEPRECATED_MSG(...) __attribute__((deprecated(__VA_ARGS__)))
222
+ #endif
223
+ #if !defined(SWIFT_DEPRECATED_OBJC)
224
+ # if __has_feature(attribute_diagnose_if_objc)
225
+ # define SWIFT_DEPRECATED_OBJC(Msg) __attribute__((diagnose_if(1, Msg, "warning")))
226
+ # else
227
+ # define SWIFT_DEPRECATED_OBJC(Msg) SWIFT_DEPRECATED_MSG(Msg)
228
+ # endif
229
+ #endif
230
+ #if defined(__OBJC__)
231
+ #if !defined(IBSegueAction)
232
+ # define IBSegueAction
233
+ #endif
234
+ #endif
235
+ #if !defined(SWIFT_EXTERN)
236
+ # if defined(__cplusplus)
237
+ # define SWIFT_EXTERN extern "C"
238
+ # else
239
+ # define SWIFT_EXTERN extern
240
+ # endif
241
+ #endif
242
+ #if !defined(SWIFT_CALL)
243
+ # define SWIFT_CALL __attribute__((swiftcall))
244
+ #endif
245
+ #if !defined(SWIFT_INDIRECT_RESULT)
246
+ # define SWIFT_INDIRECT_RESULT __attribute__((swift_indirect_result))
247
+ #endif
248
+ #if !defined(SWIFT_CONTEXT)
249
+ # define SWIFT_CONTEXT __attribute__((swift_context))
250
+ #endif
251
+ #if !defined(SWIFT_ERROR_RESULT)
252
+ # define SWIFT_ERROR_RESULT __attribute__((swift_error_result))
253
+ #endif
254
+ #if defined(__cplusplus)
255
+ # define SWIFT_NOEXCEPT noexcept
256
+ #else
257
+ # define SWIFT_NOEXCEPT
258
+ #endif
259
+ #if !defined(SWIFT_C_INLINE_THUNK)
260
+ # if __has_attribute(always_inline)
261
+ # if __has_attribute(nodebug)
262
+ # define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline)) __attribute__((nodebug))
263
+ # else
264
+ # define SWIFT_C_INLINE_THUNK inline __attribute__((always_inline))
265
+ # endif
266
+ # else
267
+ # define SWIFT_C_INLINE_THUNK inline
268
+ # endif
269
+ #endif
270
+ #if defined(_WIN32)
271
+ #if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
272
+ # define SWIFT_IMPORT_STDLIB_SYMBOL __declspec(dllimport)
273
+ #endif
274
+ #else
275
+ #if !defined(SWIFT_IMPORT_STDLIB_SYMBOL)
276
+ # define SWIFT_IMPORT_STDLIB_SYMBOL
277
+ #endif
278
+ #endif
279
+ #if defined(__OBJC__)
280
+ #if __has_feature(objc_modules)
281
+ #if __has_warning("-Watimport-in-framework-header")
282
+ #pragma clang diagnostic ignored "-Watimport-in-framework-header"
283
+ #endif
284
+ @import AVFAudio;
285
+ @import Foundation;
286
+ @import ObjectiveC;
287
+ @import Speech;
288
+ #endif
289
+
290
+ #endif
291
+ #pragma clang diagnostic ignored "-Wproperty-attribute-mismatch"
292
+ #pragma clang diagnostic ignored "-Wduplicate-method-arg"
293
+ #if __has_warning("-Wpragma-clang-attribute")
294
+ # pragma clang diagnostic ignored "-Wpragma-clang-attribute"
295
+ #endif
296
+ #pragma clang diagnostic ignored "-Wunknown-pragmas"
297
+ #pragma clang diagnostic ignored "-Wnullability"
298
+ #pragma clang diagnostic ignored "-Wdollar-in-identifier-extension"
299
+ #pragma clang diagnostic ignored "-Wunsafe-buffer-usage"
300
+
301
+ #if __has_attribute(external_source_symbol)
302
+ # pragma push_macro("any")
303
+ # undef any
304
+ # pragma clang attribute push(__attribute__((external_source_symbol(language="Swift", defined_in="DavoiceTTS",generated_declaration))), apply_to=any(function,enum,objc_interface,objc_category,objc_protocol))
305
+ # pragma pop_macro("any")
306
+ #endif
307
+
308
+ #if defined(__OBJC__)
309
+
310
+ @class NSString;
311
+ @class NSURL;
312
+ @class NSUUID;
313
+ @class AVAudioPCMBuffer;
314
+ SWIFT_CLASS("_TtC10DavoiceTTS10DaVoiceTTS")
315
+ @interface DaVoiceTTS : NSObject
316
+ @property (nonatomic, copy) void (^ _Nullable onLastUtteranceFinished)(void);
317
+ + (BOOL)activateLicenseWithLicenseKey:(NSString * _Nonnull)licenseKey SWIFT_WARN_UNUSED_RESULT;
318
+ - (BOOL)setLicenseWithLicenseKey:(NSString * _Nonnull)licenseKey SWIFT_WARN_UNUSED_RESULT;
319
+ - (nullable instancetype)initWithModel:(NSURL * _Nonnull)model error:(NSError * _Nullable * _Nullable)error OBJC_DESIGNATED_INITIALIZER;
320
+ /// Immediately stop speaking: cancels future synthesis work and flushes all playback.
321
+ - (void)stopSpeaking;
322
+ /// Destroy the TTS instance resources; after this call, the object should not be used.
323
+ /// Effectively returns the instance to “pre-init” state.
324
+ - (void)destroy;
325
+ - (void)speak:(NSString * _Nonnull)txt sid:(int32_t)sid;
326
+ - (void)speak:(NSString * _Nonnull)txt sid:(int32_t)sid speed:(float)speed;
327
+ - (AVAudioPCMBuffer * _Nullable)synthesize_top:(NSString * _Nonnull)_text speakerId:(int32_t)speakerId token:(NSUUID * _Nonnull)token speed_adjuster:(float)speed_adjuster error:(NSError * _Nullable * _Nullable)error SWIFT_WARN_UNUSED_RESULT;
328
+ /// Queue an external WAV file for playback via the same AEC path/queue used by speak().
329
+ /// If called repeatedly, items are queued in order. <code>onLastUtteranceFinished</code> fires
330
+ /// after THIS file finishes (unless you enqueue more later and mark those as last).
331
+ - (void)playWav:(NSURL * _Nonnull)url markAsLastUtterance:(BOOL)markAsLastUtterance;
332
+ /// Queue an in-memory PCM buffer (any format) for playback via the same AEC path/queue.
333
+ /// We resample/normalize, write a temp WAV, then enqueue it (so it uses the engine hook).
334
+ - (void)playBuffer:(AVAudioPCMBuffer * _Nonnull)buffer markAsLastUtterance:(BOOL)markAsLastUtterance;
335
+ - (nonnull instancetype)init SWIFT_UNAVAILABLE;
336
+ + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
337
+ @end
338
+
339
+ SWIFT_CLASS("_TtC10DavoiceTTS14LicenseManager")
340
+ @interface LicenseManager : NSObject
341
+ + (BOOL)isLicenseValidWithLicenseKey:(NSString * _Nonnull)licenseKey SWIFT_WARN_UNUSED_RESULT;
342
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
343
+ @end
344
+
345
+ @protocol STTDelegate;
346
+ @class NSNumber;
347
+ @class SFSpeechRecognizer;
348
+ SWIFT_CLASS("_TtC10DavoiceTTS3STT")
349
+ @interface STT : NSObject <SFSpeechRecognizerDelegate>
350
+ @property (nonatomic, weak) id <STTDelegate> _Nullable delegate;
351
+ @property (nonatomic) BOOL continuous;
352
+ @property (nonatomic) BOOL aecEnabled;
353
+ @property (nonatomic) BOOL force16kMicSampleRate;
354
+ @property (nonatomic) BOOL useLegacySpeakerGateBehavior;
355
+ @property (nonatomic) BOOL useSpeakerGateHangover;
356
+ @property (nonatomic) double speakerGateHangoverSeconds;
357
+ @property (nonatomic) BOOL useShortSpeakerVerificationTailWindow;
358
+ @property (nonatomic) float shortSpeakerVerificationTailSeconds;
359
+ @property (nonatomic) double speakerPreRollFlushMaxSeconds;
360
+ SWIFT_CLASS_PROPERTY(@property (nonatomic, class, readonly, copy) NSArray<NSString *> * _Nonnull supportedEvents;)
361
+ + (NSArray<NSString *> * _Nonnull)supportedEvents SWIFT_WARN_UNUSED_RESULT;
362
+ - (BOOL)setLicenseWithLicenseKey:(NSString * _Nonnull)licenseKey SWIFT_WARN_UNUSED_RESULT;
363
+ - (void)pauseSpeechRecognitionLite;
364
+ - (void)unPauseSpeechRecognitionLite:(NSNumber * _Nonnull)times;
365
+ - (void)pauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
366
+ - (void)unPauseMicrophoneAndWait:(NSNumber * _Nonnull)timeoutMs completion:(void (^ _Nonnull)(BOOL, NSString * _Nullable))completion;
367
+ - (void)pauseMicrophone;
368
+ - (void)unPauseMicrophone;
369
+ /// Enable/disable iOS voice-processing (AEC + ducking).
370
+ /// If STT is already active, we rebuild the session/graph so it takes effect.
371
+ - (void)setAECEnabled:(BOOL)enabled;
372
+ - (BOOL)isAECEnabled SWIFT_WARN_UNUSED_RESULT;
373
+ - (void)isSpeechAvailable:(void (^ _Nonnull)(BOOL))completion;
374
+ - (BOOL)isRecognizing SWIFT_WARN_UNUSED_RESULT;
375
+ - (void)startSpeechWithLocaleStr:(NSString * _Nullable)localeStr;
376
+ - (void)startSpeechWithLocaleStr:(NSString * _Nullable)localeStr onboardingJsonPath:(NSString * _Nonnull)onboardingJsonPath;
377
+ - (void)stopSpeech:(void (^ _Nullable)(BOOL))completion;
378
+ - (void)cancelSpeech:(void (^ _Nullable)(BOOL))completion;
379
+ - (void)destroySpeech:(void (^ _Nullable)(BOOL))completion;
380
+ - (void)teardown;
381
+ - (void)speechRecognizer:(SFSpeechRecognizer * _Nonnull)speechRecognizer availabilityDidChange:(BOOL)available;
382
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
383
+ @end
384
+
385
+ SWIFT_PROTOCOL("_TtP10DavoiceTTS11STTDelegate_")
386
+ @protocol STTDelegate
387
+ - (void)stt:(STT * _Nonnull)stt didEmitEvent:(NSString * _Nonnull)name body:(NSDictionary<NSString *, id> * _Nullable)body;
388
+ @end
389
+
390
+ SWIFT_CLASS("_TtC10DavoiceTTS25SpeakerVerificationEngine")
391
+ @interface SpeakerVerificationEngine : NSObject
392
+ - (void)resetStreamingState;
393
+ - (nonnull instancetype)init SWIFT_UNAVAILABLE;
394
+ + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
395
+ @end
396
+
397
+ @class NSError;
398
+ SWIFT_CLASS_NAMED("SpeakerVerificationRNFacade")
399
+ @interface DavoiceSpeakerVerificationRNFacade : NSObject
400
+ + (id _Nullable)createEngineWithModelPath:(NSString * _Nonnull)modelPath enrollmentJsonPath:(NSString * _Nonnull)enrollmentJsonPath options:(NSDictionary<NSString *, id> * _Nonnull)options error:(NSError * _Nullable * _Nullable)outError SWIFT_WARN_UNUSED_RESULT;
401
+ + (NSDictionary<NSString *, id> * _Nullable)verifyWavWithEngine:(id _Nonnull)engine wavPath:(NSString * _Nonnull)wavPath reset:(BOOL)reset error:(NSError * _Nullable * _Nullable)outError SWIFT_WARN_UNUSED_RESULT;
402
+ - (nonnull instancetype)init OBJC_DESIGNATED_INITIALIZER;
403
+ @end
404
+
405
+ @class AVAudioPlayer;
406
+ SWIFT_CLASS("_TtC10DavoiceTTS15SwiftSoundQueue")
407
+ @interface SwiftSoundQueue : NSObject <AVAudioPlayerDelegate>
408
+ - (nonnull instancetype)init SWIFT_UNAVAILABLE;
409
+ + (nonnull instancetype)new SWIFT_UNAVAILABLE_MSG("-init is unavailable");
410
+ - (void)audioPlayerDidFinishPlaying:(AVAudioPlayer * _Nonnull)p successfully:(BOOL)ok;
411
+ @end
412
+
413
+ #endif
414
+ #if __has_attribute(external_source_symbol)
415
+ # pragma clang attribute pop
416
+ #endif
417
+ #if defined(__cplusplus)
418
+ #endif
419
+ #pragma clang diagnostic pop
420
+ #endif
421
+
422
+ #else
423
+ #error unsupported Swift architecture
424
+ #endif