#[non_exhaustive]pub enum ApuSnapshotError {
Truncated(usize),
TrailingBytes(usize),
UnsupportedVersion(u8),
InvalidRegion(u8),
InvalidMode(u8),
InvalidPresence(u8),
FieldOutOfRange {
field: &'static str,
value: u8,
max: u8,
},
InvalidResampler(&'static str),
}Expand description
Errors returned by Apu::restore.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Truncated(usize)
Blob is shorter than the schema declares.
TrailingBytes(usize)
Blob is longer than the schema declares: this many bytes follow the
last field (v2.9.8; until then reported as Self::Truncated).
UnsupportedVersion(u8)
The blob’s version byte is not understood by this build.
InvalidRegion(u8)
Region tag was not 0/1/2.
InvalidMode(u8)
Frame-counter mode tag was not 0/1.
InvalidPresence(u8)
Optional sample-buffer presence byte was not 0/1.
FieldOutOfRange
A register-width field held a value its hardware register cannot.
Several of these index fixed tables on the next tick (duty and step
into the duty table, the triangle step into its 32-step sequence) or
flow into one (decay, a constant-volume volume_or_period and the DMC
dac sum into the mixer’s 31- and 203-entry lookup tables), so an
unchecked value restores cleanly and then panics one CPU cycle later.
The rest (sweep, DMC rate / bit count) cannot panic today but are
bounded to the same register width so that no field of the restored
state is one the emulator itself could never have written. Core audit
IMP-02.
Fields
InvalidResampler(&'static str)
A floating-point resampler or filter field was not usable.
The band-limited resampler advances phase by sample_rate / cpu_rate
per CPU cycle and emits one host sample per whole unit crossed, so a
zero, negative, non-finite or merely huge ratio does not panic: it hangs
the emulation thread in that loop, or fills the host audio with NaN.
Core audit IMP-02.
Trait Implementations§
Source§impl Debug for ApuSnapshotError
impl Debug for ApuSnapshotError
Source§impl Display for ApuSnapshotError
impl Display for ApuSnapshotError
Source§impl Error for ApuSnapshotError
impl Error for ApuSnapshotError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()