mirror of
https://github.com/zeldaret/oot.git
synced 2025-08-11 17:30:25 +00:00
[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:
parent
4b20d8269b
commit
df5d4cb467
39 changed files with 903 additions and 178 deletions
|
@ -138,8 +138,12 @@ f64_to_f80(double f64, uint8_t *f80)
|
|||
} f80tmp;
|
||||
|
||||
// get f64 bits
|
||||
|
||||
uint64_t f64_bits = *(uint64_t *)&f64;
|
||||
union {
|
||||
double f;
|
||||
uint64_t u;
|
||||
} tp;
|
||||
tp.f = f64;
|
||||
uint64_t f64_bits = tp.u;
|
||||
|
||||
int f64_sgn = F64_GET_SGN(f64_bits);
|
||||
int f64_exponent = F64_GET_EXP(f64_bits);
|
||||
|
@ -197,8 +201,12 @@ f80_to_f64(double *f64, uint8_t *f80)
|
|||
((uint64_t)f64_mantissa_hi << 32) | ((uint64_t)f64_mantissa_lo);
|
||||
|
||||
// write double
|
||||
|
||||
*f64 = *(double *)&f64_bits;
|
||||
union {
|
||||
double f;
|
||||
uint64_t u;
|
||||
} tp;
|
||||
tp.u = f64_bits;
|
||||
*f64 = tp.f;
|
||||
}
|
||||
|
||||
int
|
||||
|
@ -309,6 +317,8 @@ aiff_aifc_common_read(container_data *out, FILE *in, UNUSED bool matching, uint3
|
|||
nloops += inst.sustainLoop.playMode != LOOP_PLAYMODE_NONE;
|
||||
nloops += inst.releaseLoop.playMode != LOOP_PLAYMODE_NONE;
|
||||
|
||||
out->num_loops = nloops;
|
||||
out->loops = NULL;
|
||||
if (nloops != 0) {
|
||||
out->loops = MALLOC_CHECKED_INFO(nloops * sizeof(container_loop), "nloops=%lu", nloops);
|
||||
|
||||
|
@ -495,11 +505,21 @@ aiff_aifc_common_read(container_data *out, FILE *in, UNUSED bool matching, uint3
|
|||
|
||||
if (!has_comm)
|
||||
error("aiff/aifc has no COMM chunk");
|
||||
if (!has_inst)
|
||||
error("aiff/aifc has no INST chunk");
|
||||
if (!has_ssnd)
|
||||
error("aiff/aifc has no SSND chunk");
|
||||
|
||||
if (!has_inst) {
|
||||
out->base_note = 60; // C4
|
||||
out->fine_tune = 0;
|
||||
out->key_low = 0;
|
||||
out->key_hi = 127;
|
||||
out->vel_low = 0;
|
||||
out->vel_hi = 127;
|
||||
out->gain = 0;
|
||||
out->num_loops = 0;
|
||||
out->loops = NULL;
|
||||
}
|
||||
|
||||
if (out->data_type == SAMPLE_TYPE_PCM16) {
|
||||
assert(out->data_size % 2 == 0);
|
||||
assert(out->bit_depth == 16);
|
||||
|
|
|
@ -222,6 +222,7 @@ wav_read(container_data *out, const char *path, UNUSED bool matching)
|
|||
smpl.sampler_data = le32toh(smpl.sampler_data);
|
||||
|
||||
out->num_loops = smpl.num_sample_loops;
|
||||
out->loops = NULL;
|
||||
if (out->num_loops != 0) {
|
||||
out->loops =
|
||||
MALLOC_CHECKED_INFO(out->num_loops * sizeof(container_loop), "num_loops=%u", out->num_loops);
|
||||
|
@ -362,11 +363,11 @@ wav_read(container_data *out, const char *path, UNUSED bool matching)
|
|||
if (!has_inst) {
|
||||
out->base_note = 60; // C4
|
||||
out->fine_tune = 0;
|
||||
out->gain = 0;
|
||||
out->key_low = 0;
|
||||
out->key_hi = 0;
|
||||
out->key_hi = 127;
|
||||
out->vel_low = 0;
|
||||
out->vel_hi = 0;
|
||||
out->vel_hi = 127;
|
||||
out->gain = 0;
|
||||
}
|
||||
|
||||
if (!has_smpl) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue