QHSpeechSynthesizerQueue 1.1.1

QHSpeechSynthesizerQueue 1.1.1

测试已测试
Lang语言 Obj-CObjective C
许可证 MIT
发布上次发布2015年7月

Quentin Hayot维护。



  • 作者
  • Quentin Hayot

QHSpeechSyntesizerQueue


AVSpeechSynthesizer的队列管理系统

安装

手动

将QHSpeechSyntesizerQueue.h和QHSpeechSyntesizerQueue.m拖放到您的项目中,然后

#import "QHSpeechSyntesizerQueue.h"

用法

初始化

QHSpeechSyntesizerQueue *syntesizerQueue = [[QHSpeechSyntesizerQueue alloc] init];

向队列中添加消息

将消息添加到队列的末尾
[syntesizerQueue readLast:@"This message will be added to the end of the queue" withLanguage:@"en_US" andRate:@"0.2"];
在当前消息阅读后立即读取一条消息
[syntesizerQueue readNext:@"This message will be read next" withLanguage:@"en_US" andRate:@"0.2" andClearQueue:NO];

如果您将andClearQueue:设置为YES,则队列将被清除,这将是最后要读取的消息。

中断当前消息并立即读取此消息
[syntesizerQueue readImmediately:@"This message will be read next" withLanguage:@"en_US" andRate:@"0.2" andClearQueue:NO];

如果您将andClearQueue:设置为YES,则队列将被清除,这将是最后要读取的消息。

播放操作

停止

停止队列播放并立即清除队列。

[syntesizerQueue stop];
停止到当前

停止队列播放并清除队列。如果当前正在读取某些内容,它将在之后停止。

[syntesizerQueue stopAfterCurrent];
暂停

立即暂停队列播放。

[syntesizerQueue pause];
暂停到当前

暂停队列播放。如果当前正在读取某些内容,它将在之后暂停。

[syntesizerQueue pauseAfterCurrent];
继续

继续队列播放。

[syntesizerQueue resume];
清空队列

清除队列。如果正在读取内容,则不会中断,如果未暂停/停止,则将阅读未来添加的消息。

[syntesizerQueue clearQueue];

属性

BOOL duckOthers

将此设置为YES,当读取字符串时,将静音所有设备的音频会话。默认值为YES。

syntesizerQueue.duckOthers = YES;
NSTimeInterval preDelay

读取消息之前的延迟。默认为0.0

syntesizerQueue.preDelay = 1.0;
NSTimeInterval postDelay

读取消息之后的延迟。默认为0.0

syntesizerQueue.postDelay = 1.0;

委托

您可以设置一个 QHSpeechSynthesizerQueueDelegate 来接收播放事件的通知。

@protocol QHSpeechSynthesizerQueueDelegate <NSObject>

@optional
- (void)speechSynthesizerQueueDidStartTalking:(QHSpeechSynthesizerQueue *)queue;
- (void)speechSynthesizerQueueDidFinishTalking:(QHSpeechSynthesizerQueue *)queue;
- (void)speechSynthesizerQueueDidPauseTalking:(QHSpeechSynthesizerQueue *)queue;
- (void)speechSynthesizerQueueDidContinueTalking:(QHSpeechSynthesizerQueue *)queue;
- (void)speechSynthesizerQueueDidCancelTalking:(QHSpeechSynthesizerQueue *)queue;
- (void)speechSynthesizerQueueWillStartTalking:(QHSpeechSynthesizerQueue *)queue;

@end