27 #include "notearray.h"
33 data=
new noteCmd[totalAllocated];
43 NoteArray::noteCmd *NoteArray::pointerTo(ulong pos)
45 if (pos<totalAllocated)
return &data[pos];
46 while (pos>=totalAllocated)
48 noteCmd *tmp=
new noteCmd[totalAllocated*2];
49 memcpy(tmp,data,
sizeof(noteCmd)*totalAllocated);
59 noteCmd *tmp=pointerTo(pos);
68 noteCmd *tmp=pointerTo(pos);
77 return *pointerTo(pos);
90 if (last==totalAllocated) lastAdded=pointerTo(totalAllocated);
101 if (it==lastAdded) {it=NULL;
return;};
111 for (
int j=0;j<16;j++) pgm2[j]=0;
112 while ((ncmd!=NULL)&&(ncmd->ms<ms))
114 if (ncmd->cmd==2) pgm2[ncmd->chn]=ncmd->note;
120 for (
int i=0;i<16;i++) pgm[i]=pgm2[i];
void next(void)
Advances the iterator to the next position.
NoteArray(void)
Constructor.
void iteratorBegin(void)
Initializes the iterator.
noteCmd * get(void)
Get the command currently pointed to by the iterator.
void at(ulong pos, ulong ms, int chn, int cmd, int note)
Adds (or modifies) an event in the given position .
void add(ulong ms, int chn, int cmd, int note)
Adds a note/patch event at a given millisecond.
void moveIteratorTo(ulong ms, int *pgm=NULL)
Calls next() until the next event is over ms milliseconds and puts in pgm[16] the instruments used at...