summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTharo <17233964+Thar0@users.noreply.github.com>2024-12-14 00:26:36 +0000
committerGitHub <noreply@github.com>2024-12-13 19:26:36 -0500
commitdf5d4cb4673bc74d1e2f4d11cf6f5fe8376cd1df (patch)
tree296aba161061ee785f27ba49c641d0b1f49315d6 /include
parent4b20d8269b42b2892ef494afd0b6ccba78ba6c00 (diff)
[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
Diffstat (limited to 'include')
-rw-r--r--include/audio/aseq.h5
-rw-r--r--include/libc/assert.h2
-rw-r--r--include/sfx.h26
3 files changed, 29 insertions, 4 deletions
diff --git a/include/audio/aseq.h b/include/audio/aseq.h
index ac600738b..689c42664 100644
--- a/include/audio/aseq.h
+++ b/include/audio/aseq.h
@@ -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. */
diff --git a/include/libc/assert.h b/include/libc/assert.h
index 96393c0e7..dae8aeb65 100644
--- a/include/libc/assert.h
+++ b/include/libc/assert.h
@@ -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
diff --git a/include/sfx.h b/include/sfx.h
index 47a449e9c..16d0b122d 100644
--- a/include/sfx.h
+++ b/include/sfx.h
@@ -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)