Re: Filing of User Presets - files vs. builtin
Re: Filing of User Presets - files vs. builtin
- Subject: Re: Filing of User Presets - files vs. builtin
- From: Robert Grant <email@hidden>
- Date: Fri, 25 Oct 2002 21:39:12 -0400
Well this class has proved to me that we can reliably find presets for
a particular
device. As a test I created a couple of aupreset files and then tried
loading them
against the wrong device and they were nicely grayed out. Against the
right
device they were available :-) I'm not sure how performance will be in
a large
directory of presets but hey it's just number crunching...
So I'm happy to let them be stored anywhere and now it's just a host
developers
question of whether we want there to be a common folder for presets.
It's beginning
to look like one of those only pleasing some people some of the time
situations.
@interface AUPresetFinder : NSObject {
ComponentDescription m_desc;
}
- (id)initWithDescription:(ComponentDescription)desc;
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename;
@end
@implementation AUPresetFinder
- (id)initWithDescription:(ComponentDescription)desc
{
if (self = [super init]) {
m_desc = desc;
}
return self;
}
- (BOOL)panel:(id)sender shouldShowFilename:(NSString *)filename
{
BOOL should = NO;
NSFileManager* mgr = [NSFileManager defaultManager];
BOOL isDir;
if ([mgr fileExistsAtPath:filename isDirectory:&isDir] && isDir)
should = YES; // let them navigate directories
else if ([[filename pathExtension] isEqual: @"aupreset"]) {
NSDictionary* dictionary = [NSDictionary
dictionaryWithContentsOfFile: filename];
NSNumber* manu = [dictionary objectForKey: @"manufacturer"];
NSNumber* type = [dictionary objectForKey: @"type"];
NSNumber* subtype = [dictionary objectForKey: @"subtype"];
if (([manu intValue] == m_desc.componentManufacturer) &&
([type intValue] == m_desc.componentType) &&
([subtype intValue] == m_desc.componentSubType))
should = YES;
}
return should;
}
@end
To use initialize with a ComponentDescription and set as an NSOpenPanel
instance's delegate.
BTW has anybody noticed that the NSSavePanel's beginSheet.... delegate
selector
now takes an NSWindow instead of an NSSavePanel? When did that change
and how the heck are you supposed to get the filename anymore?
Robert.
On Friday, October 25, 2002, at 05:57 PM, Art Gillespie wrote:
Hmmm...
The way I read it, all but option 0 (my favorite!) don't include user
interaction in the save/load phase... in these proposals, this is
handled 'automagically' (yark). There was talk of putting multiple
presets into some opaque preferences file! And then talk of
'exporting' if you wanted to share them! Absurd!
But, if I read it wrong, and these schemes are only in _addition_ to
sensible preset management, then I guess I've got nothing against it.
Except that it's stupid.
soaking in it,
Art
>>0xBA
Art, I don't see how any of the previous suggestions preclude a user
from
putting presets anywhere she wants. All we are talking about is
defining
a standard place where any app could look and expect to find presets.
And
conversely, a user who puts the preset files there could reasonably
expect
all AU host apps to look there and find the presets, automagically
(isn't
that nice?). But if the user don't want to put preset files there,
then
the user puts them elsewhere, and the OS doesn't go boom, so what's
the
problem?
Marc
_______________________________________________
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.
_______________________________________________
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.