mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-20 16:49:58 -04:00
Log a splitter framing fault met while the update is applied as the rest of the section left out, not as a refused update.
The review found that audio_mixer.c splitters_walk used AUDIO_REFUSE for a framing fault in both of its walks. In the
apply walk (audio_mixer_update_routing, after audio_mixer_routing_check's walk passed) such a fault can only come from
the game rewriting its input during its own RequestUpdate. The update is taken by then: it is answered 0, its voices
and effects and the splitter records before the fault are applied, and the mix section is applied after it. Yet the
log said "RequestUpdate refused with 0x5299 ...; the renderer goes on with the last update it took". SPL_FAULT now
refuses the update in the check walk as before, and in the apply walk logs the fault with "the rest of the splitter
section is left out". The same double read of the mix section by audio_mixer_mix_layout_check and
audio_mixer_update_routing stays as it is; its comment now says the check holds for the apply only because the game
does not rewrite its input during its own RequestUpdate. docs/building.md's audio_params_check paragraph names the new
case and is wrapped again at 120 columns.
Not reproduced before the change: the game's sending thread waits in the IPC call, so neither case has a known way to
happen. A new case in tests/audio_params_check calls audio_mixer_update_routing with a splitter section whose first
destination record's magic is broken after a valid update. It checks that the splitter info before the fault and the
mix section are applied, that the destination record is not, and that the one log line names the rest of the section
left out. It failed on the code before this change ("RequestUpdate refused with 0x5299: splitter destination 0 ...
not SNDD"). audio_params_check (27 refused updates, 11 left-out records, 38 effects and sinks, both strict runs),
check_content, a compile of every runtime file and -Wall -Wextra on the audio files and cfg.c with no warnings passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -667,6 +667,34 @@ static void left_out_records(void) {
|
||||
CHECK(apply(r, &u) == 0 && r->mixes[1].volume == 0.5f, "the valid changed mix next to mix 5 is applied");
|
||||
CHECK(left_out(r, lines, AB_MIX_ID), "mix 5 is logged once (%s)", last_once);
|
||||
close_renderer(r);
|
||||
|
||||
/* A splitter section whose framing breaks between audio_mixer_routing_check's walk and the apply walk (the game
|
||||
rewriting its input during its own RequestUpdate): audio_mixer_update_routing is called directly, as
|
||||
audren.c request_update calls it once the update was taken. The splitter info before the fault and the mix
|
||||
section after it are applied, the destination record at the fault is not, and the log says the rest of the
|
||||
splitter section is left out, not that the update was refused. */
|
||||
r = open_renderer();
|
||||
update_default(&u, 11);
|
||||
u.split_bytes = splitter_section(u.split, 11, 0, 2, both_ids, 2, both_dests);
|
||||
apply(r, &u);
|
||||
lines = once_lines;
|
||||
dest0 = ((Mixer *)r->mixer)->dest[0];
|
||||
const int32_t swapped[2] = {1, 0};
|
||||
Dest dq[2] = {both_dests[0], both_dests[1]};
|
||||
dq[0].volume = 0.25f;
|
||||
u.split_bytes = splitter_section(u.split, 11, 0, 2, swapped, 2, dq);
|
||||
u.split[0x44] = 'X'; /* the first destination record's magic, after the splitter info and its 2 ids */
|
||||
u.mix[1].volume = 0.5f;
|
||||
build(&u);
|
||||
audio_mixer_update_routing(r, in + L.splitters, u.split_bytes, in + L.mixes, 2 * sizeof(AudrenMixIn), 2);
|
||||
CHECK(split_is(r, 1, 0) && r->mixes[1].volume == 0.5f,
|
||||
"a fault in the apply walk: the splitter info before it and the mix section are applied");
|
||||
CHECK(!memcmp(&dest0, &((Mixer *)r->mixer)->dest[0], sizeof dest0),
|
||||
"a fault in the apply walk: the destination record at the fault is left out");
|
||||
CHECK(left_out(r, lines, AB_DEST_MAGIC) && strstr(last_once, "the rest of the splitter section is left out") &&
|
||||
!strstr(last_once, "refused"),
|
||||
"a fault in the apply walk is logged once as the rest of the section left out (%s)", last_once);
|
||||
close_renderer(r);
|
||||
}
|
||||
|
||||
/* 4. Effects and sinks the renderer cannot use: passed through or skipped in each render pass. */
|
||||
@@ -923,6 +951,6 @@ int main(int argc, char **argv) {
|
||||
effects_left_out();
|
||||
in_range_quiet();
|
||||
printf("audio_params_check: %s (%d refused updates, %d left-out records, %d effects and sinks)\n",
|
||||
fails ? "FAIL" : "ok", R_ROWS, 10, EFFECT_ROWS);
|
||||
fails ? "FAIL" : "ok", R_ROWS, 11, EFFECT_ROWS);
|
||||
return fails ? 1 : 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user