MCUME/MCUME_esp32/espboot/main/LibFC14/FC_Data.cpp

216 wiersze
12 KiB
C++

// Future Composer audio decoder -- Copyright (C) Michael Schwendt
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#include "FC.h"
const std::string FC::SMOD_FORMAT_NAME = "Future Composer 1.0 - 1.3 (AMIGA)";
const std::string FC::FC14_FORMAT_NAME = "Future Composer 1.4 (AMIGA)";
const std::string FC::UNKNOWN_FORMAT_NAME = "unknown format";
const ubyte FC::silenceData[8] = {
// Used as ``silent'' volume and modulation sequence.
// seqSpeed, sndSeq, vibSpeed, vibAmp, vibDelay, initial Volume, ...
//
// Silent volume sequence starts here.
0x01,
// Silent modulation sequence starts here.
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, SEQ_END
};
const uword FC::periods[(5+6)*12+4] = {
0x06b0, 0x0650, 0x05f4, 0x05a0, 0x054c, 0x0500, 0x04b8, 0x0474,
0x0434, 0x03f8, 0x03c0, 0x038a,
// +0x0c (*2 = byte-offset)
0x0358, 0x0328, 0x02fa, 0x02d0, 0x02a6, 0x0280, 0x025c, 0x023a,
0x021a, 0x01fc, 0x01e0, 0x01c5,
// +0x18 (*2 = byte-offset)
0x01ac, 0x0194, 0x017d, 0x0168, 0x0153, 0x0140, 0x012e, 0x011d,
0x010d, 0x00fe, 0x00f0, 0x00e2,
// +0x24 (*2 = byte-offset)
0x00d6, 0x00ca, 0x00be, 0x00b4, 0x00aa, 0x00a0, 0x0097, 0x008f,
0x0087, 0x007f, 0x0078, 0x0071,
// +0x30 (*2 = byte-offset)
0x0071, 0x0071, 0x0071, 0x0071, 0x0071, 0x0071, 0x0071, 0x0071,
0x0071, 0x0071, 0x0071, 0x0071,
// +0x3c (*2 = byte-offset)
0x0d60, 0x0ca0, 0x0be8, 0x0b40, 0x0a98, 0x0a00, 0x0970, 0x08e8,
0x0868, 0x07f0, 0x0780, 0x0714,
// +0x48 (*2 = byte-offset)
//
// (NOTE) 0x49 = PATTERN BREAK, so the extra low octave would be
// useless for direct access. Transpose values would be required.
// However, the FC 1.4 player still has hardcoded 0x0d60 as the lowest
// sample period and does a range-check prior to writing a period to
// the AMIGA custom chip. In short: This octave is useless! Plus:
// Since some music modules access the periods at offset 0x54 via
// transpose, the useless octave cause breakage.
// 0x1ac0, 0x1940, 0x17d0, 0x1680, 0x1530, 0x1400, 0x12e0, 0x11d0,
// 0x10d0, 0x0fe0, 0x0f00, 0x0e28,
//
// End of Future Composer 1.0 - 1.3 period table.
0x06b0, 0x0650, 0x05f4, 0x05a0, 0x054c, 0x0500, 0x04b8, 0x0474,
0x0434, 0x03f8, 0x03c0, 0x038a,
// +0x54 (*2 = byte-offset)
0x0358, 0x0328, 0x02fa, 0x02d0, 0x02a6, 0x0280, 0x025c, 0x023a,
0x021a, 0x01fc, 0x01e0, 0x01c5,
// +0x60 (*2 = byte-offset)
0x01ac, 0x0194, 0x017d, 0x0168, 0x0153, 0x0140, 0x012e, 0x011d,
0x010d, 0x00fe, 0x00f0, 0x00e2,
// +0x6c (*2 = byte-offset)
0x00d6, 0x00ca, 0x00be, 0x00b4, 0x00aa, 0x00a0, 0x0097, 0x008f,
// +0x78 (*2 = byte-offset)
0x0087, 0x007f, 0x0078, 0x0071
// +0x80 (*2 = byte-offset), everything from here on is unreachable
// due to 0x7f AND.
};
const uword FC::SMOD_waveInfo[47*4] = {
0x0000, 0x0010, 0x0000, 0x0010,
0x0020, 0x0010, 0x0000, 0x0010,
0x0040, 0x0010, 0x0000, 0x0010,
0x0060, 0x0010, 0x0000, 0x0010,
0x0080, 0x0010, 0x0000, 0x0010,
0x00a0, 0x0010, 0x0000, 0x0010,
0x00c0, 0x0010, 0x0000, 0x0010,
0x00e0, 0x0010, 0x0000, 0x0010,
0x0100, 0x0010, 0x0000, 0x0010,
0x0120, 0x0010, 0x0000, 0x0010,
0x0140, 0x0010, 0x0000, 0x0010,
0x0160, 0x0010, 0x0000, 0x0010,
0x0180, 0x0010, 0x0000, 0x0010,
0x01a0, 0x0010, 0x0000, 0x0010,
0x01c0, 0x0010, 0x0000, 0x0010,
0x01e0, 0x0010, 0x0000, 0x0010,
0x0200, 0x0010, 0x0000, 0x0010,
0x0220, 0x0010, 0x0000, 0x0010,
0x0240, 0x0010, 0x0000, 0x0010,
0x0260, 0x0010, 0x0000, 0x0010,
0x0280, 0x0010, 0x0000, 0x0010,
0x02a0, 0x0010, 0x0000, 0x0010,
0x02c0, 0x0010, 0x0000, 0x0010,
0x02e0, 0x0010, 0x0000, 0x0010,
0x0300, 0x0010, 0x0000, 0x0010,
0x0320, 0x0010, 0x0000, 0x0010,
0x0340, 0x0010, 0x0000, 0x0010,
0x0360, 0x0010, 0x0000, 0x0010,
0x0380, 0x0010, 0x0000, 0x0010,
0x03a0, 0x0010, 0x0000, 0x0010,
0x03c0, 0x0010, 0x0000, 0x0010,
0x03e0, 0x0010, 0x0000, 0x0010,
0x0400, 0x0008, 0x0000, 0x0008,
0x0410, 0x0008, 0x0000, 0x0008,
0x0420, 0x0008, 0x0000, 0x0008,
0x0430, 0x0008, 0x0000, 0x0008,
0x0440, 0x0008, 0x0000, 0x0008,
0x0450, 0x0008, 0x0000, 0x0008,
0x0460, 0x0008, 0x0000, 0x0008,
0x0470, 0x0008, 0x0000, 0x0008,
0x0480, 0x0010, 0x0000, 0x0010,
0x04a0, 0x0008, 0x0000, 0x0008,
0x04b0, 0x0010, 0x0000, 0x0010,
0x04d0, 0x0010, 0x0000, 0x0010,
0x04f0, 0x0008, 0x0000, 0x0008,
0x0500, 0x0008, 0x0000, 0x0008,
0x0510, 0x0018, 0x0000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x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,0x7f,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,
0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x81,0x7f,0x7f,0x7f,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,0x7f,
0x80,0x80,0x90,0x98,0xa0,0xa8,0xb0,0xb8,0xc0,0xc8,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8,
0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x7f,
0x80,0x80,0xa0,0xb0,0xc0,0xd0,0xe0,0xf0,0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70,
0x45,0x45,0x79,0x7d,0x7a,0x77,0x70,0x66,0x61,0x58,0x53,0x4d,0x2c,0x20,0x18,0x12,
0x04,0xdb,0xd3,0xcd,0xc6,0xbc,0xb5,0xae,0xa8,0xa3,0x9d,0x99,0x93,0x8e,0x8b,0x8a,
0x45,0x45,0x79,0x7d,0x7a,0x77,0x70,0x66,0x5b,0x4b,0x43,0x37,0x2c,0x20,0x18,0x12,
0x04,0xf8,0xe8,0xdb,0xcf,0xc6,0xbe,0xb0,0xa8,0xa4,0x9e,0x9a,0x95,0x94,0x8d,0x83,
0x00,0x00,0x40,0x60,0x7f,0x60,0x40,0x20,0x00,0xe0,0xc0,0xa0,0x80,0xa0,0xc0,0xe0,
0x00,0x00,0x40,0x60,0x7f,0x60,0x40,0x20,0x00,0xe0,0xc0,0xa0,0x80,0xa0,0xc0,0xe0,
0x80,0x80,0x90,0x98,0xa0,0xa8,0xb0,0xb8,0xc0,0xc8,0xd0,0xd8,0xe0,0xe8,0xf0,0xf8,
0x00,0x08,0x10,0x18,0x20,0x28,0x30,0x38,0x40,0x48,0x50,0x58,0x60,0x68,0x70,0x7f,
0x80,0x80,0xa0,0xb0,0xc0,0xd0,0xe0,0xf0,0x00,0x10,0x20,0x30,0x40,0x50,0x60,0x70
};