Exemple #1
0
struct Notes *NewNote(void){
  struct Notes *note=(struct Notes*)talloc(sizeof(struct Notes));
  NOTE_init(note);
  note->chance = 0x100;

  return note;
}
Exemple #2
0
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(&note->l.p,p1);
	PlaceSub(&note->end,p1);

	ListAddElement3(tonote,&note->l);

	CopyRange_velocities(&note->velocities,fromnote->velocities,p1,p2);
	CopyRange_pitches(&note->pitches,fromnote->pitches,p1,p2);

	CopyRange_notes(tonote,NextNote(fromnote),p1,p2);
}