Skip to content

Commit

Permalink
Fix IT sample global volume and sample vibrato.
Browse files Browse the repository at this point in the history
* IT sample global volume was being ignored in sample mode due to
  QUIRK_INSVOL not being enabled. QUIRK_INSVOL is now unconditionally
  enabled for IT modules.
* IT sample global volume was being ignored in instrument mode for
  IT 1.x modules due to QUIRK_INSVOL not being enabled for IT 1.x
  modules. QUIRK_INSVOL is now unconditionally enabled for IT modules.
* Fixed an incorrect bitshift on IT sample vibrato depth that resulted
  in IT sample vibrato being very weak.
* Sample vibrato rate is now rounded instead of truncated. The LFO
  period size should probably eventually be expanded instead.
  • Loading branch information
AliceLR committed Nov 11, 2020
1 parent b5d4239 commit 912bc13
Show file tree
Hide file tree
Showing 8 changed files with 1,611 additions and 1,611 deletions.
9 changes: 3 additions & 6 deletions src/loaders/it_load.c
Original file line number Diff line number Diff line change
Expand Up @@ -750,6 +750,7 @@ static int load_it_sample(struct module_data *m, int i, int start,

if (sample_mode) {
/* Create an instrument for each sample */
mod->xxi[i].vol = 64;
mod->xxi[i].sub[0].vol = ish.vol;
mod->xxi[i].sub[0].pan = 0x80;
mod->xxi[i].sub[0].sid = i;
Expand Down Expand Up @@ -782,7 +783,7 @@ static int load_it_sample(struct module_data *m, int i, int start,
sub->vol = ish.vol;
sub->gvl = ish.gvl;
sub->vra = ish.vis; /* sample to sub-instrument vibrato */
sub->vde = ish.vid >> 1;
sub->vde = ish.vid << 1;
sub->vwf = ish.vit;
sub->vsw = (0xff - ish.vir) >> 1;

Expand Down Expand Up @@ -1090,10 +1091,6 @@ static int it_load(struct module_data *m, HIO_HANDLE *f, const int start)
m->period_type = PERIOD_LINEAR;
}

if (!sample_mode && ifh.cmwt >= 0x200) {
m->quirk |= QUIRK_INSVOL;
}

for (i = 0; i < 64; i++) {
struct xmp_channel *xxc = &mod->xxc[i];

Expand Down Expand Up @@ -1328,7 +1325,7 @@ static int it_load(struct module_data *m, HIO_HANDLE *f, const int start)

/* Format quirks */

m->quirk |= QUIRKS_IT | QUIRK_ARPMEM;
m->quirk |= QUIRKS_IT | QUIRK_ARPMEM | QUIRK_INSVOL;

if (ifh.flags & IT_LINK_GXX) {
m->quirk |= QUIRK_PRENV;
Expand Down
5 changes: 4 additions & 1 deletion src/read_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,11 @@ static void set_effect_defaults(struct context_data *ctx, int note,
} */
#endif

/* TODO: should probably expand the LFO period size instead
* of reducing the vibrato rate precision here.
*/
libxmp_lfo_set_depth(&xc->insvib.lfo, sub->vde);
libxmp_lfo_set_rate(&xc->insvib.lfo, sub->vra >> 2);
libxmp_lfo_set_rate(&xc->insvib.lfo, (sub->vra + 2) >> 2);
libxmp_lfo_set_waveform(&xc->insvib.lfo, sub->vwf);
xc->insvib.sweep = sub->vsw;

Expand Down
20 changes: 10 additions & 10 deletions test-dev/data/format_it.data
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 0 100 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64 64 -1 9 82 0 6 23 89 0 1 2 0 0 255 128
64 64 -1 9 82 0 26 23 89 0 1 2 0 0 255 128
64 1 0 Sine.eerie
19 5 0 2 2 0 0
0 21 4 49 10 64 20 19 35 0
Expand All @@ -91,7 +91,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 32 8 36 16 39 26 35 35 29 48 25 56 28 64 32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64 64 -1 9 82 0 6 23 89 0 1 2 0 0 218 128
64 64 -1 9 82 0 26 23 89 0 1 2 0 0 218 128
64 1 0 Sine.softecho
1 9 0 0 0 0 0
0 64 5 13 15 0 16 30 21 7 31 0 32 15 34 5 44 0
Expand All @@ -101,7 +101,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 32 15 32 16 45 31 45 32 19 59 20
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64 64 -1 9 82 0 6 23 89 0 1 2 0 0 222 128
64 64 -1 9 82 0 26 23 89 0 1 2 0 0 222 128
49 1 13056 Sine.sub bass
19 6 0 3 3 0 0
0 21 2 64 7 60 10 50 12 8 15 0
Expand All @@ -111,7 +111,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 32 8 36 16 39 26 35 35 29 48 25 56 28 64 32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
1 0 -1 -2 -3 -4 -5 -6 -7 -8 -9 -10 -11 -12 -13 -14 -15 -16 -17 -18 -19 -20 -21 -22 -23 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 -24 0
64 64 -1 9 82 0 6 23 89 0 1 3 0 0 218 128
64 64 -1 9 82 0 26 23 89 0 1 3 0 0 218 128
47 1 14848 ChipBraz.lead
19 3 0 0 0 0 0
0 64 3 12 17 0
Expand All @@ -121,7 +121,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 0 100 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64 64 -1 0 93 0 3 17 21 0 4 3 0 0 255 128
64 64 -1 0 93 0 12 17 21 0 4 3 0 0 255 128
22 1 14848 ChipBraz.faderpad
1 3 0 0 0 0 0
0 0 61 64 133 0
Expand All @@ -131,7 +131,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 32 28 42 77 23 118 32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0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0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64 50 -1 0 92 0 2 18 30 0 5 2 0 0 255 229
64 50 -1 0 92 0 10 18 30 0 5 2 0 0 255 229
64 1 0 Chip5ths.raw
19 3 0 0 0 0 0
0 64 4 10 16 0
Expand Down Expand Up @@ -581,7 +581,7 @@ Impulse Tracker 2.14v3 IT 2.16
0 31 2 37 5 28 15 32
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
64 64 -1 9 82 0 6 23 89 0 1 1 3 3 237 128
64 64 -1 9 82 0 26 23 89 0 1 1 3 3 237 128
64 1 16000 SynthSnare
0 2 0 0 0 0 0
0 64 100 64
Expand Down

0 comments on commit 912bc13

Please sign in to comment.