Files

60 lines
1.8 KiB
Objective-C
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

//
// AliyunNuiTTSBridge.h
// suixinkan
//
#import <Foundation/Foundation.h>
NS_ASSUME_NONNULL_BEGIN
/// 阿里云 NUI TTS 事件代理,将 Objective-C SDK 回调转成稳定的 Swift 边界。
@protocol AliyunNuiTTSBridgeDelegate;
/// 阿里云 NUI TTS Objective-C 桥接器,隔离 SDK 头文件和模拟器不可用逻辑。
@interface AliyunNuiTTSBridge : NSObject
/// SDK 回调代理。
@property (nonatomic, weak, nullable) id<AliyunNuiTTSBridgeDelegate> delegate;
/// 当前平台是否可直接加载 NUI TTS SDK。
@property (nonatomic, readonly) BOOL sdkAvailable;
/// 初始化 NUI TTS 引擎。
- (NSInteger)initializeWithTicket:(NSString *)ticket logLevel:(NSInteger)logLevel saveLog:(BOOL)saveLog;
/// 设置合成参数。
- (NSInteger)setParam:(NSString *)param value:(NSString *)value;
/// 开始合成指定文本。
- (NSInteger)playWithPriority:(NSString *)priority taskId:(NSString *)taskId text:(NSString *)text;
/// 取消指定任务taskId 为空时取消全部任务。
- (NSInteger)cancelWithTaskId:(nullable NSString *)taskId;
/// 释放 SDK 资源。
- (NSInteger)releaseEngine;
/// 获取 SDK 参数值。
- (nullable NSString *)paramValueForKey:(NSString *)key;
@end
/// 阿里云 NUI TTS 事件代理。
@protocol AliyunNuiTTSBridgeDelegate <NSObject>
/// 收到 TTS 状态事件。
- (void)aliyunNuiTTSBridge:(AliyunNuiTTSBridge *)bridge
didReceiveEvent:(NSInteger)event
taskId:(nullable NSString *)taskId
code:(NSInteger)code;
/// 收到 TTS 音频数据。
- (void)aliyunNuiTTSBridge:(AliyunNuiTTSBridge *)bridge
didReceiveAudioData:(NSData *)data
taskId:(nullable NSString *)taskId
info:(nullable NSString *)info;
@end
NS_ASSUME_NONNULL_END