make the C-like parts more consistent with MAME (nw)

This commit is contained in:
Vas Crabb 2017-09-09 12:41:37 +10:00
parent 8c002c645c
commit f8d7be5164

View File

@ -55,7 +55,8 @@ static NSString *const ForceGenericViewKey = @"ForceGenericView";
static NSString *const WindowFrameKey = @"WindowFrame"; static NSString *const WindowFrameKey = @"WindowFrame";
static void UpdateChangeCountCallback(void *userData, static void UpdateChangeCountCallback(
void *userData,
void *object, void *object,
AudioUnitEvent const *inEvent, AudioUnitEvent const *inEvent,
UInt64 inEventHostTime, UInt64 inEventHostTime,
@ -99,14 +100,15 @@ static void UpdateChangeCountCallback(void *userData,
@implementation AUEffectDocument @implementation AUEffectDocument
- (void)loadEffectUI { - (void)loadEffectUI {
if ((0 == effectNode) || (nil == window)) if ((0 == effectNode) || !window)
return; return;
BOOL customViewValid = NO; BOOL customViewValid = NO;
OSStatus status; OSStatus status;
UInt32 uiDescSize; UInt32 uiDescSize;
AudioUnitCocoaViewInfo *viewInfo; AudioUnitCocoaViewInfo *viewInfo;
status = AudioUnitGetPropertyInfo(effectUnit, status = AudioUnitGetPropertyInfo(
effectUnit,
kAudioUnitProperty_CocoaUI, kAudioUnitProperty_CocoaUI,
kAudioUnitScope_Global, kAudioUnitScope_Global,
0, 0,
@ -126,7 +128,7 @@ static void UpdateChangeCountCallback(void *userData,
{ {
NSBundle *const bundle = [NSBundle bundleWithPath:[(NSURL *)viewInfo->mCocoaAUViewBundleLocation path]]; NSBundle *const bundle = [NSBundle bundleWithPath:[(NSURL *)viewInfo->mCocoaAUViewBundleLocation path]];
Class const viewClass = [bundle classNamed:(NSString *)viewInfo->mCocoaAUViewClass[0]]; Class const viewClass = [bundle classNamed:(NSString *)viewInfo->mCocoaAUViewClass[0]];
if ((NULL != viewClass) if (viewClass
&& [viewClass conformsToProtocol:@protocol(AUCocoaUIBase)] && [viewClass conformsToProtocol:@protocol(AUCocoaUIBase)]
&& [viewClass instancesRespondToSelector:@selector(uiViewForAudioUnit:withSize:)]) && [viewClass instancesRespondToSelector:@selector(uiViewForAudioUnit:withSize:)])
{ {
@ -145,7 +147,7 @@ static void UpdateChangeCountCallback(void *userData,
} }
free(viewInfo); free(viewInfo);
} }
if (nil == view) if (!view)
{ {
view = [[[AUGenericView alloc] initWithAudioUnit:effectUnit] autorelease]; view = [[[AUGenericView alloc] initWithAudioUnit:effectUnit] autorelease];
[(AUGenericView *)view setShowsExpertParameters:YES]; [(AUGenericView *)view setShowsExpertParameters:YES];
@ -190,7 +192,8 @@ static void UpdateChangeCountCallback(void *userData,
} }
- (id)init { - (id)init {
if (!(self = [super init])) return nil; if (!(self = [super init]))
return nil;
window = nil; window = nil;
genericViewButton = nil; genericViewButton = nil;
@ -232,16 +235,16 @@ static void UpdateChangeCountCallback(void *userData,
} }
- (void)dealloc { - (void)dealloc {
if (NULL != presets) if (presets)
CFRelease(presets); CFRelease(presets);
if (NULL != listener) if (listener)
AUListenerDispose(listener); AUListenerDispose(listener);
if (nil != restoreFrame) if (restoreFrame)
[restoreFrame release]; [restoreFrame release];
if (NULL != graph) if (graph)
{ {
AUGraphClose(graph); AUGraphClose(graph);
DisposeAUGraph(graph); DisposeAUGraph(graph);
@ -272,11 +275,13 @@ static void UpdateChangeCountCallback(void *userData,
[presetButton sizeToFit]; [presetButton sizeToFit];
CGFloat const controlWidth = MAX(NSWidth([genericViewButton frame]), NSWidth([presetButton frame])); CGFloat const controlWidth = MAX(NSWidth([genericViewButton frame]), NSWidth([presetButton frame]));
NSRect const presetFrame = NSMakeRect(17, NSRect const presetFrame = NSMakeRect(
17,
8, 8,
controlWidth, controlWidth,
NSHeight([presetButton frame])); NSHeight([presetButton frame]));
NSRect const genericViewFrame = NSMakeRect(17, NSRect const genericViewFrame = NSMakeRect(
17,
NSMaxY(presetFrame) + 9, NSMaxY(presetFrame) + 9,
controlWidth, controlWidth,
NSHeight([genericViewButton frame])); NSHeight([genericViewButton frame]));
@ -310,7 +315,7 @@ static void UpdateChangeCountCallback(void *userData,
[window release]; [window release];
[self loadEffectUI]; [self loadEffectUI];
if (nil != restoreFrame) if (restoreFrame)
{ {
[window setFrameFromString:restoreFrame]; [window setFrameFromString:restoreFrame];
} }
@ -331,7 +336,7 @@ static void UpdateChangeCountCallback(void *userData,
BOOL const hasWrapper = [type isEqualToString:AUEffectDocumentType]; BOOL const hasWrapper = [type isEqualToString:AUEffectDocumentType];
if (!hasWrapper && ![type isEqualToString:AUPresetDocumentType]) if (!hasWrapper && ![type isEqualToString:AUPresetDocumentType])
{ {
if (NULL != error) if (error)
{ {
NSString *const message = [NSString stringWithFormat:@"Unsupported document type %@", type]; NSString *const message = [NSString stringWithFormat:@"Unsupported document type %@", type];
NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey, NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey,
@ -346,16 +351,16 @@ static void UpdateChangeCountCallback(void *userData,
mutabilityOption:0 mutabilityOption:0
format:NULL format:NULL
errorDescription:&errDesc]; errorDescription:&errDesc];
if ((nil == desc) || ![desc isKindOfClass:[NSDictionary class]] || (nil != errDesc)) if (!desc || ![desc isKindOfClass:[NSDictionary class]] || errDesc)
{ {
if (NULL != error) if (error)
{ {
NSString *const message = [NSString stringWithFormat:@"Error in file format (%@)", errDesc]; NSString *const message = [NSString stringWithFormat:@"Error in file format (%@)", errDesc];
NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey, NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey,
nil]; nil];
*error = [NSError errorWithDomain:AUEffectUtilErrorDomain code:0 userInfo:info]; *error = [NSError errorWithDomain:AUEffectUtilErrorDomain code:0 userInfo:info];
} }
if (nil != errDesc) if (errDesc)
[errDesc release]; [errDesc release];
return NO; return NO;
} }
@ -363,12 +368,12 @@ static void UpdateChangeCountCallback(void *userData,
id const typeValue = [desc objectForKey:(hasWrapper ? ComponentTypeKey : (NSString *)CFSTR(kAUPresetTypeKey))]; id const typeValue = [desc objectForKey:(hasWrapper ? ComponentTypeKey : (NSString *)CFSTR(kAUPresetTypeKey))];
id const subtypeValue = [desc objectForKey:(hasWrapper ? ComponentSubTypeKey : (NSString *)CFSTR(kAUPresetSubtypeKey))]; id const subtypeValue = [desc objectForKey:(hasWrapper ? ComponentSubTypeKey : (NSString *)CFSTR(kAUPresetSubtypeKey))];
id const manufacturerValue = [desc objectForKey:(hasWrapper ? ComponentManufacturerKey : (NSString *)CFSTR(kAUPresetManufacturerKey))]; id const manufacturerValue = [desc objectForKey:(hasWrapper ? ComponentManufacturerKey : (NSString *)CFSTR(kAUPresetManufacturerKey))];
if ((nil == typeValue) || ![typeValue isKindOfClass:[NSNumber class]] if (!typeValue || ![typeValue isKindOfClass:[NSNumber class]]
|| (nil == subtypeValue) || ![subtypeValue isKindOfClass:[NSNumber class]] || !subtypeValue || ![subtypeValue isKindOfClass:[NSNumber class]]
|| (nil == manufacturerValue) || ![manufacturerValue isKindOfClass:[NSNumber class]] || !manufacturerValue || ![manufacturerValue isKindOfClass:[NSNumber class]]
|| ([typeValue unsignedLongValue] != kAudioUnitType_Effect)) || ([typeValue unsignedLongValue] != kAudioUnitType_Effect))
{ {
if (NULL != error) if (error)
{ {
NSString *const message = @"Error in effect description file format"; NSString *const message = @"Error in effect description file format";
NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey, NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:message, NSLocalizedDescriptionKey,
@ -378,17 +383,17 @@ static void UpdateChangeCountCallback(void *userData,
return NO; return NO;
} }
if (NULL != presets) if (presets)
{ {
CFRelease(presets); CFRelease(presets);
presets = NULL; presets = NULL;
} }
if (NULL != listener) if (listener)
{ {
AUListenerDispose(listener); AUListenerDispose(listener);
listener = NULL; listener = NULL;
} }
if (nil != view) if (view)
{ {
[[NSNotificationCenter defaultCenter] removeObserver:self [[NSNotificationCenter defaultCenter] removeObserver:self
name:NSViewFrameDidChangeNotification name:NSViewFrameDidChangeNotification
@ -408,14 +413,19 @@ static void UpdateChangeCountCallback(void *userData,
description.componentManufacturer = [manufacturerValue longValue]; description.componentManufacturer = [manufacturerValue longValue];
status = noErr; status = noErr;
status = AUGraphClearConnections(graph); status = AUGraphClearConnections(graph);
if (noErr == status) status = AUGraphAddNode(graph, &description, &effectNode); if (noErr == status)
if (noErr == status) status = AUGraphNodeInfo(graph, effectNode, NULL, &effectUnit); status = AUGraphAddNode(graph, &description, &effectNode);
if (noErr == status) status = AUGraphConnectNodeInput(graph, sourceNode, 0, effectNode, 0); if (noErr == status)
if (noErr == status) status = AUGraphConnectNodeInput(graph, effectNode, 0, outputNode, 0); status = AUGraphNodeInfo(graph, effectNode, NULL, &effectUnit);
if (noErr == status) status = AUGraphUpdate(graph, NULL); if (noErr == status)
status = AUGraphConnectNodeInput(graph, sourceNode, 0, effectNode, 0);
if (noErr == status)
status = AUGraphConnectNodeInput(graph, effectNode, 0, outputNode, 0);
if (noErr == status)
status = AUGraphUpdate(graph, NULL);
if (noErr != status) if (noErr != status)
{ {
if (NULL != error) if (error)
{ {
NSString * const message = @"Error encountered while configuring AudioUnit graph"; NSString * const message = @"Error encountered while configuring AudioUnit graph";
NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
@ -428,19 +438,21 @@ static void UpdateChangeCountCallback(void *userData,
} }
CFPropertyListRef const classInfo = (CFPropertyListRef)(hasWrapper ? [desc objectForKey:ClassInfoKey] : desc); CFPropertyListRef const classInfo = (CFPropertyListRef)(hasWrapper ? [desc objectForKey:ClassInfoKey] : desc);
if (NULL != classInfo) if (classInfo)
{ {
AudioUnitParameter change = { effectUnit, kAUParameterListener_AnyParameter, 0, 0 }; AudioUnitParameter change = { effectUnit, kAUParameterListener_AnyParameter, 0, 0 };
status = AudioUnitSetProperty(effectUnit, status = AudioUnitSetProperty(
effectUnit,
kAudioUnitProperty_ClassInfo, kAudioUnitProperty_ClassInfo,
kAudioUnitScope_Global, kAudioUnitScope_Global,
0, 0,
&classInfo, &classInfo,
sizeof(classInfo)); sizeof(classInfo));
if (noErr == status) status = AUParameterListenerNotify(NULL, NULL, &change); if (noErr == status)
status = AUParameterListenerNotify(NULL, NULL, &change);
if (noErr != status) if (noErr != status)
{ {
if (NULL != error) if (error)
{ {
NSString * const message = @"Error configuring effect"; NSString * const message = @"Error configuring effect";
NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
@ -463,7 +475,7 @@ static void UpdateChangeCountCallback(void *userData,
NULL); NULL);
if (noErr != status) if (noErr != status)
{ {
if (NULL != error) if (error)
{ {
NSString * const message = @"Error getting effect parameters"; NSString * const message = @"Error getting effect parameters";
NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
@ -477,7 +489,8 @@ static void UpdateChangeCountCallback(void *userData,
UInt32 const paramCount = propertySize / sizeof(AudioUnitParameterID); UInt32 const paramCount = propertySize / sizeof(AudioUnitParameterID);
if (0U < paramCount) if (0U < paramCount)
{ {
status = AUEventListenerCreate(UpdateChangeCountCallback, status = AUEventListenerCreate(
UpdateChangeCountCallback,
self, self,
CFRunLoopGetCurrent(), CFRunLoopGetCurrent(),
kCFRunLoopDefaultMode, kCFRunLoopDefaultMode,
@ -486,7 +499,7 @@ static void UpdateChangeCountCallback(void *userData,
&listener); &listener);
if (noErr != status) if (noErr != status)
{ {
if (NULL != error) if (error)
{ {
NSString * const message = @"Error creating AudioUnit event listener"; NSString * const message = @"Error creating AudioUnit event listener";
NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
@ -508,7 +521,7 @@ static void UpdateChangeCountCallback(void *userData,
if (noErr != status) if (noErr != status)
{ {
free(params); free(params);
if (NULL != error) if (error)
{ {
NSString * const message = @"Error getting effect parameters"; NSString * const message = @"Error getting effect parameters";
NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
@ -533,7 +546,7 @@ static void UpdateChangeCountCallback(void *userData,
if (noErr != status) if (noErr != status)
{ {
free(params); free(params);
if (NULL != error) if (error)
{ {
NSString * const message = @"Error getting effect parameters"; NSString * const message = @"Error getting effect parameters";
NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil]; NSError *const underlying = [NSError errorWithDomain:NSOSStatusErrorDomain code:status userInfo:nil];
@ -547,13 +560,14 @@ static void UpdateChangeCountCallback(void *userData,
} }
propertySize = sizeof(presets); propertySize = sizeof(presets);
status = AudioUnitGetProperty(effectUnit, status = AudioUnitGetProperty(
effectUnit,
kAudioUnitProperty_FactoryPresets, kAudioUnitProperty_FactoryPresets,
kAudioUnitScope_Global, kAudioUnitScope_Global,
0, 0,
&presets, &presets,
&propertySize); &propertySize);
if ((noErr != status) && (NULL != presets)) if ((noErr != status) && presets)
{ {
CFRelease(presets); CFRelease(presets);
presets = NULL; presets = NULL;
@ -561,16 +575,17 @@ static void UpdateChangeCountCallback(void *userData,
if (hasWrapper) if (hasWrapper)
{ {
if ((nil != [desc objectForKey:ForceGenericViewKey]) if ([desc objectForKey:ForceGenericViewKey]
&& [[desc objectForKey:ForceGenericViewKey] respondsToSelector:@selector(boolValue)]) && [[desc objectForKey:ForceGenericViewKey] respondsToSelector:@selector(boolValue)])
{ {
forceGenericView = [[desc objectForKey:ForceGenericViewKey] boolValue]; forceGenericView = [[desc objectForKey:ForceGenericViewKey] boolValue];
[genericViewButton setState:(forceGenericView ? NSOnState : NSOffState)]; [genericViewButton setState:(forceGenericView ? NSOnState : NSOffState)];
} }
if ((nil != [desc objectForKey:WindowFrameKey]) if ([desc objectForKey:WindowFrameKey]
&& [[desc objectForKey:WindowFrameKey] isKindOfClass:[NSString class]]) && [[desc objectForKey:WindowFrameKey] isKindOfClass:[NSString class]])
{ {
if (nil != restoreFrame) [restoreFrame release]; if (restoreFrame)
[restoreFrame release];
restoreFrame = [[NSString alloc] initWithString:[desc objectForKey:WindowFrameKey]]; restoreFrame = [[NSString alloc] initWithString:[desc objectForKey:WindowFrameKey]];
} }
} }
@ -583,7 +598,8 @@ static void UpdateChangeCountCallback(void *userData,
- (NSData *)dataOfType:(NSString *)type error:(NSError **)error { - (NSData *)dataOfType:(NSString *)type error:(NSError **)error {
CFPropertyListRef classInfo; CFPropertyListRef classInfo;
UInt32 infoSize = sizeof(classInfo); UInt32 infoSize = sizeof(classInfo);
OSStatus const status = AudioUnitGetProperty(effectUnit, OSStatus const status = AudioUnitGetProperty(
effectUnit,
kAudioUnitProperty_ClassInfo, kAudioUnitProperty_ClassInfo,
kAudioUnitScope_Global, kAudioUnitScope_Global,
0, 0,
@ -623,7 +639,7 @@ static void UpdateChangeCountCallback(void *userData,
desc = [NSDictionary dictionaryWithDictionary:(NSDictionary *)classInfo]; desc = [NSDictionary dictionaryWithDictionary:(NSDictionary *)classInfo];
} }
CFRelease(classInfo); CFRelease(classInfo);
if (nil == desc) if (!desc)
{ {
NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:@"Unsupported document type", NSLocalizedDescriptionKey, NSDictionary *const info = [NSDictionary dictionaryWithObjectsAndKeys:@"Unsupported document type", NSLocalizedDescriptionKey,
nil]; nil];
@ -635,12 +651,12 @@ static void UpdateChangeCountCallback(void *userData,
NSData *const data = [NSPropertyListSerialization dataFromPropertyList:desc NSData *const data = [NSPropertyListSerialization dataFromPropertyList:desc
format:NSPropertyListXMLFormat_v1_0 format:NSPropertyListXMLFormat_v1_0
errorDescription:&errDesc]; errorDescription:&errDesc];
if ((nil == data) || (nil != errDesc)) if (!data || errDesc)
{ {
if (NULL != error) if (error)
{ {
NSString *message; NSString *message;
if (nil != errDesc) if (errDesc)
message = [NSString stringWithFormat:@"Error serialising effect settings: %@", errDesc]; message = [NSString stringWithFormat:@"Error serialising effect settings: %@", errDesc];
else else
message = @"Error serialising effect settings"; message = @"Error serialising effect settings";
@ -648,7 +664,8 @@ static void UpdateChangeCountCallback(void *userData,
nil]; nil];
*error = [NSError errorWithDomain:AUEffectUtilErrorDomain code:0 userInfo:info]; *error = [NSError errorWithDomain:AUEffectUtilErrorDomain code:0 userInfo:info];
} }
if (nil != errDesc) [errDesc release]; if (errDesc)
[errDesc release];
return nil; return nil;
} }
return data; return data;
@ -656,7 +673,7 @@ static void UpdateChangeCountCallback(void *userData,
- (IBAction)toggleGenericView:(id)sender { - (IBAction)toggleGenericView:(id)sender {
forceGenericView = (NSOnState == [sender state]); forceGenericView = (NSOnState == [sender state]);
if (nil != view) if (view)
{ {
[[NSNotificationCenter defaultCenter] removeObserver:self [[NSNotificationCenter defaultCenter] removeObserver:self
name:NSViewFrameDidChangeNotification name:NSViewFrameDidChangeNotification
@ -685,7 +702,8 @@ static void UpdateChangeCountCallback(void *userData,
} }
AUPreset const *preset = (AUPreset const *)CFArrayGetValueAtIndex(presets, idx); AUPreset const *preset = (AUPreset const *)CFArrayGetValueAtIndex(presets, idx);
status = AudioUnitSetProperty(effectUnit, status = AudioUnitSetProperty(
effectUnit,
kAudioUnitProperty_PresentPreset, kAudioUnitProperty_PresentPreset,
kAudioUnitScope_Global, kAudioUnitScope_Global,
0, 0,
@ -718,7 +736,8 @@ static void UpdateChangeCountCallback(void *userData,
- (void)viewFrameDidChange:(NSNotification *)notification { - (void)viewFrameDidChange:(NSNotification *)notification {
NSRect const oldFrame = [window frame]; NSRect const oldFrame = [window frame];
NSRect const desired = [window frameRectForContentRect:[[notification object] frame]]; NSRect const desired = [window frameRectForContentRect:[[notification object] frame]];
NSRect const newFrame = NSMakeRect(oldFrame.origin.x, NSRect const newFrame = NSMakeRect(
oldFrame.origin.x,
oldFrame.origin.y + oldFrame.size.height - headerSize.height- desired.size.height, oldFrame.origin.y + oldFrame.size.height - headerSize.height- desired.size.height,
desired.size.width, desired.size.width,
headerSize.height + desired.size.height); headerSize.height + desired.size.height);
@ -859,13 +878,15 @@ static void UpdateChangeCountCallback(void *userData,
} }
- (id)init { - (id)init {
if (!(self = [super init])) return nil; if (!(self = [super init]))
return nil;
effects = NULL; effects = NULL;
return self; return self;
} }
- (void)dealloc { - (void)dealloc {
if (effects) free(effects); if (effects)
free(effects);
[super dealloc]; [super dealloc];
} }
@ -893,12 +914,13 @@ static void UpdateChangeCountCallback(void *userData,
NSData *const data = [NSPropertyListSerialization dataFromPropertyList:desc NSData *const data = [NSPropertyListSerialization dataFromPropertyList:desc
format:NSPropertyListXMLFormat_v1_0 format:NSPropertyListXMLFormat_v1_0
errorDescription:&errDesc]; errorDescription:&errDesc];
if ((nil == data) || (nil != errDesc)) if (!data || errDesc)
{ {
NSAlert *const alert = [[NSAlert alloc] init]; NSAlert *const alert = [[NSAlert alloc] init];
[alert setAlertStyle:NSWarningAlertStyle]; [alert setAlertStyle:NSWarningAlertStyle];
[alert setMessageText:@"Error serialising properties for new effect"]; [alert setMessageText:@"Error serialising properties for new effect"];
if (nil != errDesc) [alert setInformativeText:[errDesc autorelease]]; if (errDesc)
[alert setInformativeText:[errDesc autorelease]];
[alert addButtonWithTitle:@"OK"]; [alert addButtonWithTitle:@"OK"];
[alert runModal]; [alert runModal];
[alert release]; [alert release];
@ -907,10 +929,10 @@ static void UpdateChangeCountCallback(void *userData,
NSError *err = nil; NSError *err = nil;
AUEffectDocument *const document = [[AUEffectDocument alloc] init]; AUEffectDocument *const document = [[AUEffectDocument alloc] init];
if ((nil == document) || ![document readFromData:data ofType:AUEffectDocumentType error:&err]) if (!document || ![document readFromData:data ofType:AUEffectDocumentType error:&err])
{ {
[document release]; [document release];
if (nil != err) if (err)
{ {
[[NSAlert alertWithError:err] runModal]; [[NSAlert alertWithError:err] runModal];
} }
@ -983,7 +1005,8 @@ static void UpdateChangeCountCallback(void *userData,
effects[i].subtype = effectDesc.componentSubType; effects[i].subtype = effectDesc.componentSubType;
effects[i].manufacturer = effectDesc.componentManufacturer; effects[i].manufacturer = effectDesc.componentManufacturer;
HLock(nameHandle); HLock(nameHandle);
CFStringRef name = CFStringCreateWithPascalString(NULL, CFStringRef const name = CFStringCreateWithPascalString(
NULL,
(unsigned char const *)*nameHandle, (unsigned char const *)*nameHandle,
kCFStringEncodingMacRoman); kCFStringEncodingMacRoman);
HUnlock(nameHandle); HUnlock(nameHandle);