Source Code (Use browser search to find items of interest.)
Class Index
kmid'NoteArray (./kdemultimedia/kmid/player/notearray.h:37)
class NoteArray
{
noteCmd *data;
ulong totalAllocated;
ulong last;
noteCmd *lastAdded;
noteCmd *it; // the iterator
noteCmd *pointerTo(ulong pos);
public:
NoteArray(void);
~NoteArray();
void at(ulong pos, ulong ms,int chn,int cmd,int note);
void at(ulong pos, noteCmd s);
noteCmd at(int pos);
void add(ulong ms,int chn,int cmd,int note);
void iteratorBegin(void) { it=data; };
noteCmd *get(void) { return it; };
void next(void);
void moveIteratorTo(ulong ms,int *pgm=NULL);
// call next() until the next event is over ms milliseconds
// and puts in pgm[16] the instruments used at this moment
};
kmid'NoteArray::NoteArray() (./kdemultimedia/kmid/player/notearray.cc:28)
NoteArray::NoteArray(void)
{
totalAllocated=50;
data=new noteCmd[totalAllocated];
lastAdded=NULL;
}
kmid'NoteArray::~NoteArray() (./kdemultimedia/kmid/player/notearray.cc:35)
NoteArray::~NoteArray()
{
delete data;
totalAllocated=0;
}
kmid'NoteArray::pointerTo() (./kdemultimedia/kmid/player/notearray.cc:41)
noteCmd *NoteArray::pointerTo(ulong pos)
{
if (pos<totalAllocated) return &data[pos];
while (pos>=totalAllocated)
{
noteCmd *tmp=new noteCmd[totalAllocated*2];
memcpy(tmp,data,sizeof(noteCmd)*totalAllocated);
delete data;
data=tmp;
totalAllocated*=2;
}
return &data[pos];
}
kmid'NoteArray::at() (./kdemultimedia/kmid/player/notearray.cc:55)
void NoteArray::at(ulong pos, ulong ms,int chn,int cmd,int note)
{
noteCmd *tmp=pointerTo(pos);
tmp->ms=ms;
tmp->chn=chn;
tmp->cmd=cmd;
tmp->note=note;
}
kmid'NoteArray::at() (./kdemultimedia/kmid/player/notearray.cc:64)
void NoteArray::at(ulong pos, noteCmd s)
{
noteCmd *tmp=pointerTo(pos);
tmp->ms=s.ms;
tmp->chn=s.chn;
tmp->cmd=s.cmd;
tmp->note=s.note;
}
kmid'NoteArray::at() (./kdemultimedia/kmid/player/notearray.cc:73)
noteCmd NoteArray::at(int pos)
{
return *pointerTo(pos);
}
kmid'NoteArray::add() (./kdemultimedia/kmid/player/notearray.cc:78)
void NoteArray::add(ulong ms,int chn,int cmd,int note)
{
if (lastAdded==NULL)
{
lastAdded=data;
last=0;
}
else
{
last++;
if (last==totalAllocated) lastAdded=pointerTo(totalAllocated);
else lastAdded++;
}
lastAdded->ms=ms;
lastAdded->chn=chn;
lastAdded->cmd=cmd;
lastAdded->note=note;
}
kmid'NoteArray::next() (./kdemultimedia/kmid/player/notearray.cc:97)
void NoteArray::next(void)
{
if (it==lastAdded) {it=NULL;return;};
it++;
}
kmid'NoteArray::moveIteratorTo() (./kdemultimedia/kmid/player/notearray.cc:103)
void NoteArray::moveIteratorTo(ulong ms,int *pgm)
{
noteCmd *ncmd;
iteratorBegin();
ncmd=get();
int pgm2[16];
for (int j=0;j<16;j++) pgm2[j]=0;
while ((ncmd!=NULL)&&(ncmd->ms<ms))
{
if (ncmd->cmd==2) pgm2[ncmd->chn]=ncmd->note;
next();
ncmd=get();
}
if (pgm!=NULL)
{
for (int i=0;i<16;i++) pgm[i]=pgm2[i];
}
}