Skip to content

Commit 8a6086a

Browse files
authored
fix(iOS): Using default framelength (#361)
* fix: using default framelength * try catch brackets * Remove logs * Update Voice.m clear logs and comments
1 parent f9d8464 commit 8a6086a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

ios/Voice/Voice.m

+6-2
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
163163
self.audioEngine = [[AVAudioEngine alloc] init];
164164
}
165165

166+
@try {
166167
AVAudioInputNode* inputNode = self.audioEngine.inputNode;
167168
if (inputNode == nil) {
168169
[self sendResult:@{@"code": @"input"} :nil :nil :nil];
@@ -223,8 +224,6 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
223224
@try {
224225
[mixer installTapOnBus:0 bufferSize:1024 format:recordingFormat block:^(AVAudioPCMBuffer * _Nonnull buffer, AVAudioTime * _Nonnull when) {
225226
//Volume Level Metering
226-
//Buffer frame can be reduced, if you need more output values
227-
[buffer setFrameLength: buffer.frameCapacity];
228227
UInt32 inNumberFrames = buffer.frameLength;
229228
float LEVEL_LOWPASS_TRIG = 0.5;
230229
if(buffer.format.channelCount>0)
@@ -272,6 +271,11 @@ - (void) setupAndStartRecognizing:(NSString*)localeStr {
272271
[self teardown];
273272
return;
274273
}
274+
}
275+
@catch (NSException *exception) {
276+
[self sendResult:@{@"code": @"start_recording", @"message": [exception reason]} :nil :nil :nil];
277+
return;
278+
}
275279
}
276280

277281
- (CGFloat)_normalizedPowerLevelFromDecibels:(CGFloat)decibels {

0 commit comments

Comments
 (0)