audio file bug in AudioUnitHosting
audio file bug in AudioUnitHosting
- Subject: audio file bug in AudioUnitHosting
- From: Marc Poirier <email@hidden>
- Date: Sun, 4 Jan 2004 11:09:50 -0600 (CST)
I just submitted this to RADAR, but I figured I'd post it here, too (and
my suggested fix) for anyone who might find it useful:
AudioUnitHosting has a bug with resolving the file paths of audio files
dropped onto its DataBrowser. It relies on CFStringGetCStringPtr() to get
a C string version of the CFString file path, which is failing in this
case 100% of the time, so AUH keeps aborting with an exception thrown
right after that when FSPathMakeRef fails.
I've changed the source code to convert the CFStringRef path to a CFURLRef
(instead of a C string) and then convert the CFURLRef to an FSRef, and now
it works reliably. The changes need to be made to
AudioEffectHosting::SelectedFile() and MusicDeviceHosting::SelectedFile()
in AudioUnitHosting.cpp. In both functions, you need to replace these
lines:
UInt8* thePath = (UInt8*)CFStringGetCStringPtr (inFilePath, kCFStringEncodingUTF8);
FSRef ref;
RequireNoErr(FSPathMakeRef ((const UInt8 *)thePath, &ref, NULL));
with these lines:
FSRef ref;
Boolean success = false;
if (inFilePath != NULL)
{
CFURLRef fileUrl = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inFilePath, kCFURLPOSIXPathStyle, false);
if (fileUrl != NULL)
{
success = CFURLGetFSRef(fileUrl, &ref);
CFRelease(fileUrl);
}
}
if (!success)
return;
_______________________________________________
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.