summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKiritoDv <kiritodev01@gmail.com>2023-09-15 20:46:06 -0600
committerKiritoDv <kiritodev01@gmail.com>2023-09-15 20:46:06 -0600
commitfc7bf4c6ec1a637bb9eb240220533af856dc5a66 (patch)
tree367a6e2c240ab0249b14c904588b84f104fe29e2
parent50b6c6f65bc0da4a2c07e24c75dcd19baba60083 (diff)
Added full bank extraction
-rw-r--r--assets.json39
-rw-r--r--banks_table.h129
-rw-r--r--lib/hj/pyutils.h8
-rw-r--r--samples_table.h717
-rw-r--r--src/Companion.cpp2
-rw-r--r--src/audio/AudioManager.cpp387
-rw-r--r--src/audio/AudioManager.h80
-rw-r--r--src/audio/samples_table.h722
-rw-r--r--src/factories/AudioFactory.cpp156
-rw-r--r--src/factories/RawFactory.h2
-rw-r--r--src/factories/ResourceType.h2
-rw-r--r--tools/gen_banks.js37
-rw-r--r--tools/gen_samples.js37
13 files changed, 2107 insertions, 211 deletions
diff --git a/assets.json b/assets.json
index 81bcd62..43208d4 100644
--- a/assets.json
+++ b/assets.json
@@ -1121,6 +1121,7 @@
"sound/sequences/us/20_cutscene_ending.m64": [1882,{"us":[8174192]}],
"sound/sequences/us/21_menu_file_select.m64": [781,{"us":[8176080]}],
"sound/sequences/us/22_cutscene_lakitu.m64": [313,{"us":[8176864]}],
+"sound/bank_sets.bset": [159, { "us": [8177185] }],
"@sound_data": {
"us": {
"bank_sets": [8177184, 160],
@@ -1128,6 +1129,44 @@
"sound_tbl": [5846368, 2216704]
}
},
+"sound/banks/us/00_bank.bnk": {"us": [0]},
+"sound/banks/us/01_bank.bnk": {"us": [1]},
+"sound/banks/us/02_bank.bnk": {"us": [2]},
+"sound/banks/us/03_bank.bnk": {"us": [3]},
+"sound/banks/us/04_bank.bnk": {"us": [4]},
+"sound/banks/us/05_bank.bnk": {"us": [5]},
+"sound/banks/us/06_bank.bnk": {"us": [6]},
+"sound/banks/us/07_bank.bnk": {"us": [7]},
+"sound/banks/us/08_bank.bnk": {"us": [8]},
+"sound/banks/us/09_bank.bnk": {"us": [9]},
+"sound/banks/us/0A_bank.bnk": {"us": [10]},
+"sound/banks/us/0B_bank.bnk": {"us": [11]},
+"sound/banks/us/0C_bank.bnk": {"us": [12]},
+"sound/banks/us/0D_bank.bnk": {"us": [13]},
+"sound/banks/us/0E_bank.bnk": {"us": [14]},
+"sound/banks/us/0F_bank.bnk": {"us": [15]},
+"sound/banks/us/10_bank.bnk": {"us": [16]},
+"sound/banks/us/11_bank.bnk": {"us": [17]},
+"sound/banks/us/12_bank.bnk": {"us": [18]},
+"sound/banks/us/13_bank.bnk": {"us": [19]},
+"sound/banks/us/14_bank.bnk": {"us": [20]},
+"sound/banks/us/15_bank.bnk": {"us": [21]},
+"sound/banks/us/16_bank.bnk": {"us": [22]},
+"sound/banks/us/17_bank.bnk": {"us": [23]},
+"sound/banks/us/18_bank.bnk": {"us": [24]},
+"sound/banks/us/19_bank.bnk": {"us": [25]},
+"sound/banks/us/1A_bank.bnk": {"us": [26]},
+"sound/banks/us/1B_bank.bnk": {"us": [27]},
+"sound/banks/us/1C_bank.bnk": {"us": [28]},
+"sound/banks/us/1D_bank.bnk": {"us": [29]},
+"sound/banks/us/1E_bank.bnk": {"us": [30]},
+"sound/banks/us/1F_bank.bnk": {"us": [31]},
+"sound/banks/us/20_bank.bnk": {"us": [32]},
+"sound/banks/us/21_bank.bnk": {"us": [33]},
+"sound/banks/us/22_bank.bnk": {"us": [34]},
+"sound/banks/us/23_bank.bnk": {"us": [35]},
+"sound/banks/us/24_bank.bnk": {"us": [36]},
+"sound/banks/us/25_bank.bnk": {"us": [37]},
"textures/cave/hmc_textures.00000.rgba16.png": [32,64,4096,{"jp":[3432432,0],"us":[3439184,0],"eu":[3312784,0],"sh":[3287152,0]}],
"textures/cave/hmc_textures.01000.rgba16.png": [32,32,2048,{"jp":[3432432,4096],"us":[3439184,4096],"eu":[3312784,4096],"sh":[3287152,4096]}],
"textures/cave/hmc_textures.01800.rgba16.png": [32,64,4096,{"jp":[3432432,6144],"us":[3439184,6144],"eu":[3312784,6144],"sh":[3287152,6144]}],
diff --git a/banks_table.h b/banks_table.h
new file mode 100644
index 0000000..1c05cb1
--- /dev/null
+++ b/banks_table.h
@@ -0,0 +1,129 @@
+#pragma once
+#include "align_asset_macro.h"
+
+#define dgBank00 "__OTR__sound/banks/us/00_bank"
+static const ALIGN_ASSET(2) char gBank00[] = dgBank00;
+
+#define dgBank01 "__OTR__sound/banks/us/01_bank"
+static const ALIGN_ASSET(2) char gBank01[] = dgBank01;
+
+#define dgBank02 "__OTR__sound/banks/us/02_bank"
+static const ALIGN_ASSET(2) char gBank02[] = dgBank02;
+
+#define dgBank03 "__OTR__sound/banks/us/03_bank"
+static const ALIGN_ASSET(2) char gBank03[] = dgBank03;
+
+#define dgBank04 "__OTR__sound/banks/us/04_bank"
+static const ALIGN_ASSET(2) char gBank04[] = dgBank04;
+
+#define dgBank05 "__OTR__sound/banks/us/05_bank"
+static const ALIGN_ASSET(2) char gBank05[] = dgBank05;
+
+#define dgBank06 "__OTR__sound/banks/us/06_bank"
+static const ALIGN_ASSET(2) char gBank06[] = dgBank06;
+
+#define dgBank07 "__OTR__sound/banks/us/07_bank"
+static const ALIGN_ASSET(2) char gBank07[] = dgBank07;
+
+#define dgBank08 "__OTR__sound/banks/us/08_bank"
+static const ALIGN_ASSET(2) char gBank08[] = dgBank08;
+
+#define dgBank09 "__OTR__sound/banks/us/09_bank"
+static const ALIGN_ASSET(2) char gBank09[] = dgBank09;
+
+#define dgBank0A "__OTR__sound/banks/us/0A_bank"
+static const ALIGN_ASSET(2) char gBank0A[] = dgBank0A;
+
+#define dgBank0B "__OTR__sound/banks/us/0B_bank"
+static const ALIGN_ASSET(2) char gBank0B[] = dgBank0B;
+
+#define dgBank0C "__OTR__sound/banks/us/0C_bank"
+static const ALIGN_ASSET(2) char gBank0C[] = dgBank0C;
+
+#define dgBank0D "__OTR__sound/banks/us/0D_bank"
+static const ALIGN_ASSET(2) char gBank0D[] = dgBank0D;
+
+#define dgBank0E "__OTR__sound/banks/us/0E_bank"
+static const ALIGN_ASSET(2) char gBank0E[] = dgBank0E;
+
+#define dgBank0F "__OTR__sound/banks/us/0F_bank"
+static const ALIGN_ASSET(2) char gBank0F[] = dgBank0F;
+
+#define dgBank10 "__OTR__sound/banks/us/10_bank"
+static const ALIGN_ASSET(2) char gBank10[] = dgBank10;
+
+#define dgBank11 "__OTR__sound/banks/us/11_bank"
+static const ALIGN_ASSET(2) char gBank11[] = dgBank11;
+
+#define dgBank12 "__OTR__sound/banks/us/12_bank"
+static const ALIGN_ASSET(2) char gBank12[] = dgBank12;
+
+#define dgBank13 "__OTR__sound/banks/us/13_bank"
+static const ALIGN_ASSET(2) char gBank13[] = dgBank13;
+
+#define dgBank14 "__OTR__sound/banks/us/14_bank"
+static const ALIGN_ASSET(2) char gBank14[] = dgBank14;
+
+#define dgBank15 "__OTR__sound/banks/us/15_bank"
+static const ALIGN_ASSET(2) char gBank15[] = dgBank15;
+
+#define dgBank16 "__OTR__sound/banks/us/16_bank"
+static const ALIGN_ASSET(2) char gBank16[] = dgBank16;
+
+#define dgBank17 "__OTR__sound/banks/us/17_bank"
+static const ALIGN_ASSET(2) char gBank17[] = dgBank17;
+
+#define dgBank18 "__OTR__sound/banks/us/18_bank"
+static const ALIGN_ASSET(2) char gBank18[] = dgBank18;
+
+#define dgBank19 "__OTR__sound/banks/us/19_bank"
+static const ALIGN_ASSET(2) char gBank19[] = dgBank19;
+
+#define dgBank1A "__OTR__sound/banks/us/1A_bank"
+static const ALIGN_ASSET(2) char gBank1A[] = dgBank1A;
+
+#define dgBank1B "__OTR__sound/banks/us/1B_bank"
+static const ALIGN_ASSET(2) char gBank1B[] = dgBank1B;
+
+#define dgBank1C "__OTR__sound/banks/us/1C_bank"
+static const ALIGN_ASSET(2) char gBank1C[] = dgBank1C;
+
+#define dgBank1D "__OTR__sound/banks/us/1D_bank"
+static const ALIGN_ASSET(2) char gBank1D[] = dgBank1D;
+
+#define dgBank1E "__OTR__sound/banks/us/1E_bank"
+static const ALIGN_ASSET(2) char gBank1E[] = dgBank1E;
+
+#define dgBank1F "__OTR__sound/banks/us/1F_bank"
+static const ALIGN_ASSET(2) char gBank1F[] = dgBank1F;
+
+#define dgBank20 "__OTR__sound/banks/us/20_bank"
+static const ALIGN_ASSET(2) char gBank20[] = dgBank20;
+
+#define dgBank21 "__OTR__sound/banks/us/21_bank"
+static const ALIGN_ASSET(2) char gBank21[] = dgBank21;
+
+#define dgBank22 "__OTR__sound/banks/us/22_bank"
+static const ALIGN_ASSET(2) char gBank22[] = dgBank22;
+
+#define dgBank23 "__OTR__sound/banks/us/23_bank"
+static const ALIGN_ASSET(2) char gBank23[] = dgBank23;
+
+#define dgBank24 "__OTR__sound/banks/us/24_bank"
+static const ALIGN_ASSET(2) char gBank24[] = dgBank24;
+
+#define dgBank25 "__OTR__sound/banks/us/25_bank"
+static const ALIGN_ASSET(2) char gBank25[] = dgBank25;
+
+static const char* gBankTable[] = {
+ gBank00, gBank01, gBank02, gBank03,
+ gBank04, gBank05, gBank06, gBank07,
+ gBank08, gBank09, gBank0A, gBank0B,
+ gBank0C, gBank0D, gBank0E, gBank0F,
+ gBank10, gBank11, gBank12, gBank13,
+ gBank14, gBank15, gBank16, gBank17,
+ gBank18, gBank19, gBank1A, gBank1B,
+ gBank1C, gBank1D, gBank1E, gBank1F,
+ gBank20, gBank21, gBank22, gBank23,
+ gBank24, gBank25,
+};
diff --git a/lib/hj/pyutils.h b/lib/hj/pyutils.h
index f7dafbf..f34c1d8 100644
--- a/lib/hj/pyutils.h
+++ b/lib/hj/pyutils.h
@@ -44,6 +44,14 @@ std::vector<T> keys(std::unordered_map<T, X> const &map) {
}
return result;
}
+template<typename T, typename X>
+std::vector<T> keys(std::map<T, X> const &map) {
+ std::vector<T> result;
+ for (auto const &pair: map) {
+ result.push_back(pair.first);
+ }
+ return result;
+}
}
template <typename T>
diff --git a/samples_table.h b/samples_table.h
new file mode 100644
index 0000000..5f1a3ae
--- /dev/null
+++ b/samples_table.h
@@ -0,0 +1,717 @@
+#pragma once
+#include "align_asset_macro.h"
+
+#define dgSample00 "__OTR__sound/samples/sfx_1/00_twirl"
+static const ALIGN_ASSET(2) char gSample00[] = dgSample00;
+
+#define dgSample01 "__OTR__sound/samples/sfx_1/01_brushing"
+static const ALIGN_ASSET(2) char gSample01[] = dgSample01;
+
+#define dgSample02 "__OTR__sound/samples/sfx_1/02_hand_touch"
+static const ALIGN_ASSET(2) char gSample02[] = dgSample02;
+
+#define dgSample03 "__OTR__sound/samples/sfx_1/03_yoshi"
+static const ALIGN_ASSET(2) char gSample03[] = dgSample03;
+
+#define dgSample04 "__OTR__sound/samples/sfx_1/04_plop"
+static const ALIGN_ASSET(2) char gSample04[] = dgSample04;
+
+#define dgSample05 "__OTR__sound/samples/sfx_1/05_heavy_landing"
+static const ALIGN_ASSET(2) char gSample05[] = dgSample05;
+
+#define dgSample06 "__OTR__sound/samples/sfx_terrain/00_step_default"
+static const ALIGN_ASSET(2) char gSample06[] = dgSample06;
+
+#define dgSample07 "__OTR__sound/samples/sfx_terrain/01_step_grass"
+static const ALIGN_ASSET(2) char gSample07[] = dgSample07;
+
+#define dgSample08 "__OTR__sound/samples/sfx_terrain/02_step_stone"
+static const ALIGN_ASSET(2) char gSample08[] = dgSample08;
+
+#define dgSample09 "__OTR__sound/samples/sfx_terrain/03_step_spooky"
+static const ALIGN_ASSET(2) char gSample09[] = dgSample09;
+
+#define dgSample0A "__OTR__sound/samples/sfx_terrain/04_step_snow"
+static const ALIGN_ASSET(2) char gSample0A[] = dgSample0A;
+
+#define dgSample0B "__OTR__sound/samples/sfx_terrain/05_step_ice"
+static const ALIGN_ASSET(2) char gSample0B[] = dgSample0B;
+
+#define dgSample0C "__OTR__sound/samples/sfx_terrain/06_step_metal"
+static const ALIGN_ASSET(2) char gSample0C[] = dgSample0C;
+
+#define dgSample0D "__OTR__sound/samples/sfx_terrain/07_step_sand"
+static const ALIGN_ASSET(2) char gSample0D[] = dgSample0D;
+
+#define dgSample0E "__OTR__sound/samples/sfx_water/00_plunge"
+static const ALIGN_ASSET(2) char gSample0E[] = dgSample0E;
+
+#define dgSample0F "__OTR__sound/samples/sfx_water/01_splash"
+static const ALIGN_ASSET(2) char gSample0F[] = dgSample0F;
+
+#define dgSample10 "__OTR__sound/samples/sfx_water/02_swim"
+static const ALIGN_ASSET(2) char gSample10[] = dgSample10;
+
+#define dgSample11 "__OTR__sound/samples/sfx_4/00"
+static const ALIGN_ASSET(2) char gSample11[] = dgSample11;
+
+#define dgSample12 "__OTR__sound/samples/sfx_4/01"
+static const ALIGN_ASSET(2) char gSample12[] = dgSample12;
+
+#define dgSample13 "__OTR__sound/samples/sfx_4/02"
+static const ALIGN_ASSET(2) char gSample13[] = dgSample13;
+
+#define dgSample14 "__OTR__sound/samples/sfx_4/03"
+static const ALIGN_ASSET(2) char gSample14[] = dgSample14;
+
+#define dgSample15 "__OTR__sound/samples/sfx_4/04"
+static const ALIGN_ASSET(2) char gSample15[] = dgSample15;
+
+#define dgSample16 "__OTR__sound/samples/sfx_4/05"
+static const ALIGN_ASSET(2) char gSample16[] = dgSample16;
+
+#define dgSample17 "__OTR__sound/samples/sfx_4/06"
+static const ALIGN_ASSET(2) char gSample17[] = dgSample17;
+
+#define dgSample18 "__OTR__sound/samples/sfx_4/07"
+static const ALIGN_ASSET(2) char gSample18[] = dgSample18;
+
+#define dgSample19 "__OTR__sound/samples/sfx_4/08"
+static const ALIGN_ASSET(2) char gSample19[] = dgSample19;
+
+#define dgSample1A "__OTR__sound/samples/sfx_4/09"
+static const ALIGN_ASSET(2) char gSample1A[] = dgSample1A;
+
+#define dgSample1B "__OTR__sound/samples/sfx_5/00"
+static const ALIGN_ASSET(2) char gSample1B[] = dgSample1B;
+
+#define dgSample1C "__OTR__sound/samples/sfx_5/01"
+static const ALIGN_ASSET(2) char gSample1C[] = dgSample1C;
+
+#define dgSample1D "__OTR__sound/samples/sfx_5/02"
+static const ALIGN_ASSET(2) char gSample1D[] = dgSample1D;
+
+#define dgSample1E "__OTR__sound/samples/sfx_5/03"
+static const ALIGN_ASSET(2) char gSample1E[] = dgSample1E;
+
+#define dgSample1F "__OTR__sound/samples/sfx_5/04"
+static const ALIGN_ASSET(2) char gSample1F[] = dgSample1F;
+
+#define dgSample20 "__OTR__sound/samples/sfx_5/05"
+static const ALIGN_ASSET(2) char gSample20[] = dgSample20;
+
+#define dgSample21 "__OTR__sound/samples/sfx_5/06"
+static const ALIGN_ASSET(2) char gSample21[] = dgSample21;
+
+#define dgSample22 "__OTR__sound/samples/sfx_5/07"
+static const ALIGN_ASSET(2) char gSample22[] = dgSample22;
+
+#define dgSample23 "__OTR__sound/samples/sfx_5/08"
+static const ALIGN_ASSET(2) char gSample23[] = dgSample23;
+
+#define dgSample24 "__OTR__sound/samples/sfx_5/09"
+static const ALIGN_ASSET(2) char gSample24[] = dgSample24;
+
+#define dgSample25 "__OTR__sound/samples/sfx_5/0A"
+static const ALIGN_ASSET(2) char gSample25[] = dgSample25;
+
+#define dgSample26 "__OTR__sound/samples/sfx_5/0B"
+static const ALIGN_ASSET(2) char gSample26[] = dgSample26;
+
+#define dgSample27 "__OTR__sound/samples/sfx_5/0C"
+static const ALIGN_ASSET(2) char gSample27[] = dgSample27;
+
+#define dgSample28 "__OTR__sound/samples/sfx_5/0D"
+static const ALIGN_ASSET(2) char gSample28[] = dgSample28;
+
+#define dgSample29 "__OTR__sound/samples/sfx_5/0E"
+static const ALIGN_ASSET(2) char gSample29[] = dgSample29;
+
+#define dgSample2A "__OTR__sound/samples/sfx_5/0F"
+static const ALIGN_ASSET(2) char gSample2A[] = dgSample2A;
+
+#define dgSample2B "__OTR__sound/samples/sfx_5/10"
+static const ALIGN_ASSET(2) char gSample2B[] = dgSample2B;
+
+#define dgSample2C "__OTR__sound/samples/sfx_5/11"
+static const ALIGN_ASSET(2) char gSample2C[] = dgSample2C;
+
+#define dgSample2D "__OTR__sound/samples/sfx_5/12"
+static const ALIGN_ASSET(2) char gSample2D[] = dgSample2D;
+
+#define dgSample2E "__OTR__sound/samples/sfx_5/13"
+static const ALIGN_ASSET(2) char gSample2E[] = dgSample2E;
+
+#define dgSample2F "__OTR__sound/samples/sfx_5/14"
+static const ALIGN_ASSET(2) char gSample2F[] = dgSample2F;
+
+#define dgSample30 "__OTR__sound/samples/sfx_5/15"
+static const ALIGN_ASSET(2) char gSample30[] = dgSample30;
+
+#define dgSample31 "__OTR__sound/samples/sfx_5/16"
+static const ALIGN_ASSET(2) char gSample31[] = dgSample31;
+
+#define dgSample32 "__OTR__sound/samples/sfx_5/17"
+static const ALIGN_ASSET(2) char gSample32[] = dgSample32;
+
+#define dgSample33 "__OTR__sound/samples/sfx_5/18"
+static const ALIGN_ASSET(2) char gSample33[] = dgSample33;
+
+#define dgSample34 "__OTR__sound/samples/sfx_5/19"
+static const ALIGN_ASSET(2) char gSample34[] = dgSample34;
+
+#define dgSample35 "__OTR__sound/samples/sfx_5/1A"
+static const ALIGN_ASSET(2) char gSample35[] = dgSample35;
+
+#define dgSample36 "__OTR__sound/samples/sfx_5/1B"
+static const ALIGN_ASSET(2) char gSample36[] = dgSample36;
+
+#define dgSample37 "__OTR__sound/samples/sfx_5/1C"
+static const ALIGN_ASSET(2) char gSample37[] = dgSample37;
+
+#define dgSample38 "__OTR__sound/samples/sfx_6/00"
+static const ALIGN_ASSET(2) char gSample38[] = dgSample38;
+
+#define dgSample39 "__OTR__sound/samples/sfx_6/01"
+static const ALIGN_ASSET(2) char gSample39[] = dgSample39;
+
+#define dgSample3A "__OTR__sound/samples/sfx_6/02"
+static const ALIGN_ASSET(2) char gSample3A[] = dgSample3A;
+
+#define dgSample3B "__OTR__sound/samples/sfx_6/03"
+static const ALIGN_ASSET(2) char gSample3B[] = dgSample3B;
+
+#define dgSample3C "__OTR__sound/samples/sfx_6/04"
+static const ALIGN_ASSET(2) char gSample3C[] = dgSample3C;
+
+#define dgSample3D "__OTR__sound/samples/sfx_6/05"
+static const ALIGN_ASSET(2) char gSample3D[] = dgSample3D;
+
+#define dgSample3E "__OTR__sound/samples/sfx_6/06"
+static const ALIGN_ASSET(2) char gSample3E[] = dgSample3E;
+
+#define dgSample3F "__OTR__sound/samples/sfx_6/07"
+static const ALIGN_ASSET(2) char gSample3F[] = dgSample3F;
+
+#define dgSample40 "__OTR__sound/samples/sfx_6/08"
+static const ALIGN_ASSET(2) char gSample40[] = dgSample40;
+
+#define dgSample41 "__OTR__sound/samples/sfx_6/09"
+static const ALIGN_ASSET(2) char gSample41[] = dgSample41;
+
+#define dgSample42 "__OTR__sound/samples/sfx_6/0A"
+static const ALIGN_ASSET(2) char gSample42[] = dgSample42;
+
+#define dgSample43 "__OTR__sound/samples/sfx_6/0B"
+static const ALIGN_ASSET(2) char gSample43[] = dgSample43;
+
+#define dgSample44 "__OTR__sound/samples/sfx_6/0C"
+static const ALIGN_ASSET(2) char gSample44[] = dgSample44;
+
+#define dgSample45 "__OTR__sound/samples/sfx_6/0D"
+static const ALIGN_ASSET(2) char gSample45[] = dgSample45;
+
+#define dgSample46 "__OTR__sound/samples/sfx_7/00"
+static const ALIGN_ASSET(2) char gSample46[] = dgSample46;
+
+#define dgSample47 "__OTR__sound/samples/sfx_7/01"
+static const ALIGN_ASSET(2) char gSample47[] = dgSample47;
+
+#define dgSample48 "__OTR__sound/samples/sfx_7/02"
+static const ALIGN_ASSET(2) char gSample48[] = dgSample48;
+
+#define dgSample49 "__OTR__sound/samples/sfx_7/03"
+static const ALIGN_ASSET(2) char gSample49[] = dgSample49;
+
+#define dgSample4A "__OTR__sound/samples/sfx_7/04"
+static const ALIGN_ASSET(2) char gSample4A[] = dgSample4A;
+
+#define dgSample4B "__OTR__sound/samples/sfx_7/05"
+static const ALIGN_ASSET(2) char gSample4B[] = dgSample4B;
+
+#define dgSample4C "__OTR__sound/samples/sfx_7/06"
+static const ALIGN_ASSET(2) char gSample4C[] = dgSample4C;
+
+#define dgSample4D "__OTR__sound/samples/sfx_7/07"
+static const ALIGN_ASSET(2) char gSample4D[] = dgSample4D;
+
+#define dgSample4E "__OTR__sound/samples/sfx_7/08"
+static const ALIGN_ASSET(2) char gSample4E[] = dgSample4E;
+
+#define dgSample4F "__OTR__sound/samples/sfx_7/09"
+static const ALIGN_ASSET(2) char gSample4F[] = dgSample4F;
+
+#define dgSample50 "__OTR__sound/samples/sfx_7/0A"
+static const ALIGN_ASSET(2) char gSample50[] = dgSample50;
+
+#define dgSample51 "__OTR__sound/samples/sfx_7/0B"
+static const ALIGN_ASSET(2) char gSample51[] = dgSample51;
+
+#define dgSample52 "__OTR__sound/samples/sfx_7/0C"
+static const ALIGN_ASSET(2) char gSample52[] = dgSample52;
+
+#define dgSample53 "__OTR__sound/samples/sfx_7/0D_chain_chomp_bark"
+static const ALIGN_ASSET(2) char gSample53[] = dgSample53;
+
+#define dgSample54 "__OTR__sound/samples/sfx_mario/00_mario_jump_hoo"
+static const ALIGN_ASSET(2) char gSample54[] = dgSample54;
+
+#define dgSample55 "__OTR__sound/samples/sfx_mario/01_mario_jump_wah"
+static const ALIGN_ASSET(2) char gSample55[] = dgSample55;
+
+#define dgSample56 "__OTR__sound/samples/sfx_mario/02_mario_yah"
+static const ALIGN_ASSET(2) char gSample56[] = dgSample56;
+
+#define dgSample57 "__OTR__sound/samples/sfx_mario/03_mario_haha"
+static const ALIGN_ASSET(2) char gSample57[] = dgSample57;
+
+#define dgSample58 "__OTR__sound/samples/sfx_mario/04_mario_yahoo"
+static const ALIGN_ASSET(2) char gSample58[] = dgSample58;
+
+#define dgSample59 "__OTR__sound/samples/sfx_mario/05_mario_uh"
+static const ALIGN_ASSET(2) char gSample59[] = dgSample59;
+
+#define dgSample5A "__OTR__sound/samples/sfx_mario/06_mario_hrmm"
+static const ALIGN_ASSET(2) char gSample5A[] = dgSample5A;
+
+#define dgSample5B "__OTR__sound/samples/sfx_mario/07_mario_wah2"
+static const ALIGN_ASSET(2) char gSample5B[] = dgSample5B;
+
+#define dgSample5C "__OTR__sound/samples/sfx_mario/08_mario_whoa"
+static const ALIGN_ASSET(2) char gSample5C[] = dgSample5C;
+
+#define dgSample5D "__OTR__sound/samples/sfx_mario/09_mario_eeuh"
+static const ALIGN_ASSET(2) char gSample5D[] = dgSample5D;
+
+#define dgSample5E "__OTR__sound/samples/sfx_mario/0A_mario_attacked"
+static const ALIGN_ASSET(2) char gSample5E[] = dgSample5E;
+
+#define dgSample5F "__OTR__sound/samples/sfx_mario/0B_mario_ooof"
+static const ALIGN_ASSET(2) char gSample5F[] = dgSample5F;
+
+#define dgSample60 "__OTR__sound/samples/sfx_mario/0C_mario_here_we_go"
+static const ALIGN_ASSET(2) char gSample60[] = dgSample60;
+
+#define dgSample61 "__OTR__sound/samples/sfx_mario/0D_mario_yawning"
+static const ALIGN_ASSET(2) char gSample61[] = dgSample61;
+
+#define dgSample62 "__OTR__sound/samples/sfx_mario/0E_mario_snoring1"
+static const ALIGN_ASSET(2) char gSample62[] = dgSample62;
+
+#define dgSample63 "__OTR__sound/samples/sfx_mario/0F_mario_snoring2"
+static const ALIGN_ASSET(2) char gSample63[] = dgSample63;
+
+#define dgSample64 "__OTR__sound/samples/sfx_mario/10_mario_doh"
+static const ALIGN_ASSET(2) char gSample64[] = dgSample64;
+
+#define dgSample65 "__OTR__sound/samples/sfx_mario/11_mario_game_over"
+static const ALIGN_ASSET(2) char gSample65[] = dgSample65;
+
+#define dgSample66 "__OTR__sound/samples/sfx_mario/12_mario_hello"
+static const ALIGN_ASSET(2) char gSample66[] = dgSample66;
+
+#define dgSample67 "__OTR__sound/samples/sfx_mario/13_mario_press_start_to_play"
+static const ALIGN_ASSET(2) char gSample67[] = dgSample67;
+
+#define dgSample68 "__OTR__sound/samples/sfx_mario/14_mario_twirl_bounce"
+static const ALIGN_ASSET(2) char gSample68[] = dgSample68;
+
+#define dgSample69 "__OTR__sound/samples/sfx_mario/15_mario_snoring3"
+static const ALIGN_ASSET(2) char gSample69[] = dgSample69;
+
+#define dgSample6A "__OTR__sound/samples/sfx_mario/16_mario_so_longa_bowser"
+static const ALIGN_ASSET(2) char gSample6A[] = dgSample6A;
+
+#define dgSample6B "__OTR__sound/samples/sfx_mario/17_mario_ima_tired"
+static const ALIGN_ASSET(2) char gSample6B[] = dgSample6B;
+
+#define dgSample6C "__OTR__sound/samples/sfx_mario/18_mario_waha"
+static const ALIGN_ASSET(2) char gSample6C[] = dgSample6C;
+
+#define dgSample6D "__OTR__sound/samples/sfx_mario/19_mario_yippee"
+static const ALIGN_ASSET(2) char gSample6D[] = dgSample6D;
+
+#define dgSample6E "__OTR__sound/samples/sfx_mario/1A_mario_lets_a_go"
+static const ALIGN_ASSET(2) char gSample6E[] = dgSample6E;
+
+#define dgSample6F "__OTR__sound/samples/sfx_9/00"
+static const ALIGN_ASSET(2) char gSample6F[] = dgSample6F;
+
+#define dgSample70 "__OTR__sound/samples/sfx_9/01"
+static const ALIGN_ASSET(2) char gSample70[] = dgSample70;
+
+#define dgSample71 "__OTR__sound/samples/sfx_9/02"
+static const ALIGN_ASSET(2) char gSample71[] = dgSample71;
+
+#define dgSample72 "__OTR__sound/samples/sfx_9/03"
+static const ALIGN_ASSET(2) char gSample72[] = dgSample72;
+
+#define dgSample73 "__OTR__sound/samples/sfx_9/04_camera_buzz"
+static const ALIGN_ASSET(2) char gSample73[] = dgSample73;
+
+#define dgSample74 "__OTR__sound/samples/sfx_9/05_camera_shutter"
+static const ALIGN_ASSET(2) char gSample74[] = dgSample74;
+
+#define dgSample75 "__OTR__sound/samples/sfx_9/06"
+static const ALIGN_ASSET(2) char gSample75[] = dgSample75;
+
+#define dgSample76 "__OTR__sound/samples/sfx_mario_peach/00_mario_waaaooow"
+static const ALIGN_ASSET(2) char gSample76[] = dgSample76;
+
+#define dgSample77 "__OTR__sound/samples/sfx_mario_peach/01_mario_hoohoo"
+static const ALIGN_ASSET(2) char gSample77[] = dgSample77;
+
+#define dgSample78 "__OTR__sound/samples/sfx_mario_peach/02_mario_panting"
+static const ALIGN_ASSET(2) char gSample78[] = dgSample78;
+
+#define dgSample79 "__OTR__sound/samples/sfx_mario_peach/03_mario_dying"
+static const ALIGN_ASSET(2) char gSample79[] = dgSample79;
+
+#define dgSample7A "__OTR__sound/samples/sfx_mario_peach/04_mario_on_fire"
+static const ALIGN_ASSET(2) char gSample7A[] = dgSample7A;
+
+#define dgSample7B "__OTR__sound/samples/sfx_mario_peach/05_mario_uh2"
+static const ALIGN_ASSET(2) char gSample7B[] = dgSample7B;
+
+#define dgSample7C "__OTR__sound/samples/sfx_mario_peach/06_mario_coughing"
+static const ALIGN_ASSET(2) char gSample7C[] = dgSample7C;
+
+#define dgSample7D "__OTR__sound/samples/sfx_mario_peach/07_mario_its_a_me_mario"
+static const ALIGN_ASSET(2) char gSample7D[] = dgSample7D;
+
+#define dgSample7E "__OTR__sound/samples/sfx_mario_peach/08_mario_punch_yah"
+static const ALIGN_ASSET(2) char gSample7E[] = dgSample7E;
+
+#define dgSample7F "__OTR__sound/samples/sfx_mario_peach/09_mario_punch_hoo"
+static const ALIGN_ASSET(2) char gSample7F[] = dgSample7F;
+
+#define dgSample80 "__OTR__sound/samples/sfx_mario_peach/0A_mario_mama_mia"
+static const ALIGN_ASSET(2) char gSample80[] = dgSample80;
+
+#define dgSample81 "__OTR__sound/samples/sfx_mario_peach/0B_mario_okey_dokey"
+static const ALIGN_ASSET(2) char gSample81[] = dgSample81;
+
+#define dgSample82 "__OTR__sound/samples/sfx_mario_peach/0C_mario_drowning"
+static const ALIGN_ASSET(2) char gSample82[] = dgSample82;
+
+#define dgSample83 "__OTR__sound/samples/sfx_mario_peach/0D_mario_thank_you_playing_my_game"
+static const ALIGN_ASSET(2) char gSample83[] = dgSample83;
+
+#define dgSample84 "__OTR__sound/samples/sfx_mario_peach/0E_peach_dear_mario"
+static const ALIGN_ASSET(2) char gSample84[] = dgSample84;
+
+#define dgSample85 "__OTR__sound/samples/sfx_mario_peach/0F_peach_mario"
+static const ALIGN_ASSET(2) char gSample85[] = dgSample85;
+
+#define dgSample86 "__OTR__sound/samples/sfx_mario_peach/10_peach_power_of_the_stars"
+static const ALIGN_ASSET(2) char gSample86[] = dgSample86;
+
+#define dgSample87 "__OTR__sound/samples/sfx_mario_peach/11_peach_thanks_to_you"
+static const ALIGN_ASSET(2) char gSample87[] = dgSample87;
+
+#define dgSample88 "__OTR__sound/samples/sfx_mario_peach/12_peach_thank_you_mario"
+static const ALIGN_ASSET(2) char gSample88[] = dgSample88;
+
+#define dgSample89 "__OTR__sound/samples/sfx_mario_peach/13_peach_something_special"
+static const ALIGN_ASSET(2) char gSample89[] = dgSample89;
+
+#define dgSample8A "__OTR__sound/samples/sfx_mario_peach/14_peach_bake_a_cake"
+static const ALIGN_ASSET(2) char gSample8A[] = dgSample8A;
+
+#define dgSample8B "__OTR__sound/samples/sfx_mario_peach/15_peach_for_mario"
+static const ALIGN_ASSET(2) char gSample8B[] = dgSample8B;
+
+#define dgSample8C "__OTR__sound/samples/sfx_mario_peach/16_peach_mario2"
+static const ALIGN_ASSET(2) char gSample8C[] = dgSample8C;
+
+#define dgSample8D "__OTR__sound/samples/instruments/00"
+static const ALIGN_ASSET(2) char gSample8D[] = dgSample8D;
+
+#define dgSample8E "__OTR__sound/samples/instruments/01_banjo_1"
+static const ALIGN_ASSET(2) char gSample8E[] = dgSample8E;
+
+#define dgSample8F "__OTR__sound/samples/instruments/02"
+static const ALIGN_ASSET(2) char gSample8F[] = dgSample8F;
+
+#define dgSample90 "__OTR__sound/samples/instruments/03_human_whistle"
+static const ALIGN_ASSET(2) char gSample90[] = dgSample90;
+
+#define dgSample91 "__OTR__sound/samples/instruments/04_bright_piano"
+static const ALIGN_ASSET(2) char gSample91[] = dgSample91;
+
+#define dgSample92 "__OTR__sound/samples/instruments/05_acoustic_bass"
+static const ALIGN_ASSET(2) char gSample92[] = dgSample92;
+
+#define dgSample93 "__OTR__sound/samples/instruments/06_kick_drum_1"
+static const ALIGN_ASSET(2) char gSample93[] = dgSample93;
+
+#define dgSample94 "__OTR__sound/samples/instruments/07_rimshot"
+static const ALIGN_ASSET(2) char gSample94[] = dgSample94;
+
+#define dgSample95 "__OTR__sound/samples/instruments/08"
+static const ALIGN_ASSET(2) char gSample95[] = dgSample95;
+
+#define dgSample96 "__OTR__sound/samples/instruments/09"
+static const ALIGN_ASSET(2) char gSample96[] = dgSample96;
+
+#define dgSample97 "__OTR__sound/samples/instruments/0A_tambourine"
+static const ALIGN_ASSET(2) char gSample97[] = dgSample97;
+
+#define dgSample98 "__OTR__sound/samples/instruments/0B"
+static const ALIGN_ASSET(2) char gSample98[] = dgSample98;
+
+#define dgSample99 "__OTR__sound/samples/instruments/0C_conga_stick"
+static const ALIGN_ASSET(2) char gSample99[] = dgSample99;
+
+#define dgSample9A "__OTR__sound/samples/instruments/0D_clave"
+static const ALIGN_ASSET(2) char gSample9A[] = dgSample9A;
+
+#define dgSample9B "__OTR__sound/samples/instruments/0E_hihat_closed"
+static const ALIGN_ASSET(2) char gSample9B[] = dgSample9B;
+
+#define dgSample9C "__OTR__sound/samples/instruments/0F_hihat_open"
+static const ALIGN_ASSET(2) char gSample9C[] = dgSample9C;
+
+#define dgSample9D "__OTR__sound/samples/instruments/10_cymbal_bell"
+static const ALIGN_ASSET(2) char gSample9D[] = dgSample9D;
+
+#define dgSample9E "__OTR__sound/samples/instruments/11_splash_cymbal"
+static const ALIGN_ASSET(2) char gSample9E[] = dgSample9E;
+
+#define dgSample9F "__OTR__sound/samples/instruments/12_snare_drum_1"
+static const ALIGN_ASSET(2) char gSample9F[] = dgSample9F;
+
+#define dgSampleA0 "__OTR__sound/samples/instruments/13_snare_drum_2"
+static const ALIGN_ASSET(2) char gSampleA0[] = dgSampleA0;
+
+#define dgSampleA1 "__OTR__sound/samples/instruments/14_strings_5"
+static const ALIGN_ASSET(2) char gSampleA1[] = dgSampleA1;
+
+#define dgSampleA2 "__OTR__sound/samples/instruments/15_strings_4"
+static const ALIGN_ASSET(2) char gSampleA2[] = dgSampleA2;
+
+#define dgSampleA3 "__OTR__sound/samples/instruments/16_french_horns"
+static const ALIGN_ASSET(2) char gSampleA3[] = dgSampleA3;
+
+#define dgSampleA4 "__OTR__sound/samples/instruments/17_trumpet"
+static const ALIGN_ASSET(2) char gSampleA4[] = dgSampleA4;
+
+#define dgSampleA5 "__OTR__sound/samples/instruments/18_timpani"
+static const ALIGN_ASSET(2) char gSampleA5[] = dgSampleA5;
+
+#define dgSampleA6 "__OTR__sound/samples/instruments/19_brass"
+static const ALIGN_ASSET(2) char gSampleA6[] = dgSampleA6;
+
+#define dgSampleA7 "__OTR__sound/samples/instruments/1A_slap_bass"
+static const ALIGN_ASSET(2) char gSampleA7[] = dgSampleA7;
+
+#define dgSampleA8 "__OTR__sound/samples/instruments/1B_organ_2"
+static const ALIGN_ASSET(2) char gSampleA8[] = dgSampleA8;
+
+#define dgSampleA9 "__OTR__sound/samples/instruments/1C"
+static const ALIGN_ASSET(2) char gSampleA9[] = dgSampleA9;
+
+#define dgSampleAA "__OTR__sound/samples/instruments/1D"
+static const ALIGN_ASSET(2) char gSampleAA[] = dgSampleAA;
+
+#define dgSampleAB "__OTR__sound/samples/instruments/1E_closed_triangle"
+static const ALIGN_ASSET(2) char gSampleAB[] = dgSampleAB;
+
+#define dgSampleAC "__OTR__sound/samples/instruments/1F_open_triangle"
+static const ALIGN_ASSET(2) char gSampleAC[] = dgSampleAC;
+
+#define dgSampleAD "__OTR__sound/samples/instruments/20_cabasa"
+static const ALIGN_ASSET(2) char gSampleAD[] = dgSampleAD;
+
+#define dgSampleAE "__OTR__sound/samples/instruments/21_sine_bass"
+static const ALIGN_ASSET(2) char gSampleAE[] = dgSampleAE;
+
+#define dgSampleAF "__OTR__sound/samples/instruments/22_boys_choir"
+static const ALIGN_ASSET(2) char gSampleAF[] = dgSampleAF;
+
+#define dgSampleB0 "__OTR__sound/samples/instruments/23_strings_1"
+static const ALIGN_ASSET(2) char gSampleB0[] = dgSampleB0;
+
+#define dgSampleB1 "__OTR__sound/samples/instruments/24_strings_2"
+static const ALIGN_ASSET(2) char gSampleB1[] = dgSampleB1;
+
+#define dgSampleB2 "__OTR__sound/samples/instruments/25_strings_3"
+static const ALIGN_ASSET(2) char gSampleB2[] = dgSampleB2;
+
+#define dgSampleB3 "__OTR__sound/samples/instruments/26_crystal_rhodes"
+static const ALIGN_ASSET(2) char gSampleB3[] = dgSampleB3;
+
+#define dgSampleB4 "__OTR__sound/samples/instruments/27_harpsichord"
+static const ALIGN_ASSET(2) char gSampleB4[] = dgSampleB4;
+
+#define dgSampleB5 "__OTR__sound/samples/instruments/28_sitar_1"
+static const ALIGN_ASSET(2) char gSampleB5[] = dgSampleB5;
+
+#define dgSampleB6 "__OTR__sound/samples/instruments/29_orchestra_hit"
+static const ALIGN_ASSET(2) char gSampleB6[] = dgSampleB6;
+
+#define dgSampleB7 "__OTR__sound/samples/instruments/2A"
+static const ALIGN_ASSET(2) char gSampleB7[] = dgSampleB7;
+
+#define dgSampleB8 "__OTR__sound/samples/instruments/2B"
+static const ALIGN_ASSET(2) char gSampleB8[] = dgSampleB8;
+
+#define dgSampleB9 "__OTR__sound/samples/instruments/2C"
+static const ALIGN_ASSET(2) char gSampleB9[] = dgSampleB9;
+
+#define dgSampleBA "__OTR__sound/samples/instruments/2D_trombone"
+static const ALIGN_ASSET(2) char gSampleBA[] = dgSampleBA;
+
+#define dgSampleBB "__OTR__sound/samples/instruments/2E_accordion"
+static const ALIGN_ASSET(2) char gSampleBB[] = dgSampleBB;
+
+#define dgSampleBC "__OTR__sound/samples/instruments/2F_sleigh_bells"
+static const ALIGN_ASSET(2) char gSampleBC[] = dgSampleBC;
+
+#define dgSampleBD "__OTR__sound/samples/instruments/30_rarefaction-lahna"
+static const ALIGN_ASSET(2) char gSampleBD[] = dgSampleBD;
+
+#define dgSampleBE "__OTR__sound/samples/instruments/31_rarefaction-convolution"
+static const ALIGN_ASSET(2) char gSampleBE[] = dgSampleBE;
+
+#define dgSampleBF "__OTR__sound/samples/instruments/32_metal_rimshot"
+static const ALIGN_ASSET(2) char gSampleBF[] = dgSampleBF;
+
+#define dgSampleC0 "__OTR__sound/samples/instruments/33_kick_drum_2"
+static const ALIGN_ASSET(2) char gSampleC0[] = dgSampleC0;
+
+#define dgSampleC1 "__OTR__sound/samples/instruments/34_alto_flute"
+static const ALIGN_ASSET(2) char gSampleC1[] = dgSampleC1;
+
+#define dgSampleC2 "__OTR__sound/samples/instruments/35_gospel_organ"
+static const ALIGN_ASSET(2) char gSampleC2[] = dgSampleC2;
+
+#define dgSampleC3 "__OTR__sound/samples/instruments/36_sawtooth_synth"
+static const ALIGN_ASSET(2) char gSampleC3[] = dgSampleC3;
+
+#define dgSampleC4 "__OTR__sound/samples/instruments/37_square_synth"
+static const ALIGN_ASSET(2) char gSampleC4[] = dgSampleC4;
+
+#define dgSampleC5 "__OTR__sound/samples/instruments/38_electric_kick_drum"
+static const ALIGN_ASSET(2) char gSampleC5[] = dgSampleC5;
+
+#define dgSampleC6 "__OTR__sound/samples/instruments/39_sitar_2"
+static const ALIGN_ASSET(2) char gSampleC6[] = dgSampleC6;
+
+#define dgSampleC7 "__OTR__sound/samples/instruments/3A_music_box"
+static const ALIGN_ASSET(2) char gSampleC7[] = dgSampleC7;
+
+#define dgSampleC8 "__OTR__sound/samples/instruments/3B_banjo_2"
+static const ALIGN_ASSET(2) char gSampleC8[] = dgSampleC8;
+
+#define dgSampleC9 "__OTR__sound/samples/instruments/3C_acoustic_guitar"
+static const ALIGN_ASSET(2) char gSampleC9[] = dgSampleC9;
+
+#define dgSampleCA "__OTR__sound/samples/instruments/3D"
+static const ALIGN_ASSET(2) char gSampleCA[] = dgSampleCA;
+
+#define dgSampleCB "__OTR__sound/samples/instruments/3E_monk_choir"
+static const ALIGN_ASSET(2) char gSampleCB[] = dgSampleCB;
+
+#define dgSampleCC "__OTR__sound/samples/instruments/3F"
+static const ALIGN_ASSET(2) char gSampleCC[] = dgSampleCC;
+
+#define dgSampleCD "__OTR__sound/samples/instruments/40_bell"
+static const ALIGN_ASSET(2) char gSampleCD[] = dgSampleCD;
+
+#define dgSampleCE "__OTR__sound/samples/instruments/41_pan_flute"
+static const ALIGN_ASSET(2) char gSampleCE[] = dgSampleCE;
+
+#define dgSampleCF "__OTR__sound/samples/instruments/42_vibraphone"
+static const ALIGN_ASSET(2) char gSampleCF[] = dgSampleCF;
+
+#define dgSampleD0 "__OTR__sound/samples/instruments/43_harmonica"
+static const ALIGN_ASSET(2) char gSampleD0[] = dgSampleD0;
+
+#define dgSampleD1 "__OTR__sound/samples/instruments/44_grand_piano"
+static const ALIGN_ASSET(2) char gSampleD1[] = dgSampleD1;
+
+#define dgSampleD2 "__OTR__sound/samples/instruments/45_french_horns_lq"
+static const ALIGN_ASSET(2) char gSampleD2[] = dgSampleD2;
+
+#define dgSampleD3 "__OTR__sound/samples/instruments/46_pizzicato_strings_1"
+static const ALIGN_ASSET(2) char gSampleD3[] = dgSampleD3;
+
+#define dgSampleD4 "__OTR__sound/samples/instruments/47_pizzicato_strings_2"
+static const ALIGN_ASSET(2) char gSampleD4[] = dgSampleD4;
+
+#define dgSampleD5 "__OTR__sound/samples/instruments/48_steel_drum"
+static const ALIGN_ASSET(2) char gSampleD5[] = dgSampleD5;
+
+#define dgSampleD6 "__OTR__sound/samples/piranha_music_box/00_music_box"
+static const ALIGN_ASSET(2) char gSampleD6[] = dgSampleD6;
+
+#define dgSampleD7 "__OTR__sound/samples/course_start/00_la"
+static const ALIGN_ASSET(2) char gSampleD7[] = dgSampleD7;
+
+#define dgSampleD8 "__OTR__sound/samples/bowser_organ/00_organ_1"
+static const ALIGN_ASSET(2) char gSampleD8[] = dgSampleD8;
+
+#define dgSampleD9 "__OTR__sound/samples/bowser_organ/01_organ_1_lq"
+static const ALIGN_ASSET(2) char gSampleD9[] = dgSampleD9;
+
+#define dgSampleDA "__OTR__sound/samples/bowser_organ/02_boys_choir"
+static const ALIGN_ASSET(2) char gSampleDA[] = dgSampleDA;
+
+static const char* gSampleTable[] = {
+ gSample00, gSample01, gSample02, gSample03,
+ gSample04, gSample05, gSample06, gSample07,
+ gSample08, gSample09, gSample0A, gSample0B,
+ gSample0C, gSample0D, gSample0E, gSample0F,
+ gSample10, gSample11, gSample12, gSample13,
+ gSample14, gSample15, gSample16, gSample17,
+ gSample18, gSample19, gSample1A, gSample1B,
+ gSample1C, gSample1D, gSample1E, gSample1F,
+ gSample20, gSample21, gSample22, gSample23,
+ gSample24, gSample25, gSample26, gSample27,
+ gSample28, gSample29, gSample2A, gSample2B,
+ gSample2C, gSample2D, gSample2E, gSample2F,
+ gSample30, gSample31, gSample32, gSample33,
+ gSample34, gSample35, gSample36, gSample37,
+ gSample38, gSample39, gSample3A, gSample3B,
+ gSample3C, gSample3D, gSample3E, gSample3F,
+ gSample40, gSample41, gSample42, gSample43,
+ gSample44, gSample45, gSample46, gSample47,
+ gSample48, gSample49, gSample4A, gSample4B,
+ gSample4C, gSample4D, gSample4E, gSample4F,
+ gSample50, gSample51, gSample52, gSample53,
+ gSample54, gSample55, gSample56, gSample57,
+ gSample58, gSample59, gSample5A, gSample5B,
+ gSample5C, gSample5D, gSample5E, gSample5F,
+ gSample60, gSample61, gSample62, gSample63,
+ gSample64, gSample65, gSample66, gSample67,
+ gSample68, gSample69, gSample6A, gSample6B,
+ gSample6C, gSample6D, gSample6E, gSample6F,
+ gSample70, gSample71, gSample72, gSample73,
+ gSample74, gSample75, gSample76, gSample77,
+ gSample78, gSample79, gSample7A, gSample7B,
+ gSample7C, gSample7D, gSample7E, gSample7F,
+ gSample80, gSample81, gSample82, gSample83,
+ gSample84, gSample85, gSample86, gSample87,
+ gSample88, gSample89, gSample8A, gSample8B,
+ gSample8C, gSample8D, gSample8E, gSample8F,
+ gSample90, gSample91, gSample92, gSample93,
+ gSample94, gSample95, gSample96, gSample97,
+ gSample98, gSample99, gSample9A, gSample9B,
+ gSample9C, gSample9D, gSample9E, gSample9F,
+ gSampleA0, gSampleA1, gSampleA2, gSampleA3,
+ gSampleA4, gSampleA5, gSampleA6, gSampleA7,
+ gSampleA8, gSampleA9, gSampleAA, gSampleAB,
+ gSampleAC, gSampleAD, gSampleAE, gSampleAF,
+ gSampleB0, gSampleB1, gSampleB2, gSampleB3,
+ gSampleB4, gSampleB5, gSampleB6, gSampleB7,
+ gSampleB8, gSampleB9, gSampleBA, gSampleBB,
+ gSampleBC, gSampleBD, gSampleBE, gSampleBF,
+ gSampleC0, gSampleC1, gSampleC2, gSampleC3,
+ gSampleC4, gSampleC5, gSampleC6, gSampleC7,
+ gSampleC8, gSampleC9, gSampleCA, gSampleCB,
+ gSampleCC, gSampleCD, gSampleCE, gSampleCF,
+ gSampleD0, gSampleD1, gSampleD2, gSampleD3,
+ gSampleD4, gSampleD5, gSampleD6, gSampleD7,
+ gSampleD8, gSampleD9, gSampleDA,
+};
diff --git a/src/Companion.cpp b/src/Companion.cpp
index 1d2f371..05a100c 100644
--- a/src/Companion.cpp
+++ b/src/Companion.cpp
@@ -21,6 +21,8 @@ static const std::unordered_map<std::string, RawFactory*> gFactories = {
{ ".png", new TextureFactory() },
{ ".anim", new AnimFactory() },
{ ".aiff", new AudioFactory() },
+ { ".bnk", new AudioFactory() },
+ { ".bset", new AudioFactory() },
{ ".bin", new BlobFactory(LUS::ResourceType::Blob) },
{ ".m64", new BlobFactory(LUS::ResourceType::Blob) },
{ ".sbox", new BlobFactory(LUS::ResourceType::Blob, true) },
diff --git a/src/audio/AudioManager.cpp b/src/audio/AudioManager.cpp
index 4549658..d72bda6 100644
--- a/src/audio/AudioManager.cpp
+++ b/src/audio/AudioManager.cpp
@@ -28,14 +28,14 @@ std::string gen_name(const std::string& prefix){
return prefix + std::to_string(name_table[prefix]++);
}
-AifcEntry* SampleBank::AddSample(uint32_t addr, size_t sampleSize, const Book& book, const Loop& loop){
+AudioBankSample* SampleBank::AddSample(uint32_t addr, size_t sampleSize, const AdpcmBook& book, const AdpcmLoop& loop){
assert(sampleSize % 2 == 0);
if(sampleSize % 9 != 0){
assert(sampleSize % 9 == 1);
sampleSize -= 1;
}
- AifcEntry* entry;
+ AudioBankSample* entry;
if(this->entries.contains(addr)){
entry = this->entries[addr];
@@ -43,7 +43,7 @@ AifcEntry* SampleBank::AddSample(uint32_t addr, size_t sampleSize, const Book& b
assert(entry->loop == loop);
assert(entry->data.size() == sampleSize);
} else {
- entry = new AifcEntry{ gen_name("aifc"), PyUtils::slice(this->data, addr, addr + sampleSize), book, loop };
+ entry = new AudioBankSample{ gen_name("aifc"), PyUtils::slice(this->data, addr, addr + sampleSize), book, loop };
this->entries[addr] = entry;
}
@@ -68,8 +68,8 @@ std::vector<Entry> AudioManager::parse_seq_file(std::vector<uint8_t>& buffer, ui
reader.SetEndianness(LUS::Endianness::Big);
reader.Seek(offset, LUS::SeekOffsetType::Start);
- unsigned short magic = reader.ReadUInt16();
- unsigned short num_entries = reader.ReadUInt16();
+ uint16_t magic = reader.ReadUInt16();
+ uint16_t num_entries = reader.ReadUInt16();
uint32_t prev = ALIGN(4 + num_entries * 8, 16);
assert(magic == (isCTL ? 1 : 2));
@@ -103,149 +103,6 @@ CTLHeader AudioManager::parse_ctl_header(std::vector<uint8_t>& data){
return header;
}
-std::optional<Sound> AudioManager::parse_sound(std::vector<uint8_t> data) {
- LUS::BinaryReader reader((char*) data.data(), data.size());
- reader.SetEndianness(LUS::Endianness::Big);
-
- uint32_t addr = reader.ReadUInt32();
- float tuning = reader.ReadFloat();
-
- if(addr == 0){
- assert(tuning == 0.0f);
- return std::nullopt;
- }
-
- Sound sound = { addr, tuning };
-
- reader.Close();
- return sound;
-}
-
-Drum AudioManager::parse_drum(std::vector<uint8_t>& data, uint32_t addr) {
- LUS::BinaryReader reader((char*) data.data(), data.size());
- reader.SetEndianness(LUS::Endianness::Big);
- std::string name = gen_name("drum");
-
- uint8_t releaseRate = reader.ReadInt8();
- uint8_t pan = reader.ReadInt8();
-
- reader.Seek(12, LUS::SeekOffsetType::Start);
- Sound sound = parse_sound(PyUtils::slice(data, 4, 12)).value();
- uint32_t envOffset = reader.ReadInt32();
- assert(envOffset != 0);
-
- Drum drum = { name, addr, releaseRate, pan, envOffset, sound };
-
- return drum;
-}
-
-Inst AudioManager::parse_inst(std::vector<uint8_t>& data, uint32_t addr) {
- std::string name = gen_name("inst");
- uint8_t normalRangeLo = data[1];
- uint8_t normalRangeHi = data[2];
- uint8_t releaseRate = data[3];
-
- uint32_t envAddr;
- memcpy(&envAddr, (char*) data.data() + 4, 4);
- envAddr = BSWAP32(envAddr);
-
- assert(envAddr != 0);
-
- auto soundLo = parse_sound(PyUtils::slice(data, 8, 16));
- auto soundMed = parse_sound(PyUtils::slice(data, 16, 24));
- auto soundHi = parse_sound(PyUtils::slice(data, 24));
-
- if (soundLo == std::nullopt) {
- assert(normalRangeLo == 0);
- }
- if (soundHi == std::nullopt) {
- assert(normalRangeHi == 127);
- }
-
- Inst inst = { name, addr, releaseRate, normalRangeLo, normalRangeHi, envAddr, soundLo, soundMed, soundHi };
- return inst;
-}
-
-Loop AudioManager::parse_loop(uint32_t addr, std::vector<uint8_t>& bankData){
- LUS::BinaryReader reader((char*) bankData.data(), bankData.size());
- reader.SetEndianness(LUS::Endianness::Big);
- reader.Seek(addr, LUS::SeekOffsetType::Start);
-
- std::optional<std::vector<short>> state = std::nullopt;
- uint32_t start = reader.ReadUInt32();
- uint32_t end = reader.ReadUInt32();
- int32_t count = reader.ReadInt32();
- uint32_t pad = reader.ReadUInt32();
- if(count != 0){
- state = std::vector<short>();
- for (size_t i = 0; i < 16; ++i) {
- state.value().push_back(reader.ReadShort());
- }
- }
- Loop loop = { start, end, count, pad, state };
- return loop;
-}
-
-Book AudioManager::parse_book(uint32_t addr, std::vector<uint8_t>& bankData){
- LUS::BinaryReader reader((char*) bankData.data(), bankData.size());
- reader.SetEndianness(LUS::Endianness::Big);
- reader.Seek(addr, LUS::SeekOffsetType::Start);
-
- uint32_t order = reader.ReadInt32();
- uint32_t npredictors = reader.ReadInt32();
- std::vector<short> table;
- std::vector<uint8_t> tableData = PyUtils::slice(bankData, addr + 8, addr + 8 + 16 * order * npredictors);
- for (size_t i = 0; i < ( 16 * order * npredictors ); i += 2) {
- short dtable;
- memcpy(&dtable, tableData.data() + i, 2);
- table.push_back(BSWAP16(dtable));
- }
-
- Book book = { order, npredictors, table };
- return book;
-}
-
-AifcEntry* AudioManager::parse_sample(std::vector<uint8_t>& data, std::vector<uint8_t>& bankData, SampleBank* sampleBank){
- LUS::BinaryReader reader((char*) data.data(), data.size());
- reader.SetEndianness(LUS::Endianness::Big);
-
- uint32_t zero = reader.ReadUInt32();
- uint32_t addr = reader.ReadUInt32();
- uint32_t loop = reader.ReadUInt32();
- uint32_t book = reader.ReadUInt32();
- uint32_t sampleSize = reader.ReadUInt32();
- assert(zero == 0);
- assert(loop != 0);
- assert(book != 0);
-
- Loop loopData = parse_loop(loop, bankData);
- Book bookData = parse_book(book, bankData);
-
- reader.Close();
- return sampleBank->AddSample(addr, sampleSize, bookData, loopData);
-}
-
-
-std::vector<EnvelopeData> AudioManager::parse_envelope(uint32_t addr, std::vector<uint8_t>& dataBank){
- std::vector<EnvelopeData> entries;
- LUS::BinaryReader reader((char*) dataBank.data(), dataBank.size());
- reader.SetEndianness(LUS::Endianness::Big);
-
- while(true){
- reader.Seek(addr, LUS::SeekOffsetType::Start);
- unsigned short delay = reader.ReadUShort();
- unsigned short arg = reader.ReadUShort();
- entries.emplace_back(delay, arg);
- addr += 4;
- if (1 <= (-delay) % ((uint32_t) pow(2, 16)) <= 3.0){
- break;
- }
- }
-
- reader.Close();
- return entries;
-}
-
Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, SampleBank* bank, uint32_t index) {
name_table.clear();
std::ostringstream ss;
@@ -262,11 +119,16 @@ Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, Sample
std::vector<uint32_t> drumOffsets;
if(numDrums != 0){
+ assert(drumBaseAddr != 0);
for (size_t i = 0; i < numDrums; ++i) {
uint32_t drumOffset;
- memcpy(&drumOffset, rawData + drumBaseAddr + (i * 4), 4);
- drumOffsets.push_back(BSWAP32(drumOffset));
+ memcpy(&drumOffset, rawData + drumBaseAddr + i * 4, 4);
+ drumOffset = BSWAP32(drumOffset);
+ assert(drumOffset != 0);
+ drumOffsets.push_back(drumOffset);
}
+ } else {
+ assert(drumBaseAddr == 0);
}
uint32_t instrumentBaseAddr = 4;
@@ -275,22 +137,28 @@ Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, Sample
for (size_t i = 0; i < numInstruments; ++i) {
uint32_t instOffset;
- memcpy(&instOffset, rawData + (instrumentBaseAddr + (i * 4)), 4);
+ memcpy(&instOffset, rawData + (instrumentBaseAddr + i * 4), 4);
instOffset = BSWAP32(instOffset);
if(instOffset == 0){
instrumentList.push_back(NONE);
+ instrumentOffsets.push_back(NONE);
} else {
instrumentOffsets.push_back(instOffset);
instrumentList.push_back(instOffset);
}
}
- std::sort(instrumentOffsets.begin(), instrumentOffsets.end());
+// std::sort(instrumentOffsets.begin(), instrumentOffsets.end());
- std::vector<Inst> insts;
+ std::vector<Instrument> insts;
for(auto &offset : instrumentOffsets){
+ if(offset == NONE){
+ Instrument invalid = { .valid = false };
+ insts.push_back(invalid);
+ continue;
+ }
auto rInst = PyUtils::slice(data, offset, offset + 32);
- Inst inst = parse_inst(rInst, offset);
+ Instrument inst = parse_inst(rInst, offset);
insts.push_back(inst);
}
@@ -322,12 +190,12 @@ Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, Sample
// Put drums somewhere in the middle of the instruments to make sample
// addresses come in increasing order. (This logic isn't totally right,
// but it works for our purposes.)
- std::vector<std::variant<Inst, std::vector<Drum>>> allInsts;
+ std::vector<std::variant<Instrument, std::vector<Drum>>> allInsts;
bool needDrums = !drums.empty();
for(auto &inst : insts){
- std::vector<std::optional<Sound>> sounds = {inst.soundLo, inst.soundMed, inst.soundHi};
+ std::vector<std::optional<AudioBankSound>> sounds = {inst.soundLo, inst.soundMed, inst.soundHi};
- if(needDrums && std::any_of(sounds.cbegin(), sounds.cend(), [&drums](std::optional<Sound> sound){ return sound.has_value() && sound.value().offset > drums[0].sound.offset; })){
+ if(needDrums && std::any_of(sounds.cbegin(), sounds.cend(), [&drums](std::optional<AudioBankSound> sound){ return sound.has_value() && sound.value().offset > drums[0].sound.offset; })){
allInsts.emplace_back(drums);
needDrums = false;
}
@@ -340,18 +208,18 @@ Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, Sample
allInsts.emplace_back(drums);
}
- std::unordered_map<uint32_t, AifcEntry*> samples;
+ std::map<uint32_t, AudioBankSample*> samples;
std::sort(sampleOffsets.begin(), sampleOffsets.end());
for(auto &offset : sampleOffsets){
auto rSample = PyUtils::slice(data, offset, offset + 20);
- AifcEntry* sample = parse_sample(rSample, data, bank);
+ AudioBankSample* sample = parse_sample(rSample, data, bank);
for(auto &tuning : tunings){
sample->tunings.push_back(tuning.second);
}
samples[offset] = sample;
}
- std::unordered_map<uint32_t, std::vector<EnvelopeData>> envData;
+ std::unordered_map<uint32_t, std::vector<AdsrEnvelope>> envData;
std::vector<uint32_t> usedEnvOffsets;
std::sort(envOffsets.begin(), envOffsets.end());
for(auto &offset : envOffsets){
@@ -383,7 +251,7 @@ Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, Sample
}
}
- std::unordered_map<uint32_t, Envelope> envelopes;
+ std::map<uint32_t, Envelope> envelopes;
for(auto &entry : envData){
Envelope env = { gen_name("envelope"), entry.second };
envelopes[entry.first] = env;
@@ -393,6 +261,156 @@ Bank AudioManager::parse_ctl(CTLHeader header, std::vector<uint8_t> data, Sample
return bankData;
}
+std::optional<AudioBankSound> AudioManager::parse_sound(std::vector<uint8_t> data) {
+ LUS::BinaryReader reader((char*) data.data(), data.size());
+ reader.SetEndianness(LUS::Endianness::Big);
+
+ uint32_t addr = reader.ReadUInt32();
+ float tuning = reader.ReadFloat();
+
+ if(addr == 0){
+ assert(tuning == 0.0f);
+ return std::nullopt;
+ }
+
+ AudioBankSound sound = { addr, tuning };
+
+ reader.Close();
+ return sound;
+}
+
+Drum AudioManager::parse_drum(std::vector<uint8_t>& data, uint32_t addr) {
+ LUS::BinaryReader reader((char*) data.data(), data.size());
+ reader.SetEndianness(LUS::Endianness::Big);
+ std::string name = gen_name("drum");
+
+ uint8_t releaseRate = reader.ReadInt8();
+ uint8_t pan = reader.ReadInt8();
+
+ reader.Seek(12, LUS::SeekOffsetType::Start);
+ AudioBankSound sound = parse_sound(PyUtils::slice(data, 4, 12)).value();
+ uint32_t envOffset = reader.ReadInt32();
+ assert(envOffset != 0);
+
+ Drum drum = { name, addr, releaseRate, pan, envOffset, sound };
+
+ return drum;
+}
+
+Instrument AudioManager::parse_inst(std::vector<uint8_t>& data, uint32_t addr) {
+ std::string name = gen_name("inst");
+ uint8_t normalRangeLo = data[1];
+ uint8_t normalRangeHi = data[2];
+ uint8_t releaseRate = data[3];
+
+ uint32_t envAddr;
+ memcpy(&envAddr, (char*) data.data() + 4, 4);
+ envAddr = BSWAP32(envAddr);
+
+ assert(envAddr != 0);
+
+ auto soundLo = parse_sound(PyUtils::slice(data, 8, 16));
+ auto soundMed = parse_sound(PyUtils::slice(data, 16, 24));
+ auto soundHi = parse_sound(PyUtils::slice(data, 24));
+
+ if (soundLo == std::nullopt) {
+ assert(normalRangeLo == 0);
+ }
+ if (soundHi == std::nullopt) {
+ assert(normalRangeHi == 127);
+ }
+
+ Instrument inst = { true, name, addr, releaseRate, normalRangeLo, normalRangeHi, envAddr, soundLo, soundMed, soundHi };
+ return inst;
+}
+
+AdpcmLoop AudioManager::parse_loop(uint32_t addr, std::vector<uint8_t>& bankData){
+ LUS::BinaryReader reader((char*) bankData.data(), bankData.size());
+ reader.SetEndianness(LUS::Endianness::Big);
+ reader.Seek(addr, LUS::SeekOffsetType::Start);
+
+ std::optional<std::vector<int16_t>> state = std::nullopt;
+ uint32_t start = reader.ReadUInt32();
+ uint32_t end = reader.ReadUInt32();
+ int32_t count = reader.ReadInt32();
+ uint32_t pad = reader.ReadUInt32();
+
+ std::cout << "Loop End: " << end << '\n';
+ if(count != 0){
+ state = std::vector<int16_t>();
+ for (size_t i = 0; i < 16; ++i) {
+ state.value().push_back(reader.ReadInt16());
+ }
+ }
+ AdpcmLoop loop = { start, end, count, pad, state };
+ return loop;
+}
+
+AdpcmBook AudioManager::parse_book(uint32_t addr, std::vector<uint8_t>& bankData){
+ LUS::BinaryReader reader((char*) bankData.data(), bankData.size());
+ reader.SetEndianness(LUS::Endianness::Big);
+ reader.Seek(addr, LUS::SeekOffsetType::Start);
+
+ int32_t order = reader.ReadInt32();
+ int32_t npredictors = reader.ReadInt32();
+
+ assert(order == 2);
+ assert(npredictors == 2);
+
+ std::vector<int16_t> table;
+ std::vector<uint8_t> tableData = PyUtils::slice(bankData, addr + 8, addr + 8 + 16 * order * npredictors);
+ for (size_t i = 0; i < ( 16 * order * npredictors ); i += 2) {
+ int16_t dtable;
+ memcpy(&dtable, tableData.data() + i, 2);
+ table.push_back(BSWAP16(dtable));
+ }
+
+ AdpcmBook book = { order, npredictors, table };
+ return book;
+}
+
+AudioBankSample* AudioManager::parse_sample(std::vector<uint8_t>& data, std::vector<uint8_t>& bankData, SampleBank* sampleBank){
+ LUS::BinaryReader reader((char*) data.data(), data.size());
+ reader.SetEndianness(LUS::Endianness::Big);
+
+ uint32_t zero = reader.ReadUInt32();
+ uint32_t addr = reader.ReadUInt32();
+ uint32_t loop = reader.ReadUInt32();
+ uint32_t book = reader.ReadUInt32();
+ uint32_t sampleSize = reader.ReadUInt32();
+ assert(zero == 0);
+ assert(loop != 0);
+ assert(book != 0);
+
+ AdpcmLoop loopData = parse_loop(loop, bankData);
+ AdpcmBook bookData = parse_book(book, bankData);
+
+ reader.Close();
+ return sampleBank->AddSample(addr, sampleSize, bookData, loopData);
+}
+
+
+std::vector<AdsrEnvelope> AudioManager::parse_envelope(uint32_t addr, std::vector<uint8_t>& dataBank){
+ std::vector<AdsrEnvelope> entries;
+ LUS::BinaryReader reader((char*) dataBank.data(), dataBank.size());
+ reader.SetEndianness(LUS::Endianness::Big);
+
+ while(true){
+ reader.Seek(addr, LUS::SeekOffsetType::Start);
+ int16_t delay = reader.ReadInt16();
+ int16_t arg = reader.ReadInt16();
+ AdsrEnvelope entry = { delay, arg };
+ entries.push_back(entry);
+ addr += 4;
+ if (1 <= (-delay) % (1 << 16) && (-delay) % (1 << 16) <= 3){
+ break;
+ }
+ }
+
+ reader.Close();
+ return entries;
+}
+
TBLFile AudioManager::parse_tbl(std::vector<uint8_t>& data, std::vector<Entry>& entries) {
TBLFile tbl;
std::unordered_map<uint32_t, std::string> cache;
@@ -441,14 +459,22 @@ void AudioManager::initialize(std::vector<uint8_t>& buffer) {
auto headerRaw = PyUtils::slice(entry, 0, 16);
auto header = parse_ctl_header(headerRaw);
auto bank = parse_ctl(header, PyUtils::slice(entry, 16), sample_bank, index);
- banks.push_back(bank);
+ banks[index] = bank;
}
+ int32_t idx = -1;
+ for(auto &sample_bank : this->loaded_tbl.banks){
+ auto offsets = PyUtils::keys(sample_bank->entries);
+ std::sort(offsets.begin(), offsets.end());
+ for(auto &offset : offsets){
+ this->sampleMap[sample_bank->entries[offset]] = ++idx;
+ }
+ }
}
void serialize_f80(double num, LUS::BinaryWriter &writer) {
- // Convert the input double to a uint64_t
+ // Convert the input double to an uint64_t
std::uint64_t f64;
std::memcpy(&f64, &num, sizeof(double));
@@ -505,7 +531,7 @@ void serialize_f80(double num, LUS::BinaryWriter &writer) {
} \
} \
-void AudioManager::write_aifc(AifcEntry* entry, LUS::BinaryWriter &out) {
+void AudioManager::write_aifc(AudioBankSample* entry, LUS::BinaryWriter &out) {
int16_t num_channels = 1;
auto data = entry->data;
size_t len = 0;
@@ -549,7 +575,7 @@ void AudioManager::write_aifc(AifcEntry* entry, LUS::BinaryWriter &out) {
tmp.Write((uint16_t) sample_size);
serialize_f80(sample_rate, tmp);
tmp.Write(AIFC::MagicValues::VAPC);
- tmp.Write("\u000BVADPCM ~4-1", false);
+ tmp.Write("\x0bVADPCM ~4-1", false);
END_SECTION();
@@ -557,7 +583,7 @@ void AudioManager::write_aifc(AifcEntry* entry, LUS::BinaryWriter &out) {
tmp.Write(std::string(20, '\0'), false);
END_SECTION();
- START_CUSTOM_SECTION("\u000BVADPCMCODES")
+ START_CUSTOM_SECTION("\x0bVADPCMCODES")
tmp.Write((uint16_t) 1);
tmp.Write((uint16_t) entry->book.order);
tmp.Write((uint16_t) entry->book.npredictors);
@@ -575,7 +601,7 @@ void AudioManager::write_aifc(AifcEntry* entry, LUS::BinaryWriter &out) {
END_SECTION();
if(entry->loop.count != 0){
- START_CUSTOM_SECTION("\u000BVADPCMLOOPS")
+ START_CUSTOM_SECTION("\x0bVADPCMLOOPS")
uint16_t one = BSWAP16(1);
tmp.Write((char*) &one, 2);
tmp.Write((char*) &one, 2);
@@ -609,3 +635,30 @@ void AudioManager::create_aifc(int32_t index, LUS::BinaryWriter &out) {
}
}
}
+
+AudioBankSample AudioManager::get_aifc(int32_t index) {
+ int32_t idx = -1;
+ for(auto &sample_bank : this->loaded_tbl.banks){
+ auto offsets = PyUtils::keys(sample_bank->entries);
+ std::sort(offsets.begin(), offsets.end());
+
+ for(auto &offset : offsets){
+ if(++idx == index){
+ return *sample_bank->entries[offset];
+ }
+ }
+ }
+
+ throw std::runtime_error("Invalid index");
+}
+
+uint32_t AudioManager::get_index(AudioBankSample* entry) {
+ if(!this->sampleMap.contains(entry)){
+ return -1;
+ }
+ return this->sampleMap[entry];
+}
+
+std::map<uint32_t, Bank> AudioManager::get_banks() {
+ return this->banks;
+}
diff --git a/src/audio/AudioManager.h b/src/audio/AudioManager.h
index 4c3265c..4b5d9ce 100644
--- a/src/audio/AudioManager.h
+++ b/src/audio/AudioManager.h
@@ -1,9 +1,9 @@
#pragma once
+#include <map>
#include <vector>
#include <string>
#include <iostream>
-#include <unordered_map>
#include "binarytools/BinaryWriter.h"
#define NONE 0xFFFF
@@ -27,31 +27,32 @@ struct Entry {
uint32_t length;
};
-struct Sound {
+struct AudioBankSound {
uint32_t offset;
float tuning;
- bool operator==(const Sound& other) const {
+ bool operator==(const AudioBankSound& other) const {
return offset == other.offset && tuning == other.tuning;
}
};
-struct Inst {
+struct Instrument {
+ bool valid;
std::string name;
uint32_t offset;
uint8_t releaseRate;
uint8_t normalRangeLo;
uint8_t normalRangeHi;
uint32_t envelope;
- std::optional<Sound> soundLo;
- std::optional<Sound> soundMed;
- std::optional<Sound> soundHi;
+ std::optional<AudioBankSound> soundLo;
+ std::optional<AudioBankSound> soundMed;
+ std::optional<AudioBankSound> soundHi;
};
-struct Book {
- uint32_t order{};
- uint32_t npredictors{};
- std::vector<short> table;
- bool operator==(const Book& other) const {
+struct AdpcmBook {
+ int32_t order{};
+ int32_t npredictors{};
+ std::vector<int16_t> table;
+ bool operator==(const AdpcmBook& other) const {
return order == other.order && npredictors == other.npredictors && table == other.table;
}
};
@@ -62,28 +63,28 @@ struct Drum {
uint8_t releaseRate;
uint8_t pan;
uint32_t envelope;
- Sound sound;
+ AudioBankSound sound;
bool operator==(const Drum& other) const {
return name == other.name && offset == other.offset && releaseRate == other.releaseRate && pan == other.pan && envelope == other.envelope && sound == other.sound;
}
};
-struct Loop {
+struct AdpcmLoop {
uint32_t start{};
uint32_t end{};
int32_t count{};
uint32_t pad{};
- std::optional<std::vector<short>> state;
- bool operator==(const Loop& other) const {
+ std::optional<std::vector<int16_t>> state;
+ bool operator==(const AdpcmLoop& other) const {
return start == other.start && end == other.end && count == other.count && pad == other.pad && state == other.state;
}
};
-struct AifcEntry {
+struct AudioBankSample {
std::string name;
std::vector<uint8_t> data;
- Book book;
- Loop loop;
+ AdpcmBook book;
+ AdpcmLoop loop;
std::vector<float> tunings;
};
@@ -91,15 +92,15 @@ struct SampleBank {
std::string name;
uint32_t offset;
std::vector<uint8_t> data;
- std::unordered_map<uint32_t, AifcEntry*> entries;
+ std::map<uint32_t, AudioBankSample*> entries;
- AifcEntry* AddSample(uint32_t addr, size_t sampleSize, const Book& book, const Loop& loop);
+ AudioBankSample* AddSample(uint32_t addr, size_t sampleSize, const AdpcmBook& book, const AdpcmLoop& loop);
};
struct TBLFile {
std::vector<SampleBank*> banks;
std::vector<std::string> tbls;
- std::unordered_map<std::string, SampleBank*> map;
+ std::map<std::string, SampleBank*> map;
};
struct CTLHeader {
@@ -108,22 +109,25 @@ struct CTLHeader {
uint32_t shared;
};
-typedef std::pair<unsigned short, unsigned short> EnvelopeData;
+struct AdsrEnvelope {
+ int16_t delay;
+ int16_t arg;
+};
struct Envelope {
std::string name;
- std::vector<EnvelopeData> entries;
+ std::vector<AdsrEnvelope> entries;
};
struct Bank {
std::string name;
SampleBank* sampleBank;
- std::vector<Inst> insts;
+ std::vector<Instrument> insts;
std::vector<Drum> drums;
- std::vector<std::variant<Inst, std::vector<Drum>>> allInsts;
+ std::vector<std::variant<Instrument, std::vector<Drum>>> allInsts;
std::vector<uint32_t> instOffsets;
- std::unordered_map<uint32_t, Envelope> envelopes;
- std::unordered_map<uint32_t, AifcEntry*> samples;
+ std::map<uint32_t, Envelope> envelopes;
+ std::map<uint32_t, AudioBankSample*> samples;
void print() const;
};
@@ -132,22 +136,26 @@ public:
static AudioManager* Instance;
void initialize(std::vector<uint8_t>& buffer);
void create_aifc(int32_t index, LUS::BinaryWriter& writer);
+ AudioBankSample get_aifc(int32_t index);
+ std::map<uint32_t, Bank> get_banks();
+ uint32_t get_index(AudioBankSample* bank);
private:
- std::vector<Bank> banks;
+ std::map<uint32_t, Bank> banks;
+ std::map<AudioBankSample*, uint32_t> sampleMap;
TBLFile loaded_tbl;
static std::vector<Entry> parse_seq_file(std::vector<uint8_t>& buffer, uint32_t offset, bool isCTL);
static CTLHeader parse_ctl_header(std::vector<uint8_t>& data);
- static std::optional<Sound> parse_sound(std::vector<uint8_t> data);
+ static std::optional<AudioBankSound> parse_sound(std::vector<uint8_t> data);
static Drum parse_drum(std::vector<uint8_t>& data, uint32_t addr);
- static Inst parse_inst(std::vector<uint8_t>& data, uint32_t addr);
- static Loop parse_loop(uint32_t addr, std::vector<uint8_t>& bankData);
- static Book parse_book(uint32_t addr, std::vector<uint8_t>& bankData);
- static AifcEntry* parse_sample(std::vector<uint8_t>& data, std::vector<uint8_t>& bankData, SampleBank* sampleBank);
- static std::vector<EnvelopeData> parse_envelope(uint32_t addr, std::vector<uint8_t>& dataBank);
+ static Instrument parse_inst(std::vector<uint8_t>& data, uint32_t addr);
+ static AdpcmLoop parse_loop(uint32_t addr, std::vector<uint8_t>& bankData);
+ static AdpcmBook parse_book(uint32_t addr, std::vector<uint8_t>& bankData);
+ static AudioBankSample* parse_sample(std::vector<uint8_t>& data, std::vector<uint8_t>& bankData, SampleBank* sampleBank);
+ static std::vector<AdsrEnvelope> parse_envelope(uint32_t addr, std::vector<uint8_t>& dataBank);
static Bank parse_ctl(CTLHeader header, std::vector<uint8_t> data, SampleBank* bank, uint32_t index);
static TBLFile parse_tbl(std::vector<uint8_t>& data, std::vector<Entry>& entries);
- static void write_aifc(AifcEntry* entry, LUS::BinaryWriter& writer);
+ static void write_aifc(AudioBankSample* entry, LUS::BinaryWriter& writer);
}; \ No newline at end of file
diff --git a/src/audio/samples_table.h b/src/audio/samples_table.h
new file mode 100644
index 0000000..2946d05
--- /dev/null
+++ b/src/audio/samples_table.h
@@ -0,0 +1,722 @@
+#pragma once
+
+#if defined(_WIN32)
+#define ALIGN_ASSET(x) __declspec(align(x))
+#else
+#define ALIGN_ASSET(x) __attribute__((aligned (x)))
+#endif
+
+#define dgSample00 "__OTR__sound/samples/sfx_1/00_twirl"
+static const ALIGN_ASSET(2) char gSample00[] = dgSample00;
+
+#define dgSample01 "__OTR__sound/samples/sfx_1/01_brushing"
+static const ALIGN_ASSET(2) char gSample01[] = dgSample01;
+
+#define dgSample02 "__OTR__sound/samples/sfx_1/02_hand_touch"
+static const ALIGN_ASSET(2) char gSample02[] = dgSample02;
+
+#define dgSample03 "__OTR__sound/samples/sfx_1/03_yoshi"
+static const ALIGN_ASSET(2) char gSample03[] = dgSample03;
+
+#define dgSample04 "__OTR__sound/samples/sfx_1/04_plop"
+static const ALIGN_ASSET(2) char gSample04[] = dgSample04;
+
+#define dgSample05 "__OTR__sound/samples/sfx_1/05_heavy_landing"
+static const ALIGN_ASSET(2) char gSample05[] = dgSample05;
+
+#define dgSample06 "__OTR__sound/samples/sfx_terrain/00_step_default"
+static const ALIGN_ASSET(2) char gSample06[] = dgSample06;
+
+#define dgSample07 "__OTR__sound/samples/sfx_terrain/01_step_grass"
+static const ALIGN_ASSET(2) char gSample07[] = dgSample07;
+
+#define dgSample08 "__OTR__sound/samples/sfx_terrain/02_step_stone"
+static const ALIGN_ASSET(2) char gSample08[] = dgSample08;
+
+#define dgSample09 "__OTR__sound/samples/sfx_terrain/03_step_spooky"
+static const ALIGN_ASSET(2) char gSample09[] = dgSample09;
+
+#define dgSample0A "__OTR__sound/samples/sfx_terrain/04_step_snow"
+static const ALIGN_ASSET(2) char gSample0A[] = dgSample0A;
+
+#define dgSample0B "__OTR__sound/samples/sfx_terrain/05_step_ice"
+static const ALIGN_ASSET(2) char gSample0B[] = dgSample0B;
+
+#define dgSample0C "__OTR__sound/samples/sfx_terrain/06_step_metal"
+static const ALIGN_ASSET(2) char gSample0C[] = dgSample0C;
+
+#define dgSample0D "__OTR__sound/samples/sfx_terrain/07_step_sand"
+static const ALIGN_ASSET(2) char gSample0D[] = dgSample0D;
+
+#define dgSample0E "__OTR__sound/samples/sfx_water/00_plunge"
+static const ALIGN_ASSET(2) char gSample0E[] = dgSample0E;
+
+#define dgSample0F "__OTR__sound/samples/sfx_water/01_splash"
+static const ALIGN_ASSET(2) char gSample0F[] = dgSample0F;
+
+#define dgSample10 "__OTR__sound/samples/sfx_water/02_swim"
+static const ALIGN_ASSET(2) char gSample10[] = dgSample10;
+
+#define dgSample11 "__OTR__sound/samples/sfx_4/00"
+static const ALIGN_ASSET(2) char gSample11[] = dgSample11;
+
+#define dgSample12 "__OTR__sound/samples/sfx_4/01"
+static const ALIGN_ASSET(2) char gSample12[] = dgSample12;
+
+#define dgSample13 "__OTR__sound/samples/sfx_4/02"
+static const ALIGN_ASSET(2) char gSample13[] = dgSample13;
+
+#define dgSample14 "__OTR__sound/samples/sfx_4/03"
+static const ALIGN_ASSET(2) char gSample14[] = dgSample14;
+
+#define dgSample15 "__OTR__sound/samples/sfx_4/04"
+static const ALIGN_ASSET(2) char gSample15[] = dgSample15;
+
+#define dgSample16 "__OTR__sound/samples/sfx_4/05"
+static const ALIGN_ASSET(2) char gSample16[] = dgSample16;
+
+#define dgSample17 "__OTR__sound/samples/sfx_4/06"
+static const ALIGN_ASSET(2) char gSample17[] = dgSample17;
+
+#define dgSample18 "__OTR__sound/samples/sfx_4/07"
+static const ALIGN_ASSET(2) char gSample18[] = dgSample18;
+
+#define dgSample19 "__OTR__sound/samples/sfx_4/08"
+static const ALIGN_ASSET(2) char gSample19[] = dgSample19;
+
+#define dgSample1A "__OTR__sound/samples/sfx_4/09"
+static const ALIGN_ASSET(2) char gSample1A[] = dgSample1A;
+
+#define dgSample1B "__OTR__sound/samples/sfx_5/00"
+static const ALIGN_ASSET(2) char gSample1B[] = dgSample1B;
+
+#define dgSample1C "__OTR__sound/samples/sfx_5/01"
+static const ALIGN_ASSET(2) char gSample1C[] = dgSample1C;
+
+#define dgSample1D "__OTR__sound/samples/sfx_5/02"
+static const ALIGN_ASSET(2) char gSample1D[] = dgSample1D;
+
+#define dgSample1E "__OTR__sound/samples/sfx_5/03"
+static const ALIGN_ASSET(2) char gSample1E[] = dgSample1E;
+
+#define dgSample1F "__OTR__sound/samples/sfx_5/04"
+static const ALIGN_ASSET(2) char gSample1F[] = dgSample1F;
+
+#define dgSample20 "__OTR__sound/samples/sfx_5/05"
+static const ALIGN_ASSET(2) char gSample20[] = dgSample20;
+
+#define dgSample21 "__OTR__sound/samples/sfx_5/06"
+static const ALIGN_ASSET(2) char gSample21[] = dgSample21;
+
+#define dgSample22 "__OTR__sound/samples/sfx_5/07"
+static const ALIGN_ASSET(2) char gSample22[] = dgSample22;
+
+#define dgSample23 "__OTR__sound/samples/sfx_5/08"
+static const ALIGN_ASSET(2) char gSample23[] = dgSample23;
+
+#define dgSample24 "__OTR__sound/samples/sfx_5/09"
+static const ALIGN_ASSET(2) char gSample24[] = dgSample24;
+
+#define dgSample25 "__OTR__sound/samples/sfx_5/0A"
+static const ALIGN_ASSET(2) char gSample25[] = dgSample25;
+
+#define dgSample26 "__OTR__sound/samples/sfx_5/0B"
+static const ALIGN_ASSET(2) char gSample26[] = dgSample26;
+
+#define dgSample27 "__OTR__sound/samples/sfx_5/0C"
+static const ALIGN_ASSET(2) char gSample27[] = dgSample27;
+
+#define dgSample28 "__OTR__sound/samples/sfx_5/0D"
+static const ALIGN_ASSET(2) char gSample28[] = dgSample28;
+
+#define dgSample29 "__OTR__sound/samples/sfx_5/0E"
+static const ALIGN_ASSET(2) char gSample29[] = dgSample29;
+
+#define dgSample2A "__OTR__sound/samples/sfx_5/0F"
+static const ALIGN_ASSET(2) char gSample2A[] = dgSample2A;
+
+#define dgSample2B "__OTR__sound/samples/sfx_5/10"
+static const ALIGN_ASSET(2) char gSample2B[] = dgSample2B;
+
+#define dgSample2C "__OTR__sound/samples/sfx_5/11"
+static const ALIGN_ASSET(2) char gSample2C[] = dgSample2C;
+
+#define dgSample2D "__OTR__sound/samples/sfx_5/12"
+static const ALIGN_ASSET(2) char gSample2D[] = dgSample2D;
+
+#define dgSample2E "__OTR__sound/samples/sfx_5/13"
+static const ALIGN_ASSET(2) char gSample2E[] = dgSample2E;
+
+#define dgSample2F "__OTR__sound/samples/sfx_5/14"
+static const ALIGN_ASSET(2) char gSample2F[] = dgSample2F;
+
+#define dgSample30 "__OTR__sound/samples/sfx_5/15"
+static const ALIGN_ASSET(2) char gSample30[] = dgSample30;
+
+#define dgSample31 "__OTR__sound/samples/sfx_5/16"
+static const ALIGN_ASSET(2) char gSample31[] = dgSample31;
+
+#define dgSample32 "__OTR__sound/samples/sfx_5/17"
+static const ALIGN_ASSET(2) char gSample32[] = dgSample32;
+
+#define dgSample33 "__OTR__sound/samples/sfx_5/18"
+static const ALIGN_ASSET(2) char gSample33[] = dgSample33;
+
+#define dgSample34 "__OTR__sound/samples/sfx_5/19"
+static const ALIGN_ASSET(2) char gSample34[] = dgSample34;
+
+#define dgSample35 "__OTR__sound/samples/sfx_5/1A"
+static const ALIGN_ASSET(2) char gSample35[] = dgSample35;
+
+#define dgSample36 "__OTR__sound/samples/sfx_5/1B"
+static const ALIGN_ASSET(2) char gSample36[] = dgSample36;
+
+#define dgSample37 "__OTR__sound/samples/sfx_5/1C"
+static const ALIGN_ASSET(2) char gSample37[] = dgSample37;
+
+#define dgSample38 "__OTR__sound/samples/sfx_6/00"
+static const ALIGN_ASSET(2) char gSample38[] = dgSample38;
+
+#define dgSample39 "__OTR__sound/samples/sfx_6/01"
+static const ALIGN_ASSET(2) char gSample39[] = dgSample39;
+
+#define dgSample3A "__OTR__sound/samples/sfx_6/02"
+static const ALIGN_ASSET(2) char gSample3A[] = dgSample3A;
+
+#define dgSample3B "__OTR__sound/samples/sfx_6/03"
+static const ALIGN_ASSET(2) char gSample3B[] = dgSample3B;
+
+#define dgSample3C "__OTR__sound/samples/sfx_6/04"
+static const ALIGN_ASSET(2) char gSample3C[] = dgSample3C;
+
+#define dgSample3D "__OTR__sound/samples/sfx_6/05"
+static const ALIGN_ASSET(2) char gSample3D[] = dgSample3D;
+
+#define dgSample3E "__OTR__sound/samples/sfx_6/06"
+static const ALIGN_ASSET(2) char gSample3E[] = dgSample3E;
+
+#define dgSample3F "__OTR__sound/samples/sfx_6/07"
+static const ALIGN_ASSET(2) char gSample3F[] = dgSample3F;
+
+#define dgSample40 "__OTR__sound/samples/sfx_6/08"
+static const ALIGN_ASSET(2) char gSample40[] = dgSample40;
+
+#define dgSample41 "__OTR__sound/samples/sfx_6/09"
+static const ALIGN_ASSET(2) char gSample41[] = dgSample41;
+
+#define dgSample42 "__OTR__sound/samples/sfx_6/0A"
+static const ALIGN_ASSET(2) char gSample42[] = dgSample42;
+
+#define dgSample43 "__OTR__sound/samples/sfx_6/0B"
+static const ALIGN_ASSET(2) char gSample43[] = dgSample43;
+
+#define dgSample44 "__OTR__sound/samples/sfx_6/0C"
+static const ALIGN_ASSET(2) char gSample44[] = dgSample44;
+
+#define dgSample45 "__OTR__sound/samples/sfx_6/0D"
+static const ALIGN_ASSET(2) char gSample45[] = dgSample45;
+
+#define dgSample46 "__OTR__sound/samples/sfx_7/00"
+static const ALIGN_ASSET(2) char gSample46[] = dgSample46;
+
+#define dgSample47 "__OTR__sound/samples/sfx_7/01"
+static const ALIGN_ASSET(2) char gSample47[] = dgSample47;
+
+#define dgSample48 "__OTR__sound/samples/sfx_7/02"
+static const ALIGN_ASSET(2) char gSample48[] = dgSample48;
+
+#define dgSample49 "__OTR__sound/samples/sfx_7/03"
+static const ALIGN_ASSET(2) char gSample49[] = dgSample49;
+
+#define dgSample4A "__OTR__sound/samples/sfx_7/04"
+static const ALIGN_ASSET(2) char gSample4A[] = dgSample4A;
+
+#define dgSample4B "__OTR__sound/samples/sfx_7/05"
+static const ALIGN_ASSET(2) char gSample4B[] = dgSample4B;
+
+#define dgSample4C "__OTR__sound/samples/sfx_7/06"
+static const ALIGN_ASSET(2) char gSample4C[] = dgSample4C;
+
+#define dgSample4D "__OTR__sound/samples/sfx_7/07"
+static const ALIGN_ASSET(2) char gSample4D[] = dgSample4D;
+
+#define dgSample4E "__OTR__sound/samples/sfx_7/08"
+static const ALIGN_ASSET(2) char gSample4E[] = dgSample4E;
+
+#define dgSample4F "__OTR__sound/samples/sfx_7/09"
+static const ALIGN_ASSET(2) char gSample4F[] = dgSample4F;
+
+#define dgSample50 "__OTR__sound/samples/sfx_7/0A"
+static const ALIGN_ASSET(2) char gSample50[] = dgSample50;
+
+#define dgSample51 "__OTR__sound/samples/sfx_7/0B"
+static const ALIGN_ASSET(2) char gSample51[] = dgSample51;
+
+#define dgSample52 "__OTR__sound/samples/sfx_7/0C"
+static const ALIGN_ASSET(2) char gSample52[] = dgSample52;
+
+#define dgSample53 "__OTR__sound/samples/sfx_7/0D_chain_chomp_bark"
+static const ALIGN_ASSET(2) char gSample53[] = dgSample53;
+
+#define dgSample54 "__OTR__sound/samples/sfx_mario/00_mario_jump_hoo"
+static const ALIGN_ASSET(2) char gSample54[] = dgSample54;
+
+#define dgSample55 "__OTR__sound/samples/sfx_mario/01_mario_jump_wah"
+static const ALIGN_ASSET(2) char gSample55[] = dgSample55;
+
+#define dgSample56 "__OTR__sound/samples/sfx_mario/02_mario_yah"
+static const ALIGN_ASSET(2) char gSample56[] = dgSample56;
+
+#define dgSample57 "__OTR__sound/samples/sfx_mario/03_mario_haha"
+static const ALIGN_ASSET(2) char gSample57[] = dgSample57;
+
+#define dgSample58 "__OTR__sound/samples/sfx_mario/04_mario_yahoo"
+static const ALIGN_ASSET(2) char gSample58[] = dgSample58;
+
+#define dgSample59 "__OTR__sound/samples/sfx_mario/05_mario_uh"
+static const ALIGN_ASSET(2) char gSample59[] = dgSample59;
+
+#define dgSample5A "__OTR__sound/samples/sfx_mario/06_mario_hrmm"
+static const ALIGN_ASSET(2) char gSample5A[] = dgSample5A;
+
+#define dgSample5B "__OTR__sound/samples/sfx_mario/07_mario_wah2"
+static const ALIGN_ASSET(2) char gSample5B[] = dgSample5B;
+
+#define dgSample5C "__OTR__sound/samples/sfx_mario/08_mario_whoa"
+static const ALIGN_ASSET(2) char gSample5C[] = dgSample5C;
+
+#define dgSample5D "__OTR__sound/samples/sfx_mario/09_mario_eeuh"
+static const ALIGN_ASSET(2) char gSample5D[] = dgSample5D;
+
+#define dgSample5E "__OTR__sound/samples/sfx_mario/0A_mario_attacked"
+static const ALIGN_ASSET(2) char gSample5E[] = dgSample5E;
+
+#define dgSample5F "__OTR__sound/samples/sfx_mario/0B_mario_ooof"
+static const ALIGN_ASSET(2) char gSample5F[] = dgSample5F;
+
+#define dgSample60 "__OTR__sound/samples/sfx_mario/0C_mario_here_we_go"
+static const ALIGN_ASSET(2) char gSample60[] = dgSample60;
+
+#define dgSample61 "__OTR__sound/samples/sfx_mario/0D_mario_yawning"
+static const ALIGN_ASSET(2) char gSample61[] = dgSample61;
+
+#define dgSample62 "__OTR__sound/samples/sfx_mario/0E_mario_snoring1"
+static const ALIGN_ASSET(2) char gSample62[] = dgSample62;
+
+#define dgSample63 "__OTR__sound/samples/sfx_mario/0F_mario_snoring2"
+static const ALIGN_ASSET(2) char gSample63[] = dgSample63;
+
+#define dgSample64 "__OTR__sound/samples/sfx_mario/10_mario_doh"
+static const ALIGN_ASSET(2) char gSample64[] = dgSample64;
+
+#define dgSample65 "__OTR__sound/samples/sfx_mario/11_mario_game_over"
+static const ALIGN_ASSET(2) char gSample65[] = dgSample65;
+
+#define dgSample66 "__OTR__sound/samples/sfx_mario/12_mario_hello"
+static const ALIGN_ASSET(2) char gSample66[] = dgSample66;
+
+#define dgSample67 "__OTR__sound/samples/sfx_mario/13_mario_press_start_to_play"
+static const ALIGN_ASSET(2) char gSample67[] = dgSample67;
+
+#define dgSample68 "__OTR__sound/samples/sfx_mario/14_mario_twirl_bounce"
+static const ALIGN_ASSET(2) char gSample68[] = dgSample68;
+
+#define dgSample69 "__OTR__sound/samples/sfx_mario/15_mario_snoring3"
+static const ALIGN_ASSET(2) char gSample69[] = dgSample69;
+
+#define dgSample6A "__OTR__sound/samples/sfx_mario/16_mario_so_longa_bowser"
+static const ALIGN_ASSET(2) char gSample6A[] = dgSample6A;
+
+#define dgSample6B "__OTR__sound/samples/sfx_mario/17_mario_ima_tired"
+static const ALIGN_ASSET(2) char gSample6B[] = dgSample6B;
+
+#define dgSample6C "__OTR__sound/samples/sfx_mario/18_mario_waha"
+static const ALIGN_ASSET(2) char gSample6C[] = dgSample6C;
+
+#define dgSample6D "__OTR__sound/samples/sfx_mario/19_mario_yippee"
+static const ALIGN_ASSET(2) char gSample6D[] = dgSample6D;
+
+#define dgSample6E "__OTR__sound/samples/sfx_mario/1A_mario_lets_a_go"
+static const ALIGN_ASSET(2) char gSample6E[] = dgSample6E;
+
+#define dgSample6F "__OTR__sound/samples/sfx_9/00"
+static const ALIGN_ASSET(2) char gSample6F[] = dgSample6F;
+
+#define dgSample70 "__OTR__sound/samples/sfx_9/01"
+static const ALIGN_ASSET(2) char gSample70[] = dgSample70;
+
+#define dgSample71 "__OTR__sound/samples/sfx_9/02"
+static const ALIGN_ASSET(2) char gSample71[] = dgSample71;
+
+#define dgSample72 "__OTR__sound/samples/sfx_9/03"
+static const ALIGN_ASSET(2) char gSample72[] = dgSample72;
+
+#define dgSample73 "__OTR__sound/samples/sfx_9/04_camera_buzz"
+static const ALIGN_ASSET(2) char gSample73[] = dgSample73;
+
+#define dgSample74 "__OTR__sound/samples/sfx_9/05_camera_shutter"
+static const ALIGN_ASSET(2) char gSample74[] = dgSample74;
+
+#define dgSample75 "__OTR__sound/samples/sfx_9/06"
+static const ALIGN_ASSET(2) char gSample75[] = dgSample75;
+
+#define dgSample76 "__OTR__sound/samples/sfx_mario_peach/00_mario_waaaooow"
+static const ALIGN_ASSET(2) char gSample76[] = dgSample76;
+
+#define dgSample77 "__OTR__sound/samples/sfx_mario_peach/01_mario_hoohoo"
+static const ALIGN_ASSET(2) char gSample77[] = dgSample77;
+
+#define dgSample78 "__OTR__sound/samples/sfx_mario_peach/02_mario_panting"
+static const ALIGN_ASSET(2) char gSample78[] = dgSample78;
+
+#define dgSample79 "__OTR__sound/samples/sfx_mario_peach/03_mario_dying"
+static const ALIGN_ASSET(2) char gSample79[] = dgSample79;
+
+#define dgSample7A "__OTR__sound/samples/sfx_mario_peach/04_mario_on_fire"
+static const ALIGN_ASSET(2) char gSample7A[] = dgSample7A;
+
+#define dgSample7B "__OTR__sound/samples/sfx_mario_peach/05_mario_uh2"
+static const ALIGN_ASSET(2) char gSample7B[] = dgSample7B;
+
+#define dgSample7C "__OTR__sound/samples/sfx_mario_peach/06_mario_coughing"
+static const ALIGN_ASSET(2) char gSample7C[] = dgSample7C;
+
+#define dgSample7D "__OTR__sound/samples/sfx_mario_peach/07_mario_its_a_me_mario"
+static const ALIGN_ASSET(2) char gSample7D[] = dgSample7D;
+
+#define dgSample7E "__OTR__sound/samples/sfx_mario_peach/08_mario_punch_yah"
+static const ALIGN_ASSET(2) char gSample7E[] = dgSample7E;
+
+#define dgSample7F "__OTR__sound/samples/sfx_mario_peach/09_mario_punch_hoo"
+static const ALIGN_ASSET(2) char gSample7F[] = dgSample7F;
+
+#define dgSample80 "__OTR__sound/samples/sfx_mario_peach/0A_mario_mama_mia"
+static const ALIGN_ASSET(2) char gSample80[] = dgSample80;
+
+#define dgSample81 "__OTR__sound/samples/sfx_mario_peach/0B_mario_okey_dokey"
+static const ALIGN_ASSET(2) char gSample81[] = dgSample81;
+
+#define dgSample82 "__OTR__sound/samples/sfx_mario_peach/0C_mario_drowning"
+static const ALIGN_ASSET(2) char gSample82[] = dgSample82;
+
+#define dgSample83 "__OTR__sound/samples/sfx_mario_peach/0D_mario_thank_you_playing_my_game"
+static const ALIGN_ASSET(2) char gSample83[] = dgSample83;
+
+#define dgSample84 "__OTR__sound/samples/sfx_mario_peach/0E_peach_dear_mario"
+static const ALIGN_ASSET(2) char gSample84[] = dgSample84;
+
+#define dgSample85 "__OTR__sound/samples/sfx_mario_peach/0F_peach_mario"
+static const ALIGN_ASSET(2) char gSample85[] = dgSample85;
+
+#define dgSample86 "__OTR__sound/samples/sfx_mario_peach/10_peach_power_of_the_stars"
+static const ALIGN_ASSET(2) char gSample86[] = dgSample86;
+
+#define dgSample87 "__OTR__sound/samples/sfx_mario_peach/11_peach_thanks_to_you"
+static const ALIGN_ASSET(2) char gSample87[] = dgSample87;
+
+#define dgSample88 "__OTR__sound/samples/sfx_mario_peach/12_peach_thank_you_mario"
+static const ALIGN_ASSET(2) char gSample88[] = dgSample88;
+
+#define dgSample89 "__OTR__sound/samples/sfx_mario_peach/13_peach_something_special"
+static const ALIGN_ASSET(2) char gSample89[] = dgSample89;
+
+#define dgSample8A "__OTR__sound/samples/sfx_mario_peach/14_peach_bake_a_cake"
+static const ALIGN_ASSET(2) char gSample8A[] = dgSample8A;
+
+#define dgSample8B "__OTR__sound/samples/sfx_mario_peach/15_peach_for_mario"
+static const ALIGN_ASSET(2) char gSample8B[] = dgSample8B;
+
+#define dgSample8C "__OTR__sound/samples/sfx_mario_peach/16_peach_mario2"
+static const ALIGN_ASSET(2) char gSample8C[] = dgSample8C;
+
+#define dgSample8D "__OTR__sound/samples/instruments/00"
+static const ALIGN_ASSET(2) char gSample8D[] = dgSample8D;
+
+#define dgSample8E "__OTR__sound/samples/instruments/01_banjo_1"
+static const ALIGN_ASSET(2) char gSample8E[] = dgSample8E;
+
+#define dgSample8F "__OTR__sound/samples/instruments/02"
+static const ALIGN_ASSET(2) char gSample8F[] = dgSample8F;
+
+#define dgSample90 "__OTR__sound/samples/instruments/03_human_whistle"
+static const ALIGN_ASSET(2) char gSample90[] = dgSample90;
+
+#define dgSample91 "__OTR__sound/samples/instruments/04_bright_piano"
+static const ALIGN_ASSET(2) char gSample91[] = dgSample91;
+
+#define dgSample92 "__OTR__sound/samples/instruments/05_acoustic_bass"
+static const ALIGN_ASSET(2) char gSample92[] = dgSample92;
+
+#define dgSample93 "__OTR__sound/samples/instruments/06_kick_drum_1"
+static const ALIGN_ASSET(2) char gSample93[] = dgSample93;
+
+#define dgSample94 "__OTR__sound/samples/instruments/07_rimshot"
+static const ALIGN_ASSET(2) char gSample94[] = dgSample94;
+
+#define dgSample95 "__OTR__sound/samples/instruments/08"
+static const ALIGN_ASSET(2) char gSample95[] = dgSample95;
+
+#define dgSample96 "__OTR__sound/samples/instruments/09"
+static const ALIGN_ASSET(2) char gSample96[] = dgSample96;
+
+#define dgSample97 "__OTR__sound/samples/instruments/0A_tambourine"
+static const ALIGN_ASSET(2) char gSample97[] = dgSample97;
+
+#define dgSample98 "__OTR__sound/samples/instruments/0B"
+static const ALIGN_ASSET(2) char gSample98[] = dgSample98;
+
+#define dgSample99 "__OTR__sound/samples/instruments/0C_conga_stick"
+static const ALIGN_ASSET(2) char gSample99[] = dgSample99;
+
+#define dgSample9A "__OTR__sound/samples/instruments/0D_clave"
+static const ALIGN_ASSET(2) char gSample9A[] = dgSample9A;
+
+#define dgSample9B "__OTR__sound/samples/instruments/0E_hihat_closed"
+static const ALIGN_ASSET(2) char gSample9B[] = dgSample9B;
+
+#define dgSample9C "__OTR__sound/samples/instruments/0F_hihat_open"
+static const ALIGN_ASSET(2) char gSample9C[] = dgSample9C;
+
+#define dgSample9D "__OTR__sound/samples/instruments/10_cymbal_bell"
+static const ALIGN_ASSET(2) char gSample9D[] = dgSample9D;
+
+#define dgSample9E "__OTR__sound/samples/instruments/11_splash_cymbal"
+static const ALIGN_ASSET(2) char gSample9E[] = dgSample9E;
+
+#define dgSample9F "__OTR__sound/samples/instruments/12_snare_drum_1"
+static const ALIGN_ASSET(2) char gSample9F[] = dgSample9F;
+
+#define dgSampleA0 "__OTR__sound/samples/instruments/13_snare_drum_2"
+static const ALIGN_ASSET(2) char gSampleA0[] = dgSampleA0;
+
+#define dgSampleA1 "__OTR__sound/samples/instruments/14_strings_5"
+static const ALIGN_ASSET(2) char gSampleA1[] = dgSampleA1;
+
+#define dgSampleA2 "__OTR__sound/samples/instruments/15_strings_4"
+static const ALIGN_ASSET(2) char gSampleA2[] = dgSampleA2;
+
+#define dgSampleA3 "__OTR__sound/samples/instruments/16_french_horns"
+static const ALIGN_ASSET(2) char gSampleA3[] = dgSampleA3;
+
+#define dgSampleA4 "__OTR__sound/samples/instruments/17_trumpet"
+static const ALIGN_ASSET(2) char gSampleA4[] = dgSampleA4;
+
+#define dgSampleA5 "__OTR__sound/samples/instruments/18_timpani"
+static const ALIGN_ASSET(2) char gSampleA5[] = dgSampleA5;
+
+#define dgSampleA6 "__OTR__sound/samples/instruments/19_brass"
+static const ALIGN_ASSET(2) char gSampleA6[] = dgSampleA6;
+
+#define dgSampleA7 "__OTR__sound/samples/instruments/1A_slap_bass"
+static const ALIGN_ASSET(2) char gSampleA7[] = dgSampleA7;
+
+#define dgSampleA8 "__OTR__sound/samples/instruments/1B_organ_2"
+static const ALIGN_ASSET(2) char gSampleA8[] = dgSampleA8;
+
+#define dgSampleA9 "__OTR__sound/samples/instruments/1C"
+static const ALIGN_ASSET(2) char gSampleA9[] = dgSampleA9;
+
+#define dgSampleAA "__OTR__sound/samples/instruments/1D"
+static const ALIGN_ASSET(2) char gSampleAA[] = dgSampleAA;
+
+#define dgSampleAB "__OTR__sound/samples/instruments/1E_closed_triangle"
+static const ALIGN_ASSET(2) char gSampleAB[] = dgSampleAB;
+
+#define dgSampleAC "__OTR__sound/samples/instruments/1F_open_triangle"
+static const ALIGN_ASSET(2) char gSampleAC[] = dgSampleAC;
+
+#define dgSampleAD "__OTR__sound/samples/instruments/20_cabasa"
+static const ALIGN_ASSET(2) char gSampleAD[] = dgSampleAD;
+
+#define dgSampleAE "__OTR__sound/samples/instruments/21_sine_bass"
+static const ALIGN_ASSET(2) char gSampleAE[] = dgSampleAE;
+
+#define dgSampleAF "__OTR__sound/samples/instruments/22_boys_choir"
+static const ALIGN_ASSET(2) char gSampleAF[] = dgSampleAF;
+
+#define dgSampleB0 "__OTR__sound/samples/instruments/23_strings_1"
+static const ALIGN_ASSET(2) char gSampleB0[] = dgSampleB0;
+
+#define dgSampleB1 "__OTR__sound/samples/instruments/24_strings_2"
+static const ALIGN_ASSET(2) char gSampleB1[] = dgSampleB1;
+
+#define dgSampleB2 "__OTR__sound/samples/instruments/25_strings_3"
+static const ALIGN_ASSET(2) char gSampleB2[] = dgSampleB2;
+
+#define dgSampleB3 "__OTR__sound/samples/instruments/26_crystal_rhodes"
+static const ALIGN_ASSET(2) char gSampleB3[] = dgSampleB3;
+
+#define dgSampleB4 "__OTR__sound/samples/instruments/27_harpsichord"
+static const ALIGN_ASSET(2) char gSampleB4[] = dgSampleB4;
+
+#define dgSampleB5 "__OTR__sound/samples/instruments/28_sitar_1"
+static const ALIGN_ASSET(2) char gSampleB5[] = dgSampleB5;
+
+#define dgSampleB6 "__OTR__sound/samples/instruments/29_orchestra_hit"
+static const ALIGN_ASSET(2) char gSampleB6[] = dgSampleB6;
+
+#define dgSampleB7 "__OTR__sound/samples/instruments/2A"
+static const ALIGN_ASSET(2) char gSampleB7[] = dgSampleB7;
+
+#define dgSampleB8 "__OTR__sound/samples/instruments/2B"
+static const ALIGN_ASSET(2) char gSampleB8[] = dgSampleB8;
+
+#define dgSampleB9 "__OTR__sound/samples/instruments/2C"
+static const ALIGN_ASSET(2) char gSampleB9[] = dgSampleB9;
+
+#define dgSampleBA "__OTR__sound/samples/instruments/2D_trombone"
+static const ALIGN_ASSET(2) char gSampleBA[] = dgSampleBA;
+
+#define dgSampleBB "__OTR__sound/samples/instruments/2E_accordion"
+static const ALIGN_ASSET(2) char gSampleBB[] = dgSampleBB;
+
+#define dgSampleBC "__OTR__sound/samples/instruments/2F_sleigh_bells"
+static const ALIGN_ASSET(2) char gSampleBC[] = dgSampleBC;
+
+#define dgSampleBD "__OTR__sound/samples/instruments/30_rarefaction-lahna"
+static const ALIGN_ASSET(2) char gSampleBD[] = dgSampleBD;
+
+#define dgSampleBE "__OTR__sound/samples/instruments/31_rarefaction-convolution"
+static const ALIGN_ASSET(2) char gSampleBE[] = dgSampleBE;
+
+#define dgSampleBF "__OTR__sound/samples/instruments/32_metal_rimshot"
+static const ALIGN_ASSET(2) char gSampleBF[] = dgSampleBF;
+
+#define dgSampleC0 "__OTR__sound/samples/instruments/33_kick_drum_2"
+static const ALIGN_ASSET(2) char gSampleC0[] = dgSampleC0;
+
+#define dgSampleC1 "__OTR__sound/samples/instruments/34_alto_flute"
+static const ALIGN_ASSET(2) char gSampleC1[] = dgSampleC1;
+
+#define dgSampleC2 "__OTR__sound/samples/instruments/35_gospel_organ"
+static const ALIGN_ASSET(2) char gSampleC2[] = dgSampleC2;
+
+#define dgSampleC3 "__OTR__sound/samples/instruments/36_sawtooth_synth"
+static const ALIGN_ASSET(2) char gSampleC3[] = dgSampleC3;
+
+#define dgSampleC4 "__OTR__sound/samples/instruments/37_square_synth"
+static const ALIGN_ASSET(2) char gSampleC4[] = dgSampleC4;
+
+#define dgSampleC5 "__OTR__sound/samples/instruments/38_electric_kick_drum"
+static const ALIGN_ASSET(2) char gSampleC5[] = dgSampleC5;
+
+#define dgSampleC6 "__OTR__sound/samples/instruments/39_sitar_2"
+static const ALIGN_ASSET(2) char gSampleC6[] = dgSampleC6;
+
+#define dgSampleC7 "__OTR__sound/samples/instruments/3A_music_box"
+static const ALIGN_ASSET(2) char gSampleC7[] = dgSampleC7;
+
+#define dgSampleC8 "__OTR__sound/samples/instruments/3B_banjo_2"
+static const ALIGN_ASSET(2) char gSampleC8[] = dgSampleC8;
+
+#define dgSampleC9 "__OTR__sound/samples/instruments/3C_acoustic_guitar"
+static const ALIGN_ASSET(2) char gSampleC9[] = dgSampleC9;
+
+#define dgSampleCA "__OTR__sound/samples/instruments/3D"
+static const ALIGN_ASSET(2) char gSampleCA[] = dgSampleCA;
+
+#define dgSampleCB "__OTR__sound/samples/instruments/3E_monk_choir"
+static const ALIGN_ASSET(2) char gSampleCB[] = dgSampleCB;
+
+#define dgSampleCC "__OTR__sound/samples/instruments/3F"
+static const ALIGN_ASSET(2) char gSampleCC[] = dgSampleCC;
+
+#define dgSampleCD "__OTR__sound/samples/instruments/40_bell"
+static const ALIGN_ASSET(2) char gSampleCD[] = dgSampleCD;
+
+#define dgSampleCE "__OTR__sound/samples/instruments/41_pan_flute"
+static const ALIGN_ASSET(2) char gSampleCE[] = dgSampleCE;
+
+#define dgSampleCF "__OTR__sound/samples/instruments/42_vibraphone"
+static const ALIGN_ASSET(2) char gSampleCF[] = dgSampleCF;
+
+#define dgSampleD0 "__OTR__sound/samples/instruments/43_harmonica"
+static const ALIGN_ASSET(2) char gSampleD0[] = dgSampleD0;
+
+#define dgSampleD1 "__OTR__sound/samples/instruments/44_grand_piano"
+static const ALIGN_ASSET(2) char gSampleD1[] = dgSampleD1;
+
+#define dgSampleD2 "__OTR__sound/samples/instruments/45_french_horns_lq"
+static const ALIGN_ASSET(2) char gSampleD2[] = dgSampleD2;
+
+#define dgSampleD3 "__OTR__sound/samples/instruments/46_pizzicato_strings_1"
+static const ALIGN_ASSET(2) char gSampleD3[] = dgSampleD3;
+
+#define dgSampleD4 "__OTR__sound/samples/instruments/47_pizzicato_strings_2"
+static const ALIGN_ASSET(2) char gSampleD4[] = dgSampleD4;
+
+#define dgSampleD5 "__OTR__sound/samples/instruments/48_steel_drum"
+static const ALIGN_ASSET(2) char gSampleD5[] = dgSampleD5;
+
+#define dgSampleD6 "__OTR__sound/samples/piranha_music_box/00_music_box"
+static const ALIGN_ASSET(2) char gSampleD6[] = dgSampleD6;
+
+#define dgSampleD7 "__OTR__sound/samples/course_start/00_la"
+static const ALIGN_ASSET(2) char gSampleD7[] = dgSampleD7;
+
+#define dgSampleD8 "__OTR__sound/samples/bowser_organ/00_organ_1"
+static const ALIGN_ASSET(2) char gSampleD8[] = dgSampleD8;
+
+#define dgSampleD9 "__OTR__sound/samples/bowser_organ/01_organ_1_lq"
+static const ALIGN_ASSET(2) char gSampleD9[] = dgSampleD9;
+
+#define dgSampleDA "__OTR__sound/samples/bowser_organ/02_boys_choir"
+static const ALIGN_ASSET(2) char gSampleDA[] = dgSampleDA;
+
+static const char* gSampleTable[] = {
+ gSample00, gSample01, gSample02, gSample03,
+ gSample04, gSample05, gSample06, gSample07,
+ gSample08, gSample09, gSample0A, gSample0B,
+ gSample0C, gSample0D, gSample0E, gSample0F,
+ gSample10, gSample11, gSample12, gSample13,
+ gSample14, gSample15, gSample16, gSample17,
+ gSample18, gSample19, gSample1A, gSample1B,
+ gSample1C, gSample1D, gSample1E, gSample1F,
+ gSample20, gSample21, gSample22, gSample23,
+ gSample24, gSample25, gSample26, gSample27,
+ gSample28, gSample29, gSample2A, gSample2B,
+ gSample2C, gSample2D, gSample2E, gSample2F,
+ gSample30, gSample31, gSample32, gSample33,
+ gSample34, gSample35, gSample36, gSample37,
+ gSample38, gSample39, gSample3A, gSample3B,
+ gSample3C, gSample3D, gSample3E, gSample3F,
+ gSample40, gSample41, gSample42, gSample43,
+ gSample44, gSample45, gSample46, gSample47,
+ gSample48, gSample49, gSample4A, gSample4B,
+ gSample4C, gSample4D, gSample4E, gSample4F,
+ gSample50, gSample51, gSample52, gSample53,
+ gSample54, gSample55, gSample56, gSample57,
+ gSample58, gSample59, gSample5A, gSample5B,
+ gSample5C, gSample5D, gSample5E, gSample5F,
+ gSample60, gSample61, gSample62, gSample63,
+ gSample64, gSample65, gSample66, gSample67,
+ gSample68, gSample69, gSample6A, gSample6B,
+ gSample6C, gSample6D, gSample6E, gSample6F,
+ gSample70, gSample71, gSample72, gSample73,
+ gSample74, gSample75, gSample76, gSample77,
+ gSample78, gSample79, gSample7A, gSample7B,
+ gSample7C, gSample7D, gSample7E, gSample7F,
+ gSample80, gSample81, gSample82, gSample83,
+ gSample84, gSample85, gSample86, gSample87,
+ gSample88, gSample89, gSample8A, gSample8B,
+ gSample8C, gSample8D, gSample8E, gSample8F,
+ gSample90, gSample91, gSample92, gSample93,
+ gSample94, gSample95, gSample96, gSample97,
+ gSample98, gSample99, gSample9A, gSample9B,
+ gSample9C, gSample9D, gSample9E, gSample9F,
+ gSampleA0, gSampleA1, gSampleA2, gSampleA3,
+ gSampleA4, gSampleA5, gSampleA6, gSampleA7,
+ gSampleA8, gSampleA9, gSampleAA, gSampleAB,
+ gSampleAC, gSampleAD, gSampleAE, gSampleAF,
+ gSampleB0, gSampleB1, gSampleB2, gSampleB3,
+ gSampleB4, gSampleB5, gSampleB6, gSampleB7,
+ gSampleB8, gSampleB9, gSampleBA, gSampleBB,
+ gSampleBC, gSampleBD, gSampleBE, gSampleBF,
+ gSampleC0, gSampleC1, gSampleC2, gSampleC3,
+ gSampleC4, gSampleC5, gSampleC6, gSampleC7,
+ gSampleC8, gSampleC9, gSampleCA, gSampleCB,
+ gSampleCC, gSampleCD, gSampleCE, gSampleCF,
+ gSampleD0, gSampleD1, gSampleD2, gSampleD3,
+ gSampleD4, gSampleD5, gSampleD6, gSampleD7,
+ gSampleD8, gSampleD9, gSampleDA,
+};
diff --git a/src/factories/AudioFactory.cpp b/src/factories/AudioFactory.cpp
index d1d2111..a6c5364 100644
--- a/src/factories/AudioFactory.cpp
+++ b/src/factories/AudioFactory.cpp
@@ -2,7 +2,7 @@
#include <vector>
#include "audio/AudioManager.h"
-#include "audio/AIFCDecode.h"
+#include "audio/samples_table.h"
#include "binarytools/BinaryReader.h"
bool AudioFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std::vector<uint8_t>& buffer) {
@@ -22,16 +22,156 @@ bool AudioFactory::process(LUS::BinaryWriter* writer, nlohmann::json& data, std:
return true;
}
- if(!metadata[1].contains("us")){
+ if(path.find("sound/banks") != std::string::npos){
+ auto banks = AudioManager::Instance->get_banks();
+ auto bankId = metadata["us"][0];
+ auto bank = banks[bankId];
+
+ if(bankId == 10){
+ int bp = 1;
+ }
+
+ WRITE_HEADER(LUS::ResourceType::Bank, 0);
+
+ if(path.find("sound/banks/us/20_bank") != std::string::npos){
+ int bp = 0;
+ }
+
+ WRITE_U32(bank.insts.size());
+ for(auto &instrument : bank.insts){
+ WRITE_U8(instrument.valid);
+ if(!instrument.valid){
+ continue;
+ }
+ WRITE_U8(instrument.releaseRate);
+ WRITE_U8(instrument.normalRangeLo);
+ WRITE_U8(instrument.normalRangeHi);
+
+ auto envelope = bank.envelopes[instrument.envelope];
+ if(!envelope.entries.empty()){
+ WRITE_U32(envelope.entries.size());
+ for(auto &entry : envelope.entries){
+ writer->Write(entry.delay);
+ writer->Write(entry.arg);
+ }
+ } else {
+ WRITE_U32(0);
+ }
+
+ uint32_t soundFlags = 0;
+ bool hasLo = instrument.soundLo.has_value();
+ bool hasMed = instrument.soundMed.has_value();
+ bool hasHi = instrument.soundHi.has_value();
+ if(hasLo){
+ soundFlags |= (1 << 0);
+ }
+ if(hasMed){
+ soundFlags |= (1 << 1);
+ }
+ if(hasHi){
+ soundFlags |= (1 << 2);
+ }
+
+ WRITE_U32(soundFlags);
+ if(hasLo){
+ auto value = instrument.soundLo.value();
+ uint32_t idx = AudioManager::Instance->get_index(bank.samples[value.offset]);
+ writer->Write(std::string(gSampleTable[idx]));
+ writer->Write(value.tuning);
+ }
+ if(hasMed){
+ auto value = instrument.soundMed.value();
+ uint32_t idx = AudioManager::Instance->get_index(bank.samples[value.offset]);
+ writer->Write(std::string(gSampleTable[idx]));
+ writer->Write(value.tuning);
+ }
+ if(hasHi){
+ auto value = instrument.soundHi.value();
+ uint32_t idx = AudioManager::Instance->get_index(bank.samples[value.offset]);
+ writer->Write(std::string(gSampleTable[idx]));
+ writer->Write(value.tuning);
+ }
+
+ }
+
+ WRITE_U32(bank.drums.size());
+ for(auto &drum : bank.drums){
+ WRITE_U8(drum.releaseRate);
+ WRITE_U8(drum.pan);
+ auto envelope = bank.envelopes[drum.envelope];
+ if(!envelope.entries.empty()){
+ std::cout << "Envelope entries: " << envelope.entries.size() << std::endl;
+ WRITE_U32(envelope.entries.size());
+ for(auto &entry : envelope.entries){
+ writer->Write(entry.delay);
+ writer->Write(entry.arg);
+ }
+ } else {
+ WRITE_U32(0);
+ }
+
+ uint32_t idx = AudioManager::Instance->get_index(bank.samples[drum.sound.offset]);
+ std::string out = std::string(gSampleTable[idx]);
+ writer->Write(out);
+ writer->Write(drum.sound.tuning);
+ }
+
+ return true;
+ }
+
+ if(metadata.size() < 2 || !metadata[1].contains("us")){
return false;
}
- LUS::BinaryWriter aifcWriter;
- AudioManager::Instance->create_aifc(metadata[1]["us"][1], aifcWriter);
- std::vector<char> aifcData = aifcWriter.ToVector();
- aifcWriter.Close();
+ /*
+ * HINT: Uncomment this to write the aiff to a file
+ LUS::BinaryWriter aifcWriter;
+ AudioManager::Instance->create_aifc(metadata[1]["us"][1], aifcWriter);
+ std::vector<char> aifcData = aifcWriter.ToVector();
+ aifcWriter.Close();
+ write_aiff(aifcData, *writer);
+ */
+
+ WRITE_HEADER(LUS::ResourceType::Audio, 0);
+
+ AudioBankSample entry = AudioManager::Instance->get_aifc(metadata[1]["us"][1]);
+
+ if(path.find("00_mario_waaaooow") != std::string::npos){
+ int bp = 0;
+ }
+
+ // Write AdpcmLoop
+ WRITE_U32(entry.loop.start);
+ WRITE_U32(entry.loop.end);
+ WRITE_I32(entry.loop.count);
+ WRITE_U32(entry.loop.pad);
+
+ if(entry.loop.state.has_value()){
+ std::vector<int16_t> state = entry.loop.state.value();
+ WRITE_U32(state.size());
+ for(auto &value : state){
+ writer->Write(value);
+ }
+ } else {
+ WRITE_U32(0);
+ }
+
+ // Write AdpcmBook
+ WRITE_I32(entry.book.order);
+ WRITE_I32(entry.book.npredictors);
+
+ WRITE_U32(entry.book.table.size());
+ for(auto &value : entry.book.table){
+ writer->Write(value);
+ }
+
+ // Write sample
+ WRITE_I32(entry.data.size());
+ for(auto &value : entry.data){
+ WRITE_U8(value);
+ }
- write_aiff(aifcData, *writer);
+ writer->Write(entry.name);
return true;
-}
+} \ No newline at end of file
diff --git a/src/factories/RawFactory.h b/src/factories/RawFactory.h
index fe6ec98..8918b8b 100644
--- a/src/factories/RawFactory.h
+++ b/src/factories/RawFactory.h
@@ -8,11 +8,13 @@
#define WRITE_HEADER(type, version) this->WriteHeader(writer, type, version)
#define WRITE_BHEADER(type, version) this->WriteHeader(writer, type, version, true)
+#define WRITE_U8(value) writer->Write((uint8_t) value)
#define WRITE_U16(value) writer->Write((uint16_t) value)
#define WRITE_U32(value) writer->Write((uint32_t) value)
#define WRITE_U64(value) writer->Write((uint64_t) value)
#define WRITE_I8(value) writer->Write((int8_t) value)
#define WRITE_I16(value) writer->Write((int16_t) value)
+#define WRITE_I32(value) writer->Write((int32_t) value)
#define WRITE_DATA(vec) writer->Write((char*) vec.data(), data.size())
#define WRITE_ARRAY(data, size) writer->Write((char*) data, size)
diff --git a/src/factories/ResourceType.h b/src/factories/ResourceType.h
index 3d4013b..ee8a9f6 100644
--- a/src/factories/ResourceType.h
+++ b/src/factories/ResourceType.h
@@ -19,5 +19,7 @@ enum class ResourceType {
Demo = 0x44454D4F, // DEMO
Skybox = 0x534B5942, // SKYB
Anim = 0x414E494D, // ANIM
+ Bank = 0x42414E4B, // BANK
+ Audio = 0x41554643, // AIFC
};
} // namespace LUS
diff --git a/tools/gen_banks.js b/tools/gen_banks.js
new file mode 100644
index 0000000..6e1da48
--- /dev/null
+++ b/tools/gen_banks.js
@@ -0,0 +1,37 @@
+const fs = require('fs');
+const data = require('../assets.json');
+
+const header = [
+ '#pragma once',
+ '#include "align_asset_macro.h"',
+ '',
+]
+const banks = []
+
+async function main(){
+ const files = Object.keys(data).filter(f => f.endsWith(".bnk") && data[f]['us'] != undefined).map(m => {
+ return {
+ file: m,
+ offset: data[m]['us'][0]
+ }
+ })
+
+ files.sort((a, b) => a.offset - b.offset);
+
+ for(const entry of files){
+ const sampleId = entry.offset.toString(16).padStart(2, '0').toUpperCase();
+ banks.push(`gBank${sampleId}`);
+ header.push(`#define dgBank${sampleId} "__OTR__${entry.file.replace('.bnk', '')}"`);
+ header.push(`static const ALIGN_ASSET(2) char gBank${sampleId}[] = dgBank${sampleId};\n`);
+ }
+
+ header.push('static const char* gBankTable[] = {');
+ for (const bank of banks) {
+ header.push(` ${bank},`);
+ }
+ header.push('};\n');
+
+ fs.writeFileSync('./banks_table.h', header.join('\n'));
+}
+
+main(); \ No newline at end of file
diff --git a/tools/gen_samples.js b/tools/gen_samples.js
new file mode 100644
index 0000000..56cead5
--- /dev/null
+++ b/tools/gen_samples.js
@@ -0,0 +1,37 @@
+const fs = require('fs');
+const data = require('../assets.json');
+
+const header = [
+ '#pragma once',
+ '#include "align_asset_macro.h"',
+ '',
+]
+const samples = []
+
+async function main(){
+ const files = Object.keys(data).filter(f => f.endsWith(".aiff") && data[f][1]['us'] != undefined).map(m => {
+ return {
+ file: m,
+ offset: data[m][1]['us'][1]
+ }
+ })
+
+ files.sort((a, b) => a.offset - b.offset);
+
+ for(const entry of files){
+ const sampleId = entry.offset.toString(16).padStart(2, '0').toUpperCase();
+ samples.push(`gSample${sampleId}`);
+ header.push(`#define dgSample${sampleId} "__OTR__${entry.file.replace('.aiff', '')}"`);
+ header.push(`static const ALIGN_ASSET(2) char gSample${sampleId}[] = dgSample${sampleId};\n`);
+ }
+
+ header.push('static const char* gSampleTable[] = {');
+ for (const sample of samples) {
+ header.push(` ${sample},`);
+ }
+ header.push('};\n');
+
+ fs.writeFileSync('./samples_table.h', header.join('\n'));
+}
+
+main(); \ No newline at end of file