Bundled resources: Use NSBundle interface
These methods should use NSBundle, rather than CF* C functions Signed-off-by: Christopher Snowhill <kode54@gmail.com>CQTexperiment
parent
f3ddd69f63
commit
61a30c959c
|
@ -1244,10 +1244,7 @@ static float db_to_scale(float db)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!presetUrl) {
|
if (!presetUrl) {
|
||||||
CFURLRef appUrlRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("gsx"), CFSTR("wv"), NULL);
|
presetUrl = [[NSBundle mainBundle] URLForResource:@"gsx" withExtension:@"wv"];
|
||||||
if (appUrlRef)
|
|
||||||
presetUrl = (__bridge NSURL *) appUrlRef;
|
|
||||||
CFRelease(appUrlRef);
|
|
||||||
if (![HeadphoneFilter validateImpulseFile:presetUrl])
|
if (![HeadphoneFilter validateImpulseFile:presetUrl])
|
||||||
presetUrl = nil;
|
presetUrl = nil;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,20 +23,15 @@ static CAdPlugDatabase * g_database = NULL;
|
||||||
+ (void)initialize
|
+ (void)initialize
|
||||||
{
|
{
|
||||||
if (!g_database) {
|
if (!g_database) {
|
||||||
CFURLRef appUrlRef = CFBundleCopyResourceURL(CFBundleGetBundleWithIdentifier(CFSTR("net.kode54.AdPlug")), CFSTR("adplug"), CFSTR("db"), NULL);
|
NSURL * dbUrl = [[NSBundle bundleWithIdentifier:@"net.kode54.AdPlug"] URLForResource:@"adplug" withExtension:@"db"];
|
||||||
|
|
||||||
CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
|
NSString *dbPath = [dbUrl path];
|
||||||
|
|
||||||
NSString *dbPath = (__bridge NSString *) macPath;
|
|
||||||
|
|
||||||
if (dbPath) {
|
if (dbPath) {
|
||||||
g_database = new CAdPlugDatabase;
|
g_database = new CAdPlugDatabase;
|
||||||
g_database->load([dbPath UTF8String]);
|
g_database->load([dbPath UTF8String]);
|
||||||
|
|
||||||
CAdPlug::set_database( g_database );
|
CAdPlug::set_database( g_database );
|
||||||
|
|
||||||
CFRelease(macPath);
|
|
||||||
CFRelease(appUrlRef);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -136,11 +136,9 @@ static void loadPresets()
|
||||||
{
|
{
|
||||||
if ([equalizer_presets_processed count]) return;
|
if ([equalizer_presets_processed count]) return;
|
||||||
|
|
||||||
CFURLRef appUrlRef = CFBundleCopyResourceURL(CFBundleGetMainBundle(), CFSTR("Cog.q1"), CFSTR("json"), NULL);
|
NSURL * url = [[NSBundle mainBundle] URLForResource:@"Cog.q1" withExtension:@"json"];
|
||||||
|
|
||||||
CFStringRef macPath = CFURLCopyFileSystemPath(appUrlRef, kCFURLPOSIXPathStyle);
|
NSFileHandle * fileHandle = [NSFileHandle fileHandleForReadingAtPath:[url path]];
|
||||||
|
|
||||||
NSFileHandle * fileHandle = [NSFileHandle fileHandleForReadingAtPath:(__bridge NSString *)macPath];
|
|
||||||
if (fileHandle) {
|
if (fileHandle) {
|
||||||
NSError *err;
|
NSError *err;
|
||||||
NSData *data;
|
NSData *data;
|
||||||
|
@ -235,8 +233,6 @@ static void loadPresets()
|
||||||
json_value_free(equalizer_presets);
|
json_value_free(equalizer_presets);
|
||||||
equalizer_presets = NULL;
|
equalizer_presets = NULL;
|
||||||
}
|
}
|
||||||
CFRelease(macPath);
|
|
||||||
CFRelease(appUrlRef);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void equalizerApplyGenre(AudioUnit au, NSString *genre) {
|
void equalizerApplyGenre(AudioUnit au, NSString *genre) {
|
||||||
|
|
Loading…
Reference in New Issue