mirror of
https://github.com/thestk/stk
synced 2026-05-03 12:28:11 +00:00
ensure bundle url is there before making a C string from it
This commit is contained in:
24
src/Stk.cpp
24
src/Stk.cpp
@@ -89,19 +89,21 @@ void Stk :: setRawwavePathForDynamicallyLoadedRawwaves ( void )
|
|||||||
#ifdef __OS_IOS__
|
#ifdef __OS_IOS__
|
||||||
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
CFBundleRef mainBundle = CFBundleGetMainBundle();
|
||||||
CFURLRef url = CFBundleCopyResourceURL(mainBundle, CFSTR("rawwaves"), CFSTR("bundle"), NULL);
|
CFURLRef url = CFBundleCopyResourceURL(mainBundle, CFSTR("rawwaves"), CFSTR("bundle"), NULL);
|
||||||
CFStringRef rawwavesPathCFString = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
|
if (url) {
|
||||||
CFIndex length = CFStringGetLength(rawwavesPathCFString);
|
CFStringRef rawwavesPathCFString = CFURLCopyFileSystemPath(url, kCFURLPOSIXPathStyle);
|
||||||
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
|
CFIndex length = CFStringGetLength(rawwavesPathCFString);
|
||||||
char *rawwavesPathCString = (char *)malloc(maxSize);
|
CFIndex maxSize = CFStringGetMaximumSizeForEncoding(length, kCFStringEncodingUTF8);
|
||||||
CFStringGetCString(rawwavesPathCFString, rawwavesPathCString, maxSize, kCFStringEncodingUTF8);
|
char *rawwavesPathCString = (char *)malloc(maxSize);
|
||||||
std::string str(rawwavesPathCString);
|
CFStringGetCString(rawwavesPathCFString, rawwavesPathCString, maxSize, kCFStringEncodingUTF8);
|
||||||
setRawwavePath(rawwavesPathCString);
|
std::string str(rawwavesPathCString);
|
||||||
|
setRawwavePath(rawwavesPathCString);
|
||||||
|
|
||||||
CFRelease(url);
|
CFRelease(url);
|
||||||
CFRelease(rawwavesPathCFString);
|
CFRelease(rawwavesPathCFString);
|
||||||
#endif
|
|
||||||
rawwavesPathSet = true;
|
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
rawwavesPathSet = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stk :: setSampleRate( StkFloat rate )
|
void Stk :: setSampleRate( StkFloat rate )
|
||||||
|
|||||||
Reference in New Issue
Block a user