Skip to content

Instantly share code, notes, and snippets.

@jmoody
Created May 4, 2011 07:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmoody/954870 to your computer and use it in GitHub Desktop.
Save jmoody/954870 to your computer and use it in GitHub Desktop.
proposed changes to MamRendererWrapper
I also think that the finalizeData method should be replaced.
If both the initRenderer and finalizedData were pushed to an init method, the signature might be:
- (id) initWithScriptName:(NSString *) aScriptName;
or something like that (maybe it is initWithScriptDirectory).
This would as mean that the code that uses the renderer would not need to do stuff like this:
self.packageName = [songName stringByAppendingString:MamLayerPackageScriptSuffix];
self.midiName = songName;
[self.renderer parsePackage:self.packageName];
[renderer parseScripts];
[renderer setMidiName:self.midiName];
[renderer parseMidi];
I'm suggesting that the renderer do all its initialization internally.
Hi Stephen,
This is how I create a renderer:
self.renderer = [[[MamRendererWrapper alloc] init] autorelease];
[self.renderer initRenderer];
If the work that is done in initRenderer need to happen every time a renderer is created, then I suggest removing the initRenderer method and putting it inside the init method.
- (id) init {
self = [super init];
if (self != nil) {
// do all init stuff here
}
return self;
}
// these are passed through but we do some things too
- (void) initRenderer
{
if(!kEnableRenderer) return;
MDB_startSet();
//NSString *mamBundlePath=[[NSBundle mainBundle] pathForResource:@"MAMPlayer" ofType:@"bundle"];
//pathForResource:@"MAMPlayer" ofType:@"bundle"];
NSString *mamBundlePath = [[NSBundle mainBundle] bundlePath];
renderer=mrglue_init([mamBundlePath cStringUsingEncoding:NSUTF8StringEncoding]);
MDB_exp(parser,parser=[[MamParserWrapper alloc] init]);
[parser setRenderer:renderer];
MDB_endSet();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment