diff --git a/examples/iOS/Obj-C/Pods/EZAudio/EZAudio/EZAudioFloatConverter.m b/examples/iOS/Obj-C/Pods/EZAudio/EZAudio/EZAudioFloatConverter.m index bf7bff92..e496e5df 100644 --- a/examples/iOS/Obj-C/Pods/EZAudio/EZAudio/EZAudioFloatConverter.m +++ b/examples/iOS/Obj-C/Pods/EZAudio/EZAudio/EZAudioFloatConverter.m @@ -213,13 +213,16 @@ - (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList // // Fill out the audio converter with the source buffer // - [EZAudioUtilities checkResult:AudioConverterFillComplexBuffer(self.info->converterRef, - EZAudioFloatConverterCallback, - audioBufferList, - &frames, - self.info->floatAudioBufferList, - packetDescriptions ? packetDescriptions : self.info->packetDescriptions) - operation:"Failed to fill complex buffer in float converter"]; + OSStatus status = AudioConverterFillComplexBuffer(self.info->converterRef, + EZAudioFloatConverterCallback, + audioBufferList, + &frames, + self.info->floatAudioBufferList, + packetDescriptions ? packetDescriptions : self.info->packetDescriptions); + if (status > 0 ) { + AudioConverterReset(self.info->converterRef); +// NSLog(@"Audio Converter Failed! Reseted."); + } // // Copy the converted buffers into the float buffer array stored @@ -236,4 +239,4 @@ - (void)convertDataFromAudioBufferList:(AudioBufferList *)audioBufferList //------------------------------------------------------------------------------ -@end \ No newline at end of file +@end diff --git a/examples/iOS/Obj-C/SnowboyTest/ViewController.mm b/examples/iOS/Obj-C/SnowboyTest/ViewController.mm index 16467f6e..3d2bc5ca 100644 --- a/examples/iOS/Obj-C/SnowboyTest/ViewController.mm +++ b/examples/iOS/Obj-C/SnowboyTest/ViewController.mm @@ -34,7 +34,16 @@ - (void)initSnowboy { _snowboyDetect->ApplyFrontend(false); } +- (void) configureAudioSession +{ + AVAudioSession *session = [AVAudioSession sharedInstance]; + [session setActive:NO error:NULL]; + [session setCategory:AVAudioSessionCategoryRecord error:NULL]; + [session setPreferredSampleRate:16000 error:NULL]; + [session setActive:YES error:NULL]; +} - (void) initMic { + [self configureAudioSession]; AudioStreamBasicDescription audioStreamBasicDescription = [EZAudioUtilities monoFloatFormatWithSampleRate:16000]; audioStreamBasicDescription.mFormatID = kAudioFormatLinearPCM; audioStreamBasicDescription.mSampleRate = 16000; @@ -49,6 +58,7 @@ - (void) initMic { NSArray *inputs = [EZAudioDevice inputDevices]; [self.microphone setDevice:[inputs lastObject]]; self.microphone = [EZMicrophone microphoneWithDelegate:self withAudioStreamBasicDescription:audioStreamBasicDescription]; + [self.microphone startFetchingAudio]; }