Queue management system for AVSpeechSynthesizer

Overview

QHSpeechSynthesizerQueue

Build Status
Queue management system for AVSpeechSynthesizer

Installation

Cocoapods

Add this to your Podfile:

pod 'QHSpeechSynthesizerQueue'

Run a pod install and import the header where you need it:

#import <QHSpeechSynthesizerQueue.h>

Manually

Drop QHSpeechSynthesizerQueue.h and QHSpeechSynthesizerQueue.m in your project, then

#import "QHSpeechSynthesizerQueue.h"

##Usage

Initialization

QHSpeechSynthesizerQueue *synthesizerQueue = [[QHSpeechSynthesizerQueue alloc] init];

Adding messages to the queue

Add a message at the end of the queue
[synthesizerQueue readLast:@"This message will be added to the end of the queue" 
                  withLanguage:@"en_US"
                  andRate:@"0.2"];
Insert a message to be read immediatly after the current message being read
[synthesizerQueue readNext:@"This message will be read next"
                  withLanguage:@"en_US"
                  andRate:@"0.2"
                  andClearQueue:NO];

If you set andClearQueue: to YES, the queue will be cleared and this will be the last message to be read.

Interrupt the current message and read this one immediately
[synthesizerQueue readImmediately:@"This message will be read next"
                  withLanguage:@"en_US"
                  andRate:@"0.2"
                  andClearQueue:NO];

If you set andClearQueue: to YES, the queue will be cleared and this will be the last message to be read.

Playback actions

Stop

Stop the queue's playback and clear the queue immediately.

[synthesizerQueue stop];
Stop after current

Stop the queue's playback and clear the queue. If something is currently being read, it will stop afterwards.

[synthesizerQueue stopAfterCurrent];
Pause

Pause the queue's playback immediately.

[synthesizerQueue pause];
Pause after current

Pause the queue's playback. If something is currently being read, it will pause afterwards.

[synthesizerQueue pauseAfterCurrent];
Resume

Resume the queue's playback.

[synthesizerQueue resume];
Clear queue

Clear the queue. If something is being read, it will not be interupted and future added messages will be read if not paused/stopped.

[synthesizerQueue clearQueue];

Properties

BOOL duckOthers

Set this to YES to duck all the device's audio sessions when a string is being read. Defaults to YES.

synthesizerQueue.duckOthers = YES;
NSTimeInterval preDelay

The delay before reading a message. Default is 0.0

synthesizerQueue.preDelay = 1.0;
NSTimeInterval postDelay

The delay after reading a message. Default is 0.0

synthesizerQueue.postDelay = 1.0;

Delegate

You can set a QHSpeechSynthesizerQueueDelegate to be notified of playback events.

@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
You might also like...
A Generic Priority Queue in Pure Swift

SwiftPriorityQueue SwiftPriorityQueue is a pure Swift (no Cocoa) implementation of a generic priority queue data structure, appropriate for use on all

iOS utility class to manage global dispatch queue.
iOS utility class to manage global dispatch queue.

YYDispatchQueuePool iOS utility class to manage global dispatch queue. (It's a component of YYKit) When use a concurrent queue to execute lots of bloc

Dead-simple queue-oriented client for Spotify
Dead-simple queue-oriented client for Spotify

Spotiqueue A terribly simple macOS app for keyboard-based, queue-oriented Spotify use. Many years ago i built a version which relied on a now-deprecat

CCMQ is a message queue framework built for iOS

CCMQ CCMQ是基于MMAP开发的适用于iOS的消息队列框架 基本特性介绍 1.到达性和顺序性: CCMQ会确保消息一定能够发送到订阅者,CCMQ拥有串行和并行队列,串行队列会确保消息能够按照顺序发送顺序到达订阅者,并行队列则能够批量进行消息发送,但同一批次的消息到达顺序不能保证。 2.ACK机

A Task Queue Class developed in Swift (by Marin Todorov)
A Task Queue Class developed in Swift (by Marin Todorov)

TaskQueue Table of Contents Intro Installation CocoaPods Carthage Simple Examples Synchronous tasks Asynchronous tasks Serial and Concurrent Tasks GCD

SwiftRingBuffer - RingBuffer aka Circular Queue
SwiftRingBuffer - RingBuffer aka Circular Queue

Swift Ring Buffer Ring Buffer aka Circular Queue Ussage var queue = CircularQueu

🧸 Xcode Playground management made easy
🧸 Xcode Playground management made easy

Toybox Toybox made easy to manage Xcode Playgrounds. You can create and open Xcode Playground from CLI. $ toybox create Snippet # Generate ~/.toybox/S

MerchantKit - A modern In-App Purchases management framework for iOS developers

MerchantKit dramatically simplifies the work indie developers have to do in order to add premium monetizable components to their applications. Track purchased products, offer auto-renewing subscriptions, restore transactions, and much more.

Disk is a powerful and simple file management library built with Apple's iOS Data Storage Guidelines in mind
Disk is a powerful and simple file management library built with Apple's iOS Data Storage Guidelines in mind

Disk is a powerful and simple file management library built with Apple's iOS Data Storage Guidelines in mind

FileKit is a Swift framework that allows for simple and expressive file management.
FileKit is a Swift framework that allows for simple and expressive file management.

FileKit is a Swift framework that allows for simple and expressive file management.

File management and path analysis for Swift
File management and path analysis for Swift

Pathos offers cross-platform virtual file system APIs for Swift. Pathos is implement from ground-up with on each OS's native API. It has zero dependen

👕👚 Theme management in Swift
👕👚 Theme management in Swift

Themes Story Ever want to support Night mode? Or skin the app differently depending on the seasons? Or toggle features according to paid status? Well,

An iOS Library that makes shadows management easy on UIView.
An iOS Library that makes shadows management easy on UIView.

ShadowView is an iOS Shadow library that makes view's shadow implementation easy and sweet 🎉 🎊 . Add simple shadows to add a gaussian blurred projec

Docker management app for iOS written in SwiftUI.
Docker management app for iOS written in SwiftUI.

Harbour Docker management app for iOS written in SwiftUI. Screenshots Features 100% native and made in SwiftUI Light and Dark Mode Control and inspect

Declarative Swift framework for Attributed Role-based Access Control management
Declarative Swift framework for Attributed Role-based Access Control management

Koosa Declarative Swift framework for Attributed Role-based Access Control management Check out this blog post for full explanation and more details:

A demonstration to the approach of leaving view transition management to a router.
A demonstration to the approach of leaving view transition management to a router.

SwiftUI-RouterDemo This is a simplified demonstration to the approach of leaving view transition management to a router.

An iOS view-controller navigation management. No inherit, using one line code to integrate.
An iOS view-controller navigation management. No inherit, using one line code to integrate.

KGNavigationBar Example An iOS view-controller navigation management. No inherit, using one line code to integrate. 一个 iOS 控制器导航管理库. 无需继承, 一行代码即可实现集成。

🎭 Swift async/await & Actor-powered effectful state-management framework.
🎭 Swift async/await & Actor-powered effectful state-management framework.

🎭 Actomaton 🧑‍🎤 Actor + 🤖 Automaton = 🎭 Actomaton Actomaton is Swift async/await & Actor-powered effectful state-management framework inspired by

Alfresco iOS App - Alfresco is the open platform for business-critical content management and collaboration.

Welcome to the Alfresco iOS App Alfresco is the open platform for business-critical content management and collaboration. Alfresco Mobile was designed

Owner
Quentin Hayot
Quentin Hayot
Dead-simple queue-oriented client for Spotify

Spotiqueue A terribly simple macOS app for keyboard-based, queue-oriented Spotify use. Many years ago i built a version which relied on a now-deprecat

paul 74 Dec 3, 2022
Replace the system volume popup with a more subtle indicator.

Replace the volume popup with a more subtle way to display the volume when the user changes it with the volume rocker. Why and how The iOS default pop

Andrea Mazzini 1.2k Nov 21, 2022
PTStations - MacOS App to gather the information on the Train Station of the Portuguese Railway system

PTStations A simple macOS app that gathers information on the Portuguese Railway

Joao Pires 2 Aug 10, 2022
Font management (System & Custom) for iOS and tvOS

UIFontComplete Font management (System & Custom) for iOS and tvOS Usage No more wasted time searching for names of UIFont fonts and no more surprises

Nicholas Maccharoli 1.3k Nov 14, 2022
🪶 Feather is a modern Swift-based content management system powered by Vapor 4.

Feather CMS ?? ?? Feather is a modern Swift-based content management system powered by Vapor 4. ?? Click to join the chat on Discord. Requirements To

Phu Huynh 0 Oct 20, 2021
PassDrop is a fully-featured secure password management system, compatible with the free KeePass 1.x (Classic) and multi-platform KeePassX desktop applications.

passdrop This is a modern, updated build of Rudis Muiznieks's PassDrop application. PassDrop is a fully-featured secure password management system, co

Chad Austin 33 Sep 23, 2022
Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD).

Queuer is a queue manager, built on top of OperationQueue and Dispatch (aka GCD). It allows you to create any asynchronous and synchronous task easily, all managed by a queue, with just a few lines.

Fabrizio Brancati 1k Dec 2, 2022
A real-time, votable, democratized music queue on iPad and iPhone using Spotify

Queue'd Music Queue'd is the best way to enjoy music with your friends. Add your favorite songs to a shared music queue at your favorite bars, restaur

Ryan Daulton 88 Dec 2, 2022
ClassicPhotos is a TableView App demos how to optimize image download and filter with operation queue.

ClassicPhotos ClassicPhotos is a TableView App demos how to optimize image download and filter with operation queue. With Operation and Operation Queu

Kushal Shingote 2 Dec 18, 2021
A protocol-centric, type and queue safe key-value workflow.

Light-weight, strict protocol-first styled PropertyKit helps you to easily and safely handle guaranteed values, keys or types on various situations of

gitmerge 12 Feb 26, 2021