diff --git a/assets/data/saa-player-i0-pp.bin b/assets/data/saa-player-i0-pp.bin index 4ba85c5..96504ab 100644 Binary files a/assets/data/saa-player-i0-pp.bin and b/assets/data/saa-player-i0-pp.bin differ diff --git a/assets/data/saa-player-i0-pp.rtb b/assets/data/saa-player-i0-pp.rtb index 03f62d0..2f5fdd7 100644 Binary files a/assets/data/saa-player-i0-pp.rtb and b/assets/data/saa-player-i0-pp.rtb differ diff --git a/assets/data/saa-player-i0.bin b/assets/data/saa-player-i0.bin index 0a8ea37..4724694 100644 Binary files a/assets/data/saa-player-i0.bin and b/assets/data/saa-player-i0.bin differ diff --git a/assets/data/saa-player-i0.rtb b/assets/data/saa-player-i0.rtb index 95d889f..bef32a4 100644 Binary files a/assets/data/saa-player-i0.rtb and b/assets/data/saa-player-i0.rtb differ diff --git a/assets/data/saa-player-i1-pp.bin b/assets/data/saa-player-i1-pp.bin index 4467173..88db42d 100644 Binary files a/assets/data/saa-player-i1-pp.bin and b/assets/data/saa-player-i1-pp.bin differ diff --git a/assets/data/saa-player-i1-pp.rtb b/assets/data/saa-player-i1-pp.rtb index d924674..4e8bc97 100644 Binary files a/assets/data/saa-player-i1-pp.rtb and b/assets/data/saa-player-i1-pp.rtb differ diff --git a/assets/data/saa-player-i1.bin b/assets/data/saa-player-i1.bin index f99fe84..22abb9b 100644 Binary files a/assets/data/saa-player-i1.bin and b/assets/data/saa-player-i1.bin differ diff --git a/assets/data/saa-player-i1.rtb b/assets/data/saa-player-i1.rtb index 17f53dd..c4e05d1 100644 Binary files a/assets/data/saa-player-i1.rtb and b/assets/data/saa-player-i1.rtb differ diff --git a/assets/data/saa-player-i2-pp.bin b/assets/data/saa-player-i2-pp.bin index 83f07f0..4b1a782 100644 Binary files a/assets/data/saa-player-i2-pp.bin and b/assets/data/saa-player-i2-pp.bin differ diff --git a/assets/data/saa-player-i2-pp.rtb b/assets/data/saa-player-i2-pp.rtb index d924674..4e8bc97 100644 Binary files a/assets/data/saa-player-i2-pp.rtb and b/assets/data/saa-player-i2-pp.rtb differ diff --git a/assets/data/saa-player-i2.bin b/assets/data/saa-player-i2.bin index 7dbbcfc..e443db9 100644 Binary files a/assets/data/saa-player-i2.bin and b/assets/data/saa-player-i2.bin differ diff --git a/assets/data/saa-player-i2.rtb b/assets/data/saa-player-i2.rtb index 17f53dd..c4e05d1 100644 Binary files a/assets/data/saa-player-i2.rtb and b/assets/data/saa-player-i2.rtb differ diff --git a/assets/data/saa-player-i3-pp.bin b/assets/data/saa-player-i3-pp.bin index 9419271..f5409e4 100644 Binary files a/assets/data/saa-player-i3-pp.bin and b/assets/data/saa-player-i3-pp.bin differ diff --git a/assets/data/saa-player-i3-pp.rtb b/assets/data/saa-player-i3-pp.rtb index d924674..4e8bc97 100644 Binary files a/assets/data/saa-player-i3-pp.rtb and b/assets/data/saa-player-i3-pp.rtb differ diff --git a/assets/data/saa-player-i3.bin b/assets/data/saa-player-i3.bin index 3587204..bd938e5 100644 Binary files a/assets/data/saa-player-i3.bin and b/assets/data/saa-player-i3.bin differ diff --git a/assets/data/saa-player-i3.rtb b/assets/data/saa-player-i3.rtb index 17f53dd..c4e05d1 100644 Binary files a/assets/data/saa-player-i3.rtb and b/assets/data/saa-player-i3.rtb differ diff --git a/assets/data/saa-player-z0.bin b/assets/data/saa-player-z0.bin index d992952..cf0bd3c 100644 Binary files a/assets/data/saa-player-z0.bin and b/assets/data/saa-player-z0.bin differ diff --git a/assets/data/saa-player-z0.rtb b/assets/data/saa-player-z0.rtb index 0ca5112..2c95f8b 100644 Binary files a/assets/data/saa-player-z0.rtb and b/assets/data/saa-player-z0.rtb differ diff --git a/assets/data/saa-player-z1.bin b/assets/data/saa-player-z1.bin index f6ba64b..7962d50 100644 Binary files a/assets/data/saa-player-z1.bin and b/assets/data/saa-player-z1.bin differ diff --git a/assets/data/saa-player-z1.rtb b/assets/data/saa-player-z1.rtb index 541dc72..ccf868a 100644 Binary files a/assets/data/saa-player-z1.rtb and b/assets/data/saa-player-z1.rtb differ diff --git a/assets/data/saa-player-z2.bin b/assets/data/saa-player-z2.bin index 14d9cf1..b90a618 100644 Binary files a/assets/data/saa-player-z2.bin and b/assets/data/saa-player-z2.bin differ diff --git a/assets/data/saa-player-z2.rtb b/assets/data/saa-player-z2.rtb index 541dc72..ccf868a 100644 Binary files a/assets/data/saa-player-z2.rtb and b/assets/data/saa-player-z2.rtb differ diff --git a/assets/data/saa-player-z3.bin b/assets/data/saa-player-z3.bin index c046686..af7bf7d 100644 Binary files a/assets/data/saa-player-z3.bin and b/assets/data/saa-player-z3.bin differ diff --git a/assets/data/saa-player-z3.rtb b/assets/data/saa-player-z3.rtb index 541dc72..ccf868a 100644 Binary files a/assets/data/saa-player-z3.rtb and b/assets/data/saa-player-z3.rtb differ diff --git a/doc/export_data_format.txt b/doc/export_data_format.txt index 4dbc89c..985c0f6 100644 --- a/doc/export_data_format.txt +++ b/doc/export_data_format.txt @@ -64,13 +64,13 @@ focusing on shortest data length. All pointers in header are offsets from the |---|---|---|---|---|---|---|---| 1. | 0 | T | T | T | T | T | T | T | # bit.7 not set for pattern data |---|---|---|---|---|---|---|---| - 2. | V | P | | S | S | S | S | S | - |---|---|---|---|---|---|---|---| - 3. | C | C | C | C | O | O | O | O | + 2. | V | P | N | S | S | S | S | S | |---|---|---|---|---|---|---|---| ... |---|---|---|---|---|---|---|---| -(4) | L | L | L | L | R | R | R | R | +(3) | C | C | C | C | O | O | O | O | + |---|---|---|---|---|---|---|---| +(4) | R | R | R | R | L | L | L | L | |---|---|---|---|---|---|---|---| (5) | D | D | D | D | D | D | D | D | |---|---|---|---|---|---|---|---| @@ -88,6 +88,9 @@ S - sample number: [0] - no change [1 - 31] - samples (1 - V) +N - no changing sample/ornament/command: + [1] - nothing more than note was changed (S = 0) + O - ornament number: [0] - no change [1 - 15] - ornaments (1 - F) diff --git a/src/compiler/optimizer.ts b/src/compiler/optimizer.ts index ff91c3f..2ea8500 100644 --- a/src/compiler/optimizer.ts +++ b/src/compiler/optimizer.ts @@ -47,11 +47,16 @@ export class CompilerOptimizer { return this.patList.reduce>( (set, patData) => { for (let i = 0; i < patData.length; i++) { - const v = patData[i]; - if ((v & 0x80) > 0) { + const t = patData[i]; + if ((t & 0x80) > 0) { + // omit empty lines continue; } let s = patData[++i]; + if ((s & 0x20) > 0) { + // omit only tone changes + continue; + } let o = patData[++i]; if ((s & 0x80) > 0) { i++; @@ -208,11 +213,16 @@ export class CompilerOptimizer { private replaceSampleInPatterns(oldSmpNum: number, newSmpNum: number) { this.patList?.forEach(patData => { for (let i = 0; i < patData.length; i++) { - const v = patData[i]; - if ((v & 0x80) > 0) { + const t = patData[i]; + if ((t & 0x80) > 0) { + // omit empty lines continue; } const s = patData[++i]; + if ((s & 0x20) > 0) { + // omit only tone changes + continue; + } const si = i; const o = patData[++i]; if ((s & 0x80) > 0) { @@ -238,11 +248,16 @@ export class CompilerOptimizer { private renumberSamplesInPatterns(smpNum: number): void { this.patList?.forEach(patData => { for (let i = 0; i < patData.length; i++) { - const v = patData[i]; - if ((v & 0x80) > 0) { + const t = patData[i]; + if ((t & 0x80) > 0) { + // omit empty lines continue; } const s = patData[++i]; + if ((s & 0x20) > 0) { + // omit only tone changes + continue; + } const si = i; const o = patData[++i]; if ((s & 0x80) > 0) { @@ -377,11 +392,16 @@ export class CompilerOptimizer { private replaceOrnamentInPatterns(oldOrnNum: number, newOrnNum: number): void { this.patList?.forEach(patData => { for (let i = 0; i < patData.length; i++) { - const v = patData[i]; - if ((v & 0x80) > 0) { + const t = patData[i]; + if ((t & 0x80) > 0) { + // omit empty lines continue; } const s = patData[++i]; + if ((s & 0x20) > 0) { + // omit only tone changes + continue; + } const o = patData[++i]; const oi = i; if ((s & 0x80) > 0) { @@ -407,11 +427,16 @@ export class CompilerOptimizer { private renumberOrnamentsInPatterns(ornNum: number): void { this.patList?.forEach(patData => { for (let i = 0; i < patData.length; i++) { - const v = patData[i]; - if ((v & 0x80) > 0) { + const t = patData[i]; + if ((t & 0x80) > 0) { + // omit empty lines continue; } const s = patData[++i]; + if ((s & 0x20) > 0) { + // omit only tone changes + continue; + } const o = patData[++i]; const oi = i; if ((s & 0x80) > 0) { diff --git a/src/compiler/renderer.ts b/src/compiler/renderer.ts index 88f6f03..814eb77 100644 --- a/src/compiler/renderer.ts +++ b/src/compiler/renderer.ts @@ -310,20 +310,27 @@ export default class CompilerRender extends CompilerOptimizer { else { lastEmptyLines = 0; data[offY++] = b1; - data[offY++] = b2; - data[offY++] = b3; - if (vol > 0) { - data[offY++] = vol; - } - if (cmd > 0) { - if (cmd === 0xB) { // Cmd-B - const backOffset = offY - breakToLineOffset + 2; - writeWordLE(data, offY, -backOffset); - offY += 2; - break; + + if (b2 > 0 || b3 > 0) { + data[offY++] = b2; + data[offY++] = b3; + if (vol > 0) { + data[offY++] = vol; } + if (cmd > 0) { + if (cmd === 0xB) { // Cmd-B + const backOffset = offY - breakToLineOffset + 2; + writeWordLE(data, offY, -backOffset); + offY += 2; + break; + } - data[offY++] = dat; + data[offY++] = dat; + } + } + else { + // optimization for only note changed + data[offY++] = 0x20; } } }