Created
May 4, 2011 07:16
-
-
Save jmoody/954870 to your computer and use it in GitHub Desktop.
proposed changes to MamRendererWrapper
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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