Expand description
rustyn64-audio — the Audio Interface (AI) DAC + sample-DMA path.
The RSP’s audio microcode mixes samples into an RDRAM buffer; the AI then
DMAs that buffer out to the DAC at a programmable sample rate (set via the
AI_DACRATE divider off the video clock) and raises an AI interrupt when a
buffer starts playing (not when it drains — see Audio::write_reg).
This crate models the AI side; the actual mixing is RSP microcode (in
rustyn64-rsp), so under LLE the audio “falls out free” (ADR 0002).
The model follows the hardware description in
n64brew_wiki/markdown/Audio Interface.md and the reference behavior in
ares (ISC) ref-proj/ares/ares/n64/ai/: a two-deep DMA FIFO, the
delayed-carry address bug reproduced as a 13-bit/11-bit split with a
one-sample-deferred carry, the AI_LENGTH mirror on every write-only
register, and a DAC that decays toward silence on underrun.
Part of the one-directional chip-crate graph (see docs/architecture.md):
this crate does NOT depend on any other chip crate; it reaches RDRAM and the
interrupt line through the AudioBus trait. #![no_std] + alloc.
Structs§
- Audio
- Audio Interface state: the two-deep DMA FIFO, the DAC rate divider, and the derived-timing sample emission.
- Needs
Bus - Proof that a step needs the bus, produced only by
Audio::tick_without_busand consumed only byAudio::tick_with_bus. - Stereo
Sample - One stereo output frame (interleaved signed 16-bit L, R).
Enums§
- AiIrq
- The result an AI register write hands back to the Bus, which owns the MI interrupt lines the AI itself cannot name.
- Region
- The emulated console region, selecting the AI video clock.
Constants§
- MASTER_
HZ - The canonical master clock (
MASTER_HZ, ADR 0006), duplicated here because the chip-crate graph forbidsrustyn64-audiodepending onrustyn64-core. - VIDEO_
CLOCK_ NTSC - Video clock feeding the AI DAC divider on NTSC consoles (Hz).
- VIDEO_
CLOCK_ PAL - Video clock feeding the AI DAC divider on PAL consoles (Hz).
Traits§
- Audio
Bus - The narrow bus the AI sees (
RustyNES’sApuBusanalog): fetch a DMA sample word from RDRAM and raise the AI interrupt when a buffer starts.
Functions§
- version
- Returns the crate version string.