[Audio 10/10] Loose ends (#2337)

* Introduce afile_sizes, generate headers of sizes for soundfonts and sequences

* Initial tools/audio README

* Versioning for samplebank extraction

* Clean up the disassemble_sequence.py runnable interface

* Add static assertions for maximum bank sizes

* Boost optimization for audio tools

* Samplebank XML doc

* Soundfont XML doc

* More docs in sampleconv for vadpcm

* Various tools fixes/cleanup

* VADPCM doc

* Try to fix md formatting

* VADPCM doc can come later

* Fix merge with PR 9

* Fix blobs from MM

* Try to fix bss

* Try fix bss round 2

* Fix sampleconv memset bug

* Suggested documentation tweaks
This commit is contained in:
Tharo
2024-12-14 00:26:36 +00:00
committed by GitHub
parent 4b20d8269b
commit df5d4cb467
39 changed files with 903 additions and 178 deletions
+2 -3
View File
@@ -558,10 +558,9 @@ _RESET_SECTION
.macro .startseq name
/* Begin a sequence. */
/* Write the sequence name into a special .name section */
.pushsection .name, "", @note
/* Write the sequence name into a special .note.name section */
.pushsection .note.name, "", @note
.asciz "\name"
.balign 4
.popsection
/* Reset section and write start symbol. */
+1 -1
View File
@@ -29,7 +29,7 @@ __attribute__((noreturn)) void __assert(const char* assertion, const char* file,
// Static/compile-time assertions
#if defined(__GNUC__) || (__STDC_VERSION__ >= 201112L)
#if !defined(__sgi) && (defined(__GNUC__) || (__STDC_VERSION__ >= 201112L))
# define static_assert(cond, msg) _Static_assert(cond, msg)
#else
# ifndef GLUE
+26
View File
@@ -4,6 +4,7 @@
#include "ultra64.h"
#include "versions.h"
#include "z64math.h"
#include "libc/assert.h"
typedef enum SfxBankType {
/* 0 */ BANK_PLAYER,
@@ -63,23 +64,48 @@ typedef struct SfxBankEntry {
typedef enum SfxId {
NA_SE_NONE, // Requesting a sfx with this id will play no sound
NA_SE_PL_BASE = 0x7FF,
#include "tables/sfx/playerbank_table.h"
NA_SE_PL_END,
NA_SE_IT_BASE = 0x17FF,
#include "tables/sfx/itembank_table.h"
NA_SE_IT_END,
NA_SE_EV_BASE = 0x27FF,
#include "tables/sfx/environmentbank_table.h"
NA_SE_EV_END,
NA_SE_EN_BASE = 0x37FF,
#include "tables/sfx/enemybank_table.h"
NA_SE_EN_END,
NA_SE_SY_BASE = 0x47FF,
#include "tables/sfx/systembank_table.h"
NA_SE_SY_END,
NA_SE_OC_BASE = 0x57FF,
#include "tables/sfx/ocarinabank_table.h"
NA_SE_OC_END,
NA_SE_VO_BASE = 0x67FF,
#include "tables/sfx/voicebank_table.h"
NA_SE_VO_END,
NA_SE_MAX
} SfxId;
// These limits are due to the way Sequence 0 is programmed. There is also a global limit of 512 entries for every bank
// enforced in Audio_PlayActiveSfx in sfx.c
static_assert(NA_SE_PL_END - (NA_SE_PL_BASE + 1) <= 256, "Player Bank SFX Table is limited to 256 entries due to Sequence 0");
static_assert(NA_SE_IT_END - (NA_SE_IT_BASE + 1) <= 128, "Item Bank SFX Table is limited to 128 entries due to Sequence 0");
static_assert(NA_SE_EV_END - (NA_SE_EV_BASE + 1) <= 256, "Environment Bank SFX Table is limited to 256 entries due to Sequence 0");
static_assert(NA_SE_EN_END - (NA_SE_EN_BASE + 1) <= 512, "Enemy Bank SFX Table is limited to 512 entries due to Sequence 0");
static_assert(NA_SE_SY_END - (NA_SE_SY_BASE + 1) <= 128, "System Bank SFX Table is limited to 128 entries due to Sequence 0");
static_assert(NA_SE_OC_END - (NA_SE_OC_BASE + 1) <= 128, "Ocarina Bank SFX Table is limited to 128 entries due to Sequence 0");
static_assert(NA_SE_VO_END - (NA_SE_VO_BASE + 1) <= 256, "Voice Bank SFX Table is limited to 256 entries due to Sequence 0");
#undef DEFINE_SFX
#define SFX_BANK_SHIFT(sfxId) (((sfxId) >> 12) & 0xFF)