mirror of
https://github.com/OldUnreal/libxmp.git
synced 2026-04-02 21:37:43 -07:00
Fix OctaMED 'tracker compatibility' tempos.
This commit is contained in:
@@ -44,18 +44,35 @@ const char *const mmd_inst_type[] = {
|
||||
};
|
||||
#endif
|
||||
|
||||
static int get_8ch_tempo(int tempo)
|
||||
static int mmd_convert_tempo(int tempo, int bpm_on, int med_8ch)
|
||||
{
|
||||
const int tempos[10] = {
|
||||
const int tempos_compat[10] = {
|
||||
195, 97, 65, 49, 39, 32, 28, 24, 22, 20
|
||||
};
|
||||
const int tempos_8ch[10] = {
|
||||
47, 43, 40, 37, 35, 32, 30, 29, 27, 26
|
||||
};
|
||||
|
||||
if (tempo > 0) {
|
||||
tempo = tempo > 10 ? 10 : tempo;
|
||||
return tempos[tempo-1];
|
||||
} else {
|
||||
return tempo;
|
||||
/* From the OctaMEDv4 documentation:
|
||||
*
|
||||
* In 8-channel mode, you can control the playing speed more
|
||||
* accurately (to techies: by changing the size of the mix buffer).
|
||||
* This can be done with the left tempo gadget (values 1-10; the
|
||||
* lower, the faster). Values 11-240 are equivalent to 10.
|
||||
*/
|
||||
if (med_8ch) {
|
||||
tempo = tempo > 10 ? 10 : tempo;
|
||||
return tempos_8ch[tempo-1];
|
||||
}
|
||||
/* Tempos 1-10 in tempo mode are compatibility tempos that
|
||||
* approximate Soundtracker speeds.
|
||||
*/
|
||||
if (tempo <= 10 && !bpm_on) {
|
||||
return tempos_compat[tempo-1];
|
||||
}
|
||||
}
|
||||
return tempo;
|
||||
}
|
||||
|
||||
void mmd_xlat_fx(struct xmp_event *event, int bpm_on, int bpmlen, int med_8ch,
|
||||
@@ -184,7 +201,7 @@ void mmd_xlat_fx(struct xmp_event *event, int bpm_on, int bpmlen, int med_8ch,
|
||||
break;
|
||||
} else if (event->fxp <= 0xf0) {
|
||||
event->fxt = FX_S3M_BPM;
|
||||
event->fxp = med_8ch ? get_8ch_tempo(event->fxp) : event->fxp;
|
||||
event->fxp = mmd_convert_tempo(event->fxp, bpm_on, med_8ch);
|
||||
break;
|
||||
} else switch (event->fxp) {
|
||||
case 0xf1: /* Play note twice */
|
||||
@@ -712,22 +729,13 @@ void mmd_set_bpm(struct module_data *m, int med_8ch, int deftempo,
|
||||
{
|
||||
struct xmp_module *mod = &m->mod;
|
||||
|
||||
/* From the OctaMEDv4 documentation:
|
||||
*
|
||||
* In 8-channel mode, you can control the playing speed more
|
||||
* accurately (to techies: by changing the size of the mix buffer).
|
||||
* This can be done with the left tempo gadget (values 1-10; the
|
||||
* lower, the faster). Values 11-240 are equivalent to 10.
|
||||
mod->bpm = mmd_convert_tempo(deftempo, bpm_on, med_8ch);
|
||||
|
||||
/* 8-channel mode completely overrides BPM mode timing.
|
||||
* See mmd_convert_tempo for more info.
|
||||
*/
|
||||
|
||||
if (med_8ch) {
|
||||
mod->bpm = get_8ch_tempo(deftempo);
|
||||
} else {
|
||||
mod->bpm = deftempo;
|
||||
|
||||
if (bpm_on) {
|
||||
m->time_factor = DEFAULT_TIME_FACTOR * 4 / bpmlen;
|
||||
}
|
||||
if (bpm_on && !med_8ch) {
|
||||
m->time_factor = DEFAULT_TIME_FACTOR * 4 / bpmlen;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user