struct Notes *NewNote(void){ struct Notes *note=(struct Notes*)talloc(sizeof(struct Notes)); NOTE_init(note); note->chance = 0x100; return note; }
struct Notes *CopyNote(const struct Notes *old_note){ struct Notes *note = (struct Notes*)tcopy(old_note, sizeof(struct Notes)); note->l.next = NULL; note->velocities = NULL; note->pitches = NULL; NOTE_init(note); return note; }
void CopyRange_notes( struct Notes **tonote, struct Notes *fromnote, Place *p1, Place *p2 ){ struct Notes *note; if(fromnote==NULL){ return; } if(PlaceLessThan(&fromnote->l.p,p1)){ CopyRange_notes(tonote,NextNote(fromnote),p1,p2); return; } if(PlaceGreaterOrEqual(&fromnote->l.p,p2)){ return; } note=CopyNote(fromnote); note->pitches = NULL; note->velocities = NULL; NOTE_init(note); PlaceSub(¬e->l.p,p1); PlaceSub(¬e->end,p1); ListAddElement3(tonote,¬e->l); CopyRange_velocities(¬e->velocities,fromnote->velocities,p1,p2); CopyRange_pitches(¬e->pitches,fromnote->pitches,p1,p2); CopyRange_notes(tonote,NextNote(fromnote),p1,p2); }