GP32 Chn's Modlib


JyCet

Member
Joined
Feb 23, 2004
Messages
469
Age
118
Location
France
Website
Visit site
Hi all,

I search how play a note in curent pattern with the Modlib.
It's not a sample in SFX chan but in real MOD chan.

If someone know "how to", could he help me ?

Thanks in advance.

Regard,
JYCET
 
note are coded into an int, you can directly copie paste this int in the pattern
pattern data are only all notes :
note raw0 ch0, note raw0 ch1, note raw0 ch2, note raw0 ch3
note raw1 ch0, note raw1 ch1, note raw1 ch2, note raw1 ch3
ect .. for the 64 raw
pattern is 1024 byte lenth, raw 16 bytes lenth and note 4 bytes

you could find mod format here : http://www.wotsit.org/

and here code to 'uncript' and 'cript' note :

void pattern::readRaw(int nraw)
{ note* n = raw[nraw] ;
int* p = (int*)((char*)dta + 16*nraw) ; char *pt ;
for(int cpt=0;cpt<4;cpt++)
{ if(*p){
pt = (char*)p ; p++ ;
n[cpt].sample = ((pt[2])>>4) + (pt[0] & 0xF0) ;
n[cpt].period = ((pt[0] & 0x0F)*256) + pt[1] ;
n[cpt].effect = ((pt[2] & 0x0F)*256) + pt[3] ;
n[cpt].text = getNoteText(n[cpt].period) ;
} else { p++ ; memset(&(n[cpt]),0,sizeof(note)) ; }
};
}

void tracker::setNote(int ptn, int raw, int chn, note* n)
{ // fix the pattern in the tracker object
note * nt = &((patterns[ptn].raw[raw])[chn]) ;
nt->sample = n->sample ;
nt->period = n->period ;
nt->effect = n->effect ;
nt->text = n->text ;
// and in the mod
int t ; char * y = (char*)&t ;
y[0] = ((n->sample)&0xF0) + (((n->period)>>8)&0x0F) ;
y[1] = (n->period)&0xFF ;
y[2] = (((n->sample)&0x0F)<<4) + (((n->effect)>>8)&0x0F) ;
y[3] = (n->effect)&0xFF ;
*(int*)((char*)(mod->patterndata) + 1024*ptn + 16*raw + chn*4 ) = t ;
}

if you want i can send you complette yAnl source.
 
Back
Top