Hello, I have OpenEars working in my application but desperately need to record the audio to file. Any example of how to do this would be helpful. Here is the approach I have tried so far which does not work:
ContinuousModel.mm (Line 1322) :
NSUInteger dataLength = [wavData length];
SInt16 *wavSamples = (SInt16*)malloc(dataLength);
memcpy(wavSamples, [wavData bytes], dataLength);
/***** WRITE The WAV DATA TO FILE ******/
NSLog(@”Writing to file”);
NSFileHandle *file;
NSMutableData *data;
data = [NSMutableData dataWithBytes:wavSamples length:dataLength];
file = [NSFileHandle fileHandleForWritingAtPath: @”/tmp/quickfox.wav”];
if (file == nil)
NSLog(@”Failed to open file”);
[file writeData: data];
[file closeFile];
[file release];
/**************************************/
I have started a stackoverflow.com question for this as well: http://stackoverflow.com/questions/13427619/openears-how-to-record-audio-data-to-file