summaryrefslogtreecommitdiff
path: root/SmartDeviceLink/public/SDLAudioData.h
blob: a4c0a366749ce9ad6a2993ff63af855f0f7b9128 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
//
//  SDLAudioData.h
//  SmartDeviceLink
//
//  Created by Nicole on 11/9/20.
//  Copyright © 2020 smartdevicelink. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "SDLSpeechCapabilities.h"

@class SDLFile;
@class SDLTTSChunk;

NS_ASSUME_NONNULL_BEGIN

@interface SDLAudioData : NSObject <NSCopying>

/// The text-to-speech prompts that will used and/or audio files that will be played. The audio prompts and files will be played in the same order they are added.
@property (nullable, copy, nonatomic, readonly) NSArray<SDLTTSChunk *> *audioData;

/// Initialize with an SDLFile holding data or pointing to a file on the file system. When this object is passed to an `Alert` or `Speak`, the file will be uploaded if it is not already, then played if the system supports that feature.
/// @discussion Only available on systems supporting RPC Spec v5.0+
///
/// @param audioFile The audio file to be played by the system
- (instancetype)initWithAudioFile:(SDLFile *)audioFile;

/// Initialize with a string to be spoken by the system speech synthesizer.
/// @param spokenString The string to be spoken by the system speech synthesizer
- (instancetype)initWithSpeechSynthesizerString:(NSString *)spokenString;

/// Initialize with a string to be spoken by the system speech synthesizer using a phonetic string.
/// @param phoneticString The string to be spoken by the system speech synthesizer
/// @param phoneticType Must be one of `SAPI_PHONEMES`, `LHPLUS_PHONEMES`, `TEXT`, or `PRE_RECORDED` or no object will be created
- (instancetype)initWithPhoneticSpeechSynthesizerString:(NSString *)phoneticString phoneticType:(SDLSpeechCapabilities)phoneticType;

- (instancetype)init NS_UNAVAILABLE;

/// Add additional SDLFiles holding data or pointing to a file on the file system. When this object is passed to an `Alert` or `Speak`, the file will be uploaded if it is not already, then played if the system supports that feature.
/// @param audioFiles An array of audio file to be played by the system
- (void)addAudioFiles:(NSArray<SDLFile *> *)audioFiles;

/// Create additional strings to be spoken by the system speech synthesizer.
/// @param spokenStrings The strings to be spoken by the system speech synthesizer
- (void)addSpeechSynthesizerStrings:(NSArray<NSString *> *)spokenStrings;

/// Create additional strings to be spoken by the system speech synthesizer using a phonetic string.
/// @param phoneticStrings The strings to be spoken by the system speech synthesizer
/// @param phoneticType Must be one of `SAPI_PHONEMES`, `LHPLUS_PHONEMES`, `TEXT`, or `PRE_RECORDED` or no object will be created
- (void)addPhoneticSpeechSynthesizerStrings:(NSArray<NSString *> *)phoneticStrings phoneticType:(SDLSpeechCapabilities)phoneticType;

@end

NS_ASSUME_NONNULL_END