File tree 1 file changed +6
-2
lines changed
1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -163,6 +163,7 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
163
163
self.audioEngine = [[AVAudioEngine alloc ] init ];
164
164
}
165
165
166
+ @try {
166
167
AVAudioInputNode* inputNode = self.audioEngine .inputNode ;
167
168
if (inputNode == nil ) {
168
169
[self sendResult: @{@" code" : @" input" } :nil :nil :nil ];
@@ -223,8 +224,6 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
223
224
@try {
224
225
[mixer installTapOnBus: 0 bufferSize: 1024 format: recordingFormat block: ^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
225
226
// Volume Level Metering
226
- // Buffer frame can be reduced, if you need more output values
227
- [buffer setFrameLength: buffer.frameCapacity];
228
227
UInt32 inNumberFrames = buffer.frameLength ;
229
228
float LEVEL_LOWPASS_TRIG = 0.5 ;
230
229
if (buffer.format .channelCount >0 )
@@ -272,6 +271,11 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
272
271
[self teardown ];
273
272
return ;
274
273
}
274
+ }
275
+ @catch (NSException *exception ) {
276
+ [self sendResult: @{@" code" : @" start_recording" , @" message" : [exception reason ]} :nil :nil :nil ];
277
+ return ;
278
+ }
275
279
}
276
280
277
281
- (CGFloat )_normalizedPowerLevelFromDecibels : (CGFloat )decibels {
You can’t perform that action at this time.
0 commit comments