1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-10-19 13:09:58 +00:00

Clean up audio sample counts: bytes, samples, frames (#1289)

* Clean up bytes, samples, frames

* Improve macro usage

* More missed macros

* rename macro now that it crosses files

* redefine macros in terms of frames

* Another use of macro

* Fix, it's number of samples, not size

* Partial PR Suggestions

* Small change

* size to length

* Correct/Clarify comments

* remove comment

* More PR suggestions, cleanup

* Bad formatting, fixed
This commit is contained in:
engineer124 2022-07-27 15:53:56 -06:00 committed by GitHub
commit 423fec9f79
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 246 additions and 157 deletions

View file

@ -23,7 +23,24 @@
#define ADSR_GOTO -2
#define ADSR_RESTART -3
#define AIBUF_LEN 0x580
// size of a single sample point
#define SAMPLE_SIZE sizeof(s16)
// Samples are processed in groups of 16 called a "frame"
#define SAMPLES_PER_FRAME ADPCMFSIZE
// The length of one left/right channel is 13 frames
#define DMEM_1CH_SIZE (13 * SAMPLES_PER_FRAME * SAMPLE_SIZE)
// Both left and right channels
#define DMEM_2CH_SIZE (2 * DMEM_1CH_SIZE)
#define AIBUF_LEN (88 * SAMPLES_PER_FRAME) // number of samples
#define AIBUF_SIZE (AIBUF_LEN * SAMPLE_SIZE) // number of bytes
// Filter sizes
#define FILTER_SIZE (8 * SAMPLE_SIZE)
#define FILTER_BUF_PART1 (8 * SAMPLE_SIZE)
#define FILTER_BUF_PART2 (8 * SAMPLE_SIZE)
// Must be the same amount of samples as copied by aDuplicate() (audio microcode)
#define WAVE_SAMPLE_COUNT 64
@ -57,10 +74,10 @@ typedef enum {
} SampleMedium;
typedef enum {
/* 0 */ CODEC_ADPCM,
/* 1 */ CODEC_S8,
/* 0 */ CODEC_ADPCM, // 16 2-byte samples (32 bytes) compressed into 4-bit samples (8 bytes) + 1 header byte
/* 1 */ CODEC_S8, // 16 2-byte samples (32 bytes) compressed into 8-bit samples (16 bytes)
/* 2 */ CODEC_S16_INMEMORY,
/* 3 */ CODEC_SMALL_ADPCM,
/* 3 */ CODEC_SMALL_ADPCM, // 16 2-byte samples (32 bytes) compressed into 2-bit samples (4 bytes) + 1 header byte
/* 4 */ CODEC_REVERB,
/* 5 */ CODEC_S16
} SampleCodec;