zazula@soliton.uucp (Ralph Zazula) (06/12/91)
I was having a bunch of problems with the setScore: method of the ScorePerformer class. It seems that the PartPerformers of the ScorePerformer DO NOT get updated if you do a setScore: with a modified version of a previously used score. For example : id myScore; id myScorePerformer; myScore = [[Score alloc] init]; myScorePerformer = [[ScorePerformer alloc] init]; [myScore readMidifile:"file_with_2_parts.midi"]; [myScorePerformer setScore:myScore]; // ... play the score ... [myScore readMidifile:"file_with_5_parts.midi"]; [myScorePerformer setScore:myScore]; Now, I look in AppInspector and see that the PartPerformer list for myScorePerformer still only has 2 parts in it, NOT 5. The setScore: method says: " The PartPerformers from a previously set Score (if any) are first removed and freed.". It seems like I have 2 options, free the Score every time _or_ free the ScorePerformer every time (I've tried the latter). Okay, I just tried manually freeing all of the PartPerformers ie. [myScorePerformer freePartPerformers]; instead of: [myScorePerformer free]; myScorePerformer = [[ScorePerformer alloc] init]; // again... This worked too. So, does this make sense? It appears that the above quote only applies to a new Score *instance* instead of a new Score (in the music sense). This is bad! One shouldn't have to free the ScorePerformer instance just to register an update in the Score!!!!!!!!!!!!!!! Well, I only wasted about 6 hours on this... I should have gotten AppInspector out much earlier... It's in my dock now :-) Ralph |----------------------------------------------------------------------| | Ralph Zazula "Computer Addict!" | | University of Arizona --- Department of Physics | | UAZHEP::ZAZULA (DecNet/HEPNet) | | zazula@uazhe0.physics.arizona.edu (Internet) | |----------------------------------------------------------------------| | "You can twist perceptions, reality won't budge." - Neil Peart | |----------------------------------------------------------------------|