RecordableFile.cpp
RecordableFile.cpp
- Subject: RecordableFile.cpp
- From: Craig Bakalian <email@hidden>
- Date: Mon, 1 Dec 2003 20:12:19 -0500
Hi,
In the DiskWriterAUGraph I am having difficulty with the following
constructor. The AudioFileCreate is causing an BAD ACCESS. I am
passing an okay directory and file name. I can't figure out what is
going on. Furthermore the file is created on my hard drive, the the
second time I test it pops into the the if(result != noErr) and walks
into the the rest of the process. What am I doing wrong here? What am
I passing into AudioFileCreate to cause a BAD ACCESS. This is what I
am getting before the bad access, in printf - created file:
/Users/craigbakalian/Desktop/Untitled_Channel_0.aif or that is what I
am passing in for file management.
FSRef directoryRef;
OSStatus result = noErr;
printf ("created file: %s%s\n", inDirectory, inFileName);
result = FSPathMakeRef ((const UInt8 *)inDirectory, &directoryRef,
NULL);
THROW_RESULT("FSPathMakeRef")
CFStringRef fileNameRef = CFStringCreateWithCStringNoCopy (NULL,
inFileName, CFStringGetSystemEncoding(), NULL);
mInputStreamFormat.mSampleRate = inInputStreamFormat->mSampleRate;
mInputStreamFormat.mFormatID = inInputStreamFormat->mFormatID;
mInputStreamFormat.mFormatFlags = inInputStreamFormat->mFormatFlags;
mInputStreamFormat.mBytesPerPacket
= inInputStreamFormat->mBytesPerPacket;
mInputStreamFormat.mFramesPerPacket
= inInputStreamFormat->mFramesPerPacket;
mInputStreamFormat.mBytesPerFrame
= inInputStreamFormat->mBytesPerFrame;
mInputStreamFormat.mChannelsPerFrame
= inInputStreamFormat->mChannelsPerFrame;
mInputStreamFormat.mBitsPerChannel
= inInputStreamFormat->mBitsPerChannel;
mFileStreamFormat.mSampleRate = mInputStreamFormat.mSampleRate;
mFileStreamFormat.mFormatID = kAudioFormatLinearPCM;
mFileStreamFormat.mFormatFlags=
kLinearPCMFormatFlagIsSignedInteger|kLinearPCMFormatFlagIsPacked|kLinear
PCMFormatFlagIsBigEndian;
mFileStreamFormat.mBytesPerPacket = 2;
mFileStreamFormat.mFramesPerPacket = 1;
mFileStreamFormat.mBytesPerFrame = 2;
mFileStreamFormat.mChannelsPerFrame = 1;
mFileStreamFormat.mBitsPerChannel = 16;
result = AudioFileCreate(&directoryRef, fileNameRef,
kAudioFileAIFFType, &mFileStreamFormat, 0, NULL, &mFileID);
if (result != noErr)
{
char* directoryAndFile = new char[1024];
FSRef dirAndFileRef;
strcpy (directoryAndFile, inDirectory);
strcat (directoryAndFile, inFileName);
result = FSPathMakeRef ((const UInt8 *)directoryAndFile,
&dirAndFileRef, NULL);
THROW_RESULT("FSPathMakeRef")
result =
AudioFileInitialize(&dirAndFileRef,kAudioFileAIFFType,&mFileStreamFormat
,0,&mFileID);
THROW_RESULT("AudioFileInitialize")
}
Craig Bakalian
www.eThinkingCap.com
_______________________________________________
coreaudio-api mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/coreaudio-api
Do not post admin requests to the list. They will be ignored.