1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
/// S3M Effect Parser
///
/// Converts S3M effects directly to TrackImportEffect/GlobalEffect,
/// without going through XM effect numbering.
use alloc::vec;
use alloc::vec::Vec;
use crate::import::import_memory::S3mImportFlags;
use crate::import::patternslot::PatternSlot;
use crate::import::track_import_effect::TrackImportEffect;
use crate::import::track_import_unit::TrackImportUnit;
use crate::prelude::*;
// `S3mImportFlags` — the two-bool POD wrapping ST3 masterflag bits
// `fastvolslide` (bit 64) and `oldstvib` (bit 1) — is defined on the
// shared `ImportMemory` helper (see `crate::import::import_memory`)
// rather than here, so it stays compiled in every build that enables
// any importer (not just `import_s3m`). Its fields carry the same
// semantics described there: the importer pre-absorbs ST3's tick-0
// volume-slide quirk by co-emitting `VolumeSlide0` / `ChannelVolumeSlide0`
// alongside the cascade slides, and pre-scales vibrato depth ×2 for
// ST2-style deep vibrato. Runtime-relevant flags (e.g. `amigalimits`)
// are carried separately on `ModuleFormat::S3m` so the replayer can
// consult them per-tick.
/// S3M shared effect memory and direct effect parser
#[derive(Debug)]
pub struct S3mEffect {
/// Last non-zero parameter for effects D/E/F/I/J/K/L/Q/R/S (shared memory per channel)
alastnfo: [u8; 32],
/// Last non-zero parameter for vibrato effects H/U (separate memory per channel)
alastvibnfo: [u8; 32],
/// Last instrument used with tone portamento (G)
s3m_last_g_instrument: [Option<usize>; 32],
}
impl S3mEffect {
fn new() -> Self {
Self {
alastnfo: [0; 32],
alastvibnfo: [0; 32],
s3m_last_g_instrument: [None; 32],
}
}
/// Resolve S3M shared effect memory for a pattern.
/// In S3M, effects D/E/F/I/J/K/L/Q/R/S share a single "last info" memory per channel.
/// H/U (vibrato) have their own shared memory.
/// G (tone portamento) does NOT share memory with others.
pub fn resolve_pattern_memory(pattern: &mut [Vec<PatternSlot>]) {
let mut sfx = Self::new();
sfx.resolve_memory(pattern);
}
fn resolve_memory(&mut self, pattern: &mut [Vec<PatternSlot>]) {
for line in pattern {
for (ch, slot) in line.iter_mut().enumerate() {
let efx = slot.effect_type;
let param = slot.effect_parameter;
// Store non-zero parameters. ST3 has THREE memory pools per
// channel, and they MUST NOT cross-pollute:
//
// * alastnfo — shared across D/E/F/I/J/K/L/Q/R/S
// * alastvibnfo — H and U (vibrato variants)
// * G (tone portamento) has its own memory, handled later
// in import_memory.rs via `TrackImportEffect::TonePortamento`
//
// The previous implementation used `(4..=12)` to write
// alastnfo, which wrongly included G (7) and H (8). That
// caused, for example, a G05 followed by F00 to "recall"
// 0x05 — ST3 actually keeps those pools disjoint.
if param > 0 {
if efx == 8 || efx == 21 {
self.alastvibnfo[ch] = param;
} else if matches!(efx, 4 | 5 | 6 | 9 | 10 | 11 | 12 | 17 | 18 | 19) {
self.alastnfo[ch] = param;
}
}
// Recall from memory when parameter is zero.
// `efx != 7` excludes G from the recall path — G's memory
// is handled by import_memory.rs.
if param == 0 && efx != 7 {
if efx == 8 || efx == 21 {
slot.effect_parameter = self.alastvibnfo[ch];
} else if matches!(efx, 4 | 5 | 6 | 9 | 10 | 11 | 12 | 17 | 18 | 19) {
slot.effect_parameter = self.alastnfo[ch];
}
}
// Track last instrument for G effect
if slot.instrument.is_some() && efx != 7 {
self.s3m_last_g_instrument[ch] = slot.instrument;
}
}
}
}
// --- Volume slide helpers ---
/// Convert a Dxy volume-slide param into zero, one, or two
/// `TrackImportEffect`s. Returns a `Vec` (not `Option`) because
/// two ST3 corner cases need a simultaneous tick-0 + tick>0 pair:
///
/// * **`D0F` / `DF0`** — `infolo == 0xF, infohi == 0` and the
/// mirror. These look like fine slides but ST3 actually fires
/// `avol -= 0xF` (resp. `+=`) *unconditionally* on every tick
/// including tick 0 (`digcmd.c:s_volslide` lines 433-446, not
/// gated on `song.musiccount`). xmrs models this by emitting
/// both `VolumeSlide0` and `VolumeSlideN` with the same speed.
///
/// * **fastvolslide** (masterflags bit 64) — when set, ST3 runs
/// regular `Dx0`/`D0y` on every tick too. Same fix: emit both
/// `VolumeSlide0` and `VolumeSlideN`.
///
/// Genuine fine slides (`DxF`, `DFy` with y != 0) stay tick-0-
/// only and keep a single `VolumeSlide0`.
fn s3m_volume_slide(param: u8, flags: S3mImportFlags) -> Vec<TrackImportEffect> {
let high = (param & 0xF0) >> 4;
let low = param & 0x0F;
let speed = |v: u8| -(v as f32) / 64.0;
let speed_up = |v: u8| v as f32 / 64.0;
match (high, low) {
// D0F: slide down by 0xF every tick including tick 0.
// Note: xmrs ordering `(0, 0xF)` has the low-nibble-F
// priority, matching ST3's `if (infolo == 0xF) { if
// (infohi == 0) avol -= infolo; ... }` branch.
(0, 0xF) => vec![
TrackImportEffect::VolumeSlide0(speed(0xF)),
TrackImportEffect::VolumeSlideN(speed(0xF)),
],
// DF0: slide up by 0xF every tick including tick 0.
(0xF, 0) => vec![
TrackImportEffect::VolumeSlide0(speed_up(0xF)),
TrackImportEffect::VolumeSlideN(speed_up(0xF)),
],
// DxF (fine up): tick 0 only.
(f, 0xF) => vec![TrackImportEffect::VolumeSlide0(speed_up(f))],
// DFy (fine down): tick 0 only.
(0xF, f) => vec![TrackImportEffect::VolumeSlide0(speed(f))],
// Regular D0y (slide down): tick > 0. With fastvolslide,
// also tick 0.
(0, f) => {
if flags.fastvolslide {
vec![
TrackImportEffect::VolumeSlide0(speed(f)),
TrackImportEffect::VolumeSlideN(speed(f)),
]
} else {
vec![TrackImportEffect::VolumeSlideN(speed(f))]
}
}
// Regular Dx0 (slide up): tick > 0. With fastvolslide,
// also tick 0.
(f, 0) => {
if flags.fastvolslide {
vec![
TrackImportEffect::VolumeSlide0(speed_up(f)),
TrackImportEffect::VolumeSlideN(speed_up(f)),
]
} else {
vec![TrackImportEffect::VolumeSlideN(speed_up(f))]
}
}
// Both nibbles non-zero and neither is 0xF: ST3 treats
// this as illegal at tick 0 (returns) but still slides
// down by infolo at tick > 0 (or every tick with
// fastvolslide). Last-nibble-wins priority.
(_, f) => {
if flags.fastvolslide {
vec![
TrackImportEffect::VolumeSlide0(speed(f)),
TrackImportEffect::VolumeSlideN(speed(f)),
]
} else {
vec![TrackImportEffect::VolumeSlideN(speed(f))]
}
}
}
}
/// Mirror of [`Self::s3m_volume_slide`] for Nxy (channel volume
/// slide). Same D0F/DF0 corner cases, same fastvolslide behaviour.
fn s3m_channel_volume_slide(param: u8, flags: S3mImportFlags) -> Vec<TrackImportEffect> {
let high = (param & 0xF0) >> 4;
let low = param & 0x0F;
let speed = |v: u8| -(v as f32) / 64.0;
let speed_up = |v: u8| v as f32 / 64.0;
match (high, low) {
(0, 0xF) => vec![
TrackImportEffect::ChannelVolumeSlide0(speed(0xF)),
TrackImportEffect::ChannelVolumeSlideN(speed(0xF)),
],
(0xF, 0) => vec![
TrackImportEffect::ChannelVolumeSlide0(speed_up(0xF)),
TrackImportEffect::ChannelVolumeSlideN(speed_up(0xF)),
],
(f, 0xF) => vec![TrackImportEffect::ChannelVolumeSlide0(speed_up(f))],
(0xF, f) => vec![TrackImportEffect::ChannelVolumeSlide0(speed(f))],
(0, f) => {
if flags.fastvolslide {
vec![
TrackImportEffect::ChannelVolumeSlide0(speed(f)),
TrackImportEffect::ChannelVolumeSlideN(speed(f)),
]
} else {
vec![TrackImportEffect::ChannelVolumeSlideN(speed(f))]
}
}
(f, 0) => {
if flags.fastvolslide {
vec![
TrackImportEffect::ChannelVolumeSlide0(speed_up(f)),
TrackImportEffect::ChannelVolumeSlideN(speed_up(f)),
]
} else {
vec![TrackImportEffect::ChannelVolumeSlideN(speed_up(f))]
}
}
(_, f) => {
if flags.fastvolslide {
vec![
TrackImportEffect::ChannelVolumeSlide0(speed(f)),
TrackImportEffect::ChannelVolumeSlideN(speed(f)),
]
} else {
vec![TrackImportEffect::ChannelVolumeSlideN(speed(f))]
}
}
}
}
/// Pxx panning slide — OpenMPT / extended-S3M convention.
///
/// ST3 does NOT natively implement Pxx (both `soncejmp[16]` and
/// `sotherjmp[16]` in `digcmd.c` point to `s_ret`, a no-op).
/// xmrs supports Pxx as an OpenMPT/extended-S3M extension using
/// the standard FT2 panning-slide encoding:
///
/// * `P0y` → regular slide left by `y/16` per tick > 0
/// * `Px0` → regular slide right by `x/16` per tick > 0
/// * `PxF` → fine slide right by `x/16` at tick 0
/// * `PFy` → fine slide left by `y/16` at tick 0
/// * `P00` → no-op (memory handled at [`super::import_memory`])
/// * `P0F` / `PF0` → no-op (fine slide with amount 0 — legitimate
/// under FT2 semantics, see below)
///
/// **Why this does NOT mirror the D0F / DF0 double-emission
/// pattern in [`Self::s3m_volume_slide`]:** the volume slide
/// corner case exists because ST3 natively implements Dxy AND
/// breaks from FT2 convention — ST3's `s_volslide` fires every
/// tick (including tick 0), so `D0F` / `DF0` encode a full-range
/// per-tick slide rather than FT2's tick-0-only fine slide. For
/// Pxx there is no native ST3 behaviour to reconcile, so the
/// FT2 semantics apply unchanged: an amount of 0 is a no-op on
/// whichever side carries it. The `fastvolslide` masterflag is
/// intentionally NOT applied here either, for the same reason.
fn s3m_panning_slide(param: u8) -> Option<TrackImportEffect> {
let high = (param & 0xF0) >> 4;
let low = param & 0x0F;
match (high, low) {
(0xF, f) => Some(TrackImportEffect::PanningSlide0(-(f as f32) / 16.0)),
(f, 0xF) => Some(TrackImportEffect::PanningSlide0(f as f32 / 16.0)),
(0, f) => Some(TrackImportEffect::PanningSlideN(-(f as f32) / 16.0)),
(f, 0) => Some(TrackImportEffect::PanningSlideN(f as f32 / 16.0)),
_ => None,
}
}
// --- Effect parser (S3M numbering -> TrackImportEffect) ---
fn s3m_walk_effect(
freq_type: FrequencyType,
flags: S3mImportFlags,
current: &PatternSlot,
) -> Option<Vec<TrackImportEffect>> {
let param = current.effect_parameter;
// Scale factor for pitch slides. ST3's raw `param` operates
// on ST3's `aspd` which is 4× finer than xmrs's Amiga period,
// so in Amiga mode we use `1.0` and in Linear mode (which
// has 4× finer period resolution than xmrs's Amiga periods)
// we use `4.0`. This scale also applies to the fine/extra-
// fine sub-commands: previously only the main slide respected
// it, which left E/F high-nibble-F fine slides 4× too fast
// in Amiga mode.
let main_scale = match freq_type {
FrequencyType::LinearFrequencies => 4.0,
FrequencyType::AmigaFrequencies => 1.0,
};
// oldstvib (masterflags bit 1) doubles the vibrato depth —
// ST3 uses a `>> 4` shift under this flag instead of the
// regular `>> 5`, giving 2× the depth. The same applies to
// the fine vibrato U (`>> 6` vs `>> 7`). Absorbed into the
// emitted depth so the player stays agnostic.
let vib_depth_scale: f32 = if flags.oldstvib { 2.0 } else { 1.0 };
match current.effect_type {
// D - Volume slide
4 => {
let v = Self::s3m_volume_slide(param, flags);
if v.is_empty() {
None
} else {
Some(v)
}
}
// E - Portamento down
5 => {
let high = (param & 0xF0) >> 4;
let low = param & 0x0F;
match (high, low) {
// EEy: extra-fine slide down (ST3: `info & 0xF`
// subtracted from aspd at tick 0 only). 1x scale
// in ST3 units = `main_scale` in xmrs period
// units.
(0xE, f) => Some(vec![TrackImportEffect::PortamentoExtraFineDown(
main_scale * f as f32,
)]),
// EFy: "extra" fine slide down (4x scale, once
// at tick 0).
(0xF, f) => Some(vec![TrackImportEffect::PortamentoFineDown(
main_scale * 4.0 * f as f32,
)]),
_ => Some(vec![TrackImportEffect::PortamentoDown(
main_scale * param as f32,
)]),
}
}
// F - Portamento up
6 => {
let high = (param & 0xF0) >> 4;
let low = param & 0x0F;
match (high, low) {
(0xE, f) => Some(vec![TrackImportEffect::PortamentoExtraFineUp(
-main_scale * f as f32,
)]),
(0xF, f) => Some(vec![TrackImportEffect::PortamentoFineUp(
-main_scale * 4.0 * f as f32,
)]),
_ => Some(vec![TrackImportEffect::PortamentoUp(
-main_scale * param as f32,
)]),
}
}
// G - Tone portamento
7 => {
let speed = main_scale * param as f32;
Some(vec![TrackImportEffect::TonePortamento(speed)])
}
// H - Vibrato
8 => {
let speed = ((param & 0xF0) >> 4) as f32 / 64.0;
let depth = (param & 0x0F) as f32 / 16.0 * vib_depth_scale;
Some(vec![TrackImportEffect::Vibrato(speed, depth)])
}
// I - Tremor
9 => {
let on = (param >> 4) as usize;
let off = (param & 0x0F) as usize;
Some(vec![TrackImportEffect::Tremor(on, off)])
}
// J - Arpeggio
10 => {
if param > 0 {
let v1 = (param >> 4) as usize;
let v2 = (param & 0x0F) as usize;
Some(vec![TrackImportEffect::Arpeggio(v1, v2)])
} else {
None
}
}
// K - Vibrato + Volume slide
11 => {
let mut v = vec![TrackImportEffect::Vibrato(0.0, 0.0)];
v.extend(Self::s3m_volume_slide(param, flags));
Some(v)
}
// L - Tone portamento + Volume slide
//
// The emitted `TonePortamento(0.0)` is NOT a no-op — it
// signals "load from memory" in `ImportMemory`. Since G
// writes to the same `TONE_PORTAMENTO` slot with its
// speed (when `param > 0`) and L only reads from it, the
// pair ends up sharing the slot exactly like ST3 shares
// `alasteff1` between `s_toneslide` (G) and the
// `KxyLxxVolslideType == 1` branch called from
// `s_tonevol` (digcmd.c:s_toneslide lines 473-475).
// L intentionally never writes to the slot — if a module
// plays L before any G has set the memory, ST3 uses its
// initial-zero `alasteff1` (no slide), which xmrs
// reproduces via the zero-initialised slot.
12 => {
let mut v = vec![TrackImportEffect::TonePortamento(0.0)];
v.extend(Self::s3m_volume_slide(param, flags));
Some(v)
}
// M - Set channel volume
13 => Some(vec![TrackImportEffect::ChannelVolume(
param.min(64) as f32 / 64.0,
)]),
// N - Channel volume slide
14 => {
let v = Self::s3m_channel_volume_slide(param, flags);
if v.is_empty() {
None
} else {
Some(v)
}
}
// O - Sample offset
15 => Some(vec![TrackImportEffect::InstrumentSampleOffset(
param as usize * 256,
)]),
// P - Panning slide
16 => Self::s3m_panning_slide(param).map(|e| vec![e]),
// Q - Retrigger. ST3's Qxy uses a LUT that differs from
// FT2's Rxy on nibble 6 (`10/16` vs `11/16`); the
// dedicated `NoteRetrigExtendedS3m` variant keeps that
// split out of the generic converter.
17 => {
let vol = (param >> 4) as usize;
let speed = (param & 0x0F) as usize;
Some(vec![TrackImportEffect::NoteRetrigExtendedS3m(speed, vol)])
}
// R - Tremolo
18 => {
let speed = ((param & 0xF0) >> 4) as f32 / 64.0;
let depth = (param & 0x0F) as f32 / 16.0 * vib_depth_scale;
Some(vec![TrackImportEffect::Tremolo(speed, depth)])
}
// S - Special sub-commands
19 => {
let sub = param >> 4;
let val = param & 0x0F;
match sub {
0x1 => Some(vec![TrackImportEffect::Glissando(val != 0)]),
0x2 => Some(vec![TrackImportEffect::InstrumentFineTune(
val as f32 / 8.0 - 1.0,
)]),
0x3 => {
let wf = match val & 3 {
1 => Waveform::RampDown,
2 => Waveform::Square,
_ => Waveform::Sine,
};
Some(vec![TrackImportEffect::VibratoWaveform(wf, (val & 4) == 0)])
}
0x4 => {
let wf = match val & 3 {
1 => Waveform::RampDown,
2 => Waveform::Square,
_ => Waveform::Sine,
};
Some(vec![TrackImportEffect::TremoloWaveform(wf, (val & 4) == 0)])
}
0x8 => Some(vec![TrackImportEffect::Panning(val as f32 / 15.0)]),
0x9 => Some(vec![TrackImportEffect::NoteRetrig(val as usize)]),
0xC => {
if val > 0 {
Some(vec![TrackImportEffect::NoteCut(val as usize, false)])
} else {
None
}
}
0xD => {
if val > 0 {
Some(vec![TrackImportEffect::NoteDelay(val as usize)])
} else {
None
}
}
_ => None,
}
}
// U - Fine vibrato (4x finer depth than H)
21 => {
let speed = ((param & 0xF0) >> 4) as f32 / 64.0;
let depth = (param & 0x0F) as f32 / 64.0 * vib_depth_scale;
Some(vec![TrackImportEffect::VibratoFine(speed, depth)])
}
// X - Set panning
24 => Some(vec![TrackImportEffect::Panning(param as f32 / 255.0)]),
_ => None,
}
}
// --- Volume column (raw S3M: 0-64, 0x80-0xC0 panning, or absent) ---
fn s3m_walk_volume(current: &PatternSlot) -> Option<TrackImportEffect> {
match current.volume {
v if v <= 64 => Some(TrackImportEffect::Volume(v as f32 / 64.0, 0)),
// MPT-style S3M panning via the volume column. 0x80 = hard left,
// 0xC0 = hard right; 65 discrete steps in between. We scale to
// the [0.0, 1.0] range used by TrackImportEffect::Panning.
v if (0x80..=0xC0).contains(&v) => {
Some(TrackImportEffect::Panning((v - 0x80) as f32 / 64.0))
}
_ => None,
}
}
// --- Global effects ---
fn s3m_walk_global_effect(current: &PatternSlot) -> Option<GlobalEffect> {
let param = current.effect_parameter;
match current.effect_type {
// A - Set speed
1 => {
if param > 0 && param <= 0x1F {
Some(GlobalEffect::Speed(param as usize))
} else {
None
}
}
// B - Jump to order
2 => Some(GlobalEffect::PositionJump(param as usize)),
// C - Break to row
3 => Some(GlobalEffect::PatternBreak(param as usize)),
// S - Special sub-commands (global)
19 => {
let sub = param >> 4;
let val = param & 0x0F;
match sub {
0xB => Some(GlobalEffect::PatternLoop(val as usize)),
0xE => Some(GlobalEffect::PatternDelay {
quantity: val as usize,
tempo: true,
}),
_ => None,
}
}
// T - Set tempo
20 => {
if param >= 0x20 {
Some(GlobalEffect::Bpm(param as usize))
} else {
None
}
}
// V - Set global volume
22 => {
if param <= 0x40 {
Some(GlobalEffect::Volume(param as f32 / 64.0))
} else {
None
}
}
// W - Global volume slide
23 => {
let high = (param & 0xF0) >> 4;
let low = param & 0x0F;
match (high, low) {
(0xF, f) => Some(GlobalEffect::VolumeSlide {
speed: -(f as f32) / 64.0,
fine: true,
}),
(f, 0xF) => Some(GlobalEffect::VolumeSlide {
speed: f as f32 / 64.0,
fine: true,
}),
(0, f) => Some(GlobalEffect::VolumeSlide {
speed: -(f as f32) / 64.0,
fine: false,
}),
(f, 0) => Some(GlobalEffect::VolumeSlide {
speed: f as f32 / 64.0,
fine: false,
}),
_ => None,
}
}
_ => None,
}
}
// --- Public API ---
pub fn s3m_unpack(
freq_type: FrequencyType,
flags: S3mImportFlags,
current: &PatternSlot,
) -> TrackImportUnit {
let te = Self::s3m_walk_effect(freq_type, flags, current);
let ve = Self::s3m_walk_volume(current);
let ge = Self::s3m_walk_global_effect(current);
let mut tiu = TrackImportUnit::default();
tiu.note = current.note;
tiu.instrument = current.instrument;
if let Some(e) = ve {
tiu.effects.push(e);
}
if let Some(e) = te {
tiu.effects.extend(e);
}
if let Some(g) = ge {
tiu.global_effects.push(g);
}
tiu
}
pub fn s3m_unpack_pattern(
freq_type: FrequencyType,
flags: S3mImportFlags,
pattern: &[Vec<PatternSlot>],
) -> Vec<Vec<TrackImportUnit>> {
pattern
.iter()
.map(|row| {
row.iter()
.map(|slot| Self::s3m_unpack(freq_type, flags, slot))
.collect()
})
.collect()
}
}