Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AudioStreamBasicDescription audioFormat;
- audioFormat.mSampleRate = 44100.00;
- audioFormat.mFormatID = kAudioFormatLinearPCM;
- audioFormat.mFormatFlags = kAudioFormatFlagsCanonical;
- audioFormat.mBytesPerPacket = 2;
- audioFormat.mFramesPerPacket = 1;
- audioFormat.mBytesPerFrame = 2;
- audioFormat.mChannelsPerFrame = 1;
- audioFormat.mBitsPerChannel = 16;
- audioFormat.mReserved = 0;
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
- if(![[NSFileManager defaultManager] fileExistsAtPath:documentsDirectory])
- [[NSFileManager defaultManager] createDirectoryAtPath:documentsDirectory withIntermediateDirectories:YES attributes:nil error:nil];
- NSString *path = [documentsDirectory stringByAppendingPathComponent:@"audio.caf"];
- if(![[NSFileManager defaultManager] fileExistsAtPath:path])
- NSLog(@"file not exist.");
- NSLog(@"Path : %@", path);
- THIS->url = [NSURL fileURLWithPath:[path retain]];
- err = ExtAudioFileCreateWithURL((CFURLRef)THIS->url, kAudioFileCAFType, &audioFormat, NULL, kAudioFileFlags_EraseFile, &THIS->fOutputAudioFile);
- if(err != noErr){
- printf("create with url: error %dn", (int)err);
- }
- THIS->state = 2;
- err = ExtAudioFileSetProperty(THIS->fOutputAudioFile, kExtAudioFileProperty_ClientDataFormat, (UInt32)sizeof(audioFormat), &audioFormat);
- if(err != noErr){
- printf("file set property: error %dn", (int)err);
- }
- err = ExtAudioFileWriteAsync(THIS->fOutputAudioFile, 0, NULL);
- if(err != noErr){
- printf("write async: error %dn", (int)err);
- return err;
- }
- [pool release];
- err = ExtAudioFileWriteAsync(THIS->fOutputAudioFile, ioData->mNumberBuffers, ioData);
- if(err != noErr){
- printf("file write async: error %dn", (int)err);
- return err;
- }
- Program received signal: “EXC_BAD_ACCESS”.
- #0 0x30d04bb2 in memmove ()
- #1 0x33ba1d1e in AudioRingBuffer::Store ()
- #2 0x33c2269e in ExtAudioFile::WriteFramesAsync ()
- #3 0x33c278c8 in ExtAudioFileWriteAsync ()
- #4 0x00002e74 in PerformThru (inRefCon=0x14d9f0, ioActionFlags=0x2ffe77d4, inTimeStamp=0xa896fc, inBusNumber=0, inNumberFrames=256, ioData=0x14f680) at /Alex/project/ProStudio/TestAudioUnit/Classes/TestAudioUnitAppDelegate.mm:399
- #5 0x33b70896 in AUInputElement::PullInput ()
- #6 0x33b794a0 in AUInputFormatConverter2::InputProc ()
- #7 0x33b5560e in AudioConverterChain::CallInputProc ()
- #8 0x33b5555e in AudioConverterChain::FillBufferFromInputProc ()
- #9 0x33b5537c in BufferedAudioConverter::GetInputBytes ()
- #10 0x33b79390 in CBRConverter::RenderOutput ()
- #11 0x33b5505a in BufferedAudioConverter::FillBuffer ()
- #12 0x33b55362 in BufferedAudioConverter::GetInputBytes ()
- #13 0x33b79390 in CBRConverter::RenderOutput ()
- #14 0x33b5505a in BufferedAudioConverter::FillBuffer ()
- #15 0x33b551ae in AudioConverterChain::RenderOutput ()
- #16 0x33b5505a in BufferedAudioConverter::FillBuffer ()
- #17 0x33b54e2a in AudioConverterFillComplexBuffer ()
- #18 0x33b78f58 in AUConverterBase::RenderBus ()
- #19 0x33c08eea in AURemoteIO::RenderBus ()
- #20 0x33b5666e in AUBase::DoRender ()
- #21 0x33c09698 in AURemoteIO::PerformIO ()
- #22 0x33c09962 in AURIOCallbackReceiver_PerformIO ()
- #23 0x33c02448 in _XPerformIO ()
- #24 0x33b71bea in mshMIGPerform ()
- #25 0x33bd7de0 in MSHMIGDispatchMessage ()
- #26 0x33c0ebae in AURemoteIO::IOThread::Entry ()
- #27 0x33b4a1d8 in CAPThread::Entry ()
- #28 0x30d7d88c in _pthread_start ()
- #29 0x30d72a90 in thread_start ()
- audioFormat.mSampleRate = 44100.00;
- audioFormat.mFormatID = kAudioFormatLinearPCM;
- audioFormat.mFormatFlags = kAudioFormatFlagsCanonical | (kAudioUnitSampleFractionBits << kLinearPCMFormatFlagsSampleFractionShift) | kAudioFormatFlagIsNonInterleaved;
- audioFormat.mChannelsPerFrame = 2;
- audioFormat.mFramesPerPacket = 1;
- audioFormat.mBitsPerChannel = 8 * sizeof(AudioUnitSampleType);
- audioFormat.mBytesPerPacket = sizeof(AudioUnitSampleType);
- audioFormat.mBytesPerFrame = sizeof(AudioUnitSampleType);;
- audioFormat.mReserved = 0;
- AudioStreamBasicDescription audioFormat;
- audioFormat.mSampleRate = 44100.00;
- audioFormat.mFormatID = kAudioFormatLinearPCM;
- audioFormat.mFormatFlags = kAudioFormatFlagIsSignedInteger | kAudioFormatFlagIsPacked;
- audioFormat.mFramesPerPacket = 1;
- audioFormat.mChannelsPerFrame = 1;
- audioFormat.mBitsPerChannel = 16;
- audioFormat.mBytesPerPacket = 2;
- audioFormat.mBytesPerFrame = 2;
- audioFormat.mReserved = 0;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement