blob: 6b300905ea7aff0d2bace884198fe89224827b03 (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
// SDLPerformAudioPassThru.m
//
#import "SDLPerformAudioPassThru.h"
#import "NSMutableDictionary+Store.h"
#import "SDLRPCParameterNames.h"
#import "SDLRPCFunctionNames.h"
#import "SDLTTSChunk.h"
NS_ASSUME_NONNULL_BEGIN
@implementation SDLPerformAudioPassThru
- (instancetype)init {
if (self = [super initWithName:SDLRPCFunctionNamePerformAudioPassThru]) {
}
return self;
}
- (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt audioPassThruDisplayText1:(nullable NSString *)audioPassThruDisplayText1 audioPassThruDisplayText2:(nullable NSString *)audioPassThruDisplayText2 samplingRate:(SDLSamplingRate)samplingRate bitsPerSample:(SDLBitsPerSample)bitsPerSample audioType:(SDLAudioType)audioType maxDuration:(UInt32)maxDuration muteAudio:(BOOL)muteAudio {
return [self initWithInitialPrompt:initialPrompt audioPassThruDisplayText1:audioPassThruDisplayText1 audioPassThruDisplayText2:audioPassThruDisplayText2 samplingRate:samplingRate bitsPerSample:bitsPerSample audioType:audioType maxDuration:maxDuration muteAudio:muteAudio audioDataHandler:nil];
}
- (instancetype)initWithInitialPrompt:(nullable NSString *)initialPrompt audioPassThruDisplayText1:(nullable NSString *)audioPassThruDisplayText1 audioPassThruDisplayText2:(nullable NSString *)audioPassThruDisplayText2 samplingRate:(SDLSamplingRate)samplingRate bitsPerSample:(SDLBitsPerSample)bitsPerSample audioType:(SDLAudioType)audioType maxDuration:(UInt32)maxDuration muteAudio:(BOOL)muteAudio audioDataHandler:(nullable SDLAudioPassThruHandler)audioDataHandler {
self = [self initWithSamplingRate:samplingRate bitsPerSample:bitsPerSample audioType:audioType maxDuration:maxDuration audioDataHandler:audioDataHandler];
if (!self) {
return nil;
}
self.initialPrompt = [SDLTTSChunk textChunksFromString:initialPrompt];
self.audioPassThruDisplayText1 = audioPassThruDisplayText1;
self.audioPassThruDisplayText2 = audioPassThruDisplayText2;
self.muteAudio = @(muteAudio);
return self;
}
- (instancetype)initWithSamplingRate:(SDLSamplingRate)samplingRate bitsPerSample:(SDLBitsPerSample)bitsPerSample audioType:(SDLAudioType)audioType maxDuration:(UInt32)maxDuration {
return [self initWithSamplingRate:samplingRate bitsPerSample:bitsPerSample audioType:audioType maxDuration:maxDuration audioDataHandler:nil];
}
- (instancetype)initWithSamplingRate:(SDLSamplingRate)samplingRate bitsPerSample:(SDLBitsPerSample)bitsPerSample audioType:(SDLAudioType)audioType maxDuration:(UInt32)maxDuration audioDataHandler:(nullable SDLAudioPassThruHandler)audioDataHandler {
self = [self init];
if (!self) {
return nil;
}
self.samplingRate = samplingRate;
self.bitsPerSample = bitsPerSample;
self.audioType = audioType;
self.maxDuration = @(maxDuration);
self.audioDataHandler = audioDataHandler;
return self;
}
- (void)setInitialPrompt:(nullable NSArray<SDLTTSChunk *> *)initialPrompt {
[parameters sdl_setObject:initialPrompt forName:SDLRPCParameterNameInitialPrompt];
}
- (nullable NSArray<SDLTTSChunk *> *)initialPrompt {
return [parameters sdl_objectsForName:SDLRPCParameterNameInitialPrompt ofClass:SDLTTSChunk.class];
}
- (void)setAudioPassThruDisplayText1:(nullable NSString *)audioPassThruDisplayText1 {
[parameters sdl_setObject:audioPassThruDisplayText1 forName:SDLRPCParameterNameAudioPassThruDisplayText1];
}
- (nullable NSString *)audioPassThruDisplayText1 {
return [parameters sdl_objectForName:SDLRPCParameterNameAudioPassThruDisplayText1 ofClass:NSString.class];
}
- (void)setAudioPassThruDisplayText2:(nullable NSString *)audioPassThruDisplayText2 {
[parameters sdl_setObject:audioPassThruDisplayText2 forName:SDLRPCParameterNameAudioPassThruDisplayText2];
}
- (nullable NSString *)audioPassThruDisplayText2 {
return [parameters sdl_objectForName:SDLRPCParameterNameAudioPassThruDisplayText2 ofClass:NSString.class];
}
- (void)setSamplingRate:(SDLSamplingRate)samplingRate {
[parameters sdl_setObject:samplingRate forName:SDLRPCParameterNameSamplingRate];
}
- (SDLSamplingRate)samplingRate {
NSError *error;
return [parameters sdl_enumForName:SDLRPCParameterNameSamplingRate error:&error];
}
- (void)setMaxDuration:(NSNumber<SDLInt> *)maxDuration {
[parameters sdl_setObject:maxDuration forName:SDLRPCParameterNameMaxDuration];
}
- (NSNumber<SDLInt> *)maxDuration {
NSError *error;
return [parameters sdl_objectForName:SDLRPCParameterNameMaxDuration ofClass:NSNumber.class error:&error];
}
- (void)setBitsPerSample:(SDLBitsPerSample)bitsPerSample {
[parameters sdl_setObject:bitsPerSample forName:SDLRPCParameterNameBitsPerSample];
}
- (SDLBitsPerSample)bitsPerSample {
NSError *error;
return [parameters sdl_enumForName:SDLRPCParameterNameBitsPerSample error:&error];
}
- (void)setAudioType:(SDLAudioType)audioType {
[parameters sdl_setObject:audioType forName:SDLRPCParameterNameAudioType];
}
- (SDLAudioType)audioType {
NSError *error;
return [parameters sdl_enumForName:SDLRPCParameterNameAudioType error:&error];
}
- (void)setMuteAudio:(nullable NSNumber<SDLBool> *)muteAudio {
[parameters sdl_setObject:muteAudio forName:SDLRPCParameterNameMuteAudio];
}
- (nullable NSNumber<SDLBool> *)muteAudio {
return [parameters sdl_objectForName:SDLRPCParameterNameMuteAudio ofClass:NSNumber.class];
}
@end
NS_ASSUME_NONNULL_END
|