16 std::vector<std::uint8_t>
delta;
29 std::vector<std::uint8_t>
scale;
91 const int bank = (region >> 4) & 1;
101 return bank == 0 ? bank_a_base_ : bank_b_base_;
105 [[nodiscard]] std::int64_t
region_base(
int region)
const noexcept;
122 [[nodiscard]] std::optional<WaveStreams>
read_streams(
int region,
int loop,
int start)
const;
126 std::int64_t bank_a_base_ = 0;
127 std::int64_t bank_b_base_ = 0;
Read-only access to SCCore.dll as a data file.
Definition rom_image.hpp:39
WaveRom(const RomImage &rom)
Creates a wave-ROM view over an open image, which must outlive it.
std::int64_t bank_base(int bank) const noexcept
File offset of the first byte of a bank.
Definition wave_rom.hpp:99
std::int64_t region_base(int region) const noexcept
File offset of the base of a region, from a descriptor's region byte.
static constexpr int region_count(int bank) noexcept
Number of regions of real ROM data in a bank: 0 for bank A, 1 for bank B.
Definition wave_rom.hpp:78
static constexpr std::int32_t max_sample_count
Largest wave this class will attempt to read, as a sanity bound.
Definition wave_rom.hpp:55
static constexpr int bank_b_region_count
Regions of real ROM data in bank B — eight, not twelve.
Definition wave_rom.hpp:75
static constexpr int bank_a_region_count
Regions bank A spans: sixteen, the full width of the region nibble.
Definition wave_rom.hpp:67
static constexpr std::int32_t region_size
Size of one addressable ROM region, 1 MB.
Definition wave_rom.hpp:52
std::optional< WaveStreams > read_streams(int region, int loop, int start) const
Reads the delta and scale streams for one wave.
static constexpr SplitRegion split_region(int region) noexcept
Definition wave_rom.hpp:89
Definition control_decode.hpp:7
@ bank
Definition control_decode.hpp:26
@ loop
Forward loop. Rewinds the delta index and keeps the predictor.
Definition sampler.hpp:20
Splits a descriptor's region byte into a bank and a bank-relative region index.
Definition wave_rom.hpp:84
int bank
Definition wave_rom.hpp:85
int effective_region
Definition wave_rom.hpp:86
The two raw streams that make up one wave: a signed delta per sample, and a shift exponent per 16-sam...
Definition wave_rom.hpp:13
std::vector< std::uint8_t > delta
One signed byte per sample, sample_count + 1 long — the ping-pong sampler turns around on index sampl...
Definition wave_rom.hpp:16
std::vector< std::uint8_t > preamble_delta
The deltas between the 32-sample exponent-block boundary and the data start — scale_phase of them,...
Definition wave_rom.hpp:26
std::int32_t scale_phase
Where data_start falls inside its 32-sample exponent block, i.e.
Definition wave_rom.hpp:40
std::int32_t sample_count
Number of decodable samples.
Definition wave_rom.hpp:31
std::int32_t data_start
The descriptor's data start, exactly as given — not rounded to a block.
Definition wave_rom.hpp:33
std::vector< std::uint8_t > scale
Shift-exponent nibbles: byte i >> 5 holds the exponents for samples i, with the low nibble used when ...
Definition wave_rom.hpp:29