extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int segmentSize);
extern void freeAudioBufferList(AudioBufferList *bufferList);
-extern CFURLRef getURLFromPath(const char * path);
+extern CFURLRef createURLFromPath(const char * path);
char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
uint_t aubio_sink_apple_audio_open(aubio_sink_apple_audio_t *s);
clientFormat.mReserved = 0;
AudioFileTypeID fileType = kAudioFileWAVEType;
- CFURLRef fileURL = getURLFromPath(s->path);
+ CFURLRef fileURL = createURLFromPath(s->path);
bool overwrite = true;
OSStatus err = noErr;
err = ExtAudioFileCreateWithURL(fileURL, fileType, &clientFormat, NULL,
overwrite ? kAudioFileFlags_EraseFile : 0, &s->audioFile);
+ CFRelease(fileURL);
if (err) {
char_t errorstr[20];
AUBIO_ERR("sink_apple_audio: error when trying to create %s with "
extern int createAubioBufferList(AudioBufferList *bufferList, int channels, int max_source_samples);
extern void freeAudioBufferList(AudioBufferList *bufferList);
-extern CFURLRef getURLFromPath(const char * path);
+extern CFURLRef createURLFromPath(const char * path);
char_t *getPrintableOSStatusError(char_t *str, OSStatus error);
uint_t aubio_source_apple_audio_open (aubio_source_apple_audio_t *s, char_t * path);
s->path = path;
// open the resource url
- CFURLRef fileURL = getURLFromPath(path);
+ CFURLRef fileURL = createURLFromPath(path);
err = ExtAudioFileOpenURL(fileURL, &s->audioFile);
+ CFRelease(fileURL);
if (err == -43) {
AUBIO_ERR("source_apple_audio: Failed opening %s, "
"file not found, or no read access\n", s->path);
bufferList = NULL;
}
-CFURLRef getURLFromPath(const char * path) {
+CFURLRef createURLFromPath(const char * path) {
CFStringRef cfTotalPath = CFStringCreateWithCString (kCFAllocatorDefault,
path, kCFStringEncodingUTF8);
- return CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
+ CFURLRef url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, cfTotalPath,
kCFURLPOSIXPathStyle, false);
+ CFRelease(cfTotalPath);
+ return url;
}
char_t *getPrintableOSStatusError(char_t *str, OSStatus error)