Tabula Sonora 0.1.0
A native C++20 implementation of the Roland Sound Canvas VA synth voice
Loading...
Searching...
No Matches
ts::WaveDescriptor Struct Reference

One entry of the wave-descriptor table: where a sample lives in the wave ROM, how it is tuned, and how it loops. More...

#include <tabulasonora/wave_descriptor.hpp>

Public Member Functions

constexpr int bank () const noexcept
 ROM bank: 0 for bank A, 1 for bank B.
constexpr bool reverse () const noexcept
 True when the sampler plays this wave backwards.
constexpr bool ping_pong () const noexcept
 True when the sampler plays this wave bidirectionally (ping-pong).
constexpr double native_pitch () const noexcept
 Native pitch in semitones — the effective root, including fine tune.

Static Public Member Functions

static constexpr WaveDescriptor parse (std::span< const std::uint8_t > record) noexcept
 Parses a descriptor from its stride raw bytes.

Public Attributes

int region = 0
 ROM region, 0–127. Bit 4 selects the bank.
int loop = 0
 Start of the sample data — delta index zero.
int end = 0
 The loop point.
int start = 0
 The physical end of the data.
int root_key = 0
 MIDI note at which the sample plays back untransposed.
int fine_tune = 0
 Fine-tune word; native pitch is root_key + (1024 - fine_tune) / 1000.
int flags = 0
 Raw flag byte.

Static Public Attributes

static constexpr int stride = 0x16
 Bytes per descriptor record.

Friends

constexpr bool operator== (const WaveDescriptor &, const WaveDescriptor &) noexcept=default

Detailed Description

One entry of the wave-descriptor table: where a sample lives in the wave ROM, how it is tuned, and how it loops.

The field names are as recovered and they are genuinely confusing: loop is the data start, end is the loop point, and start is the physical end. They are kept rather than renamed so the code lines up with the reverse-engineering notes and the trace dumps.

Member Function Documentation

◆ bank()

int ts::WaveDescriptor::bank ( ) const
inlinenodiscardconstexprnoexcept

ROM bank: 0 for bank A, 1 for bank B.

◆ reverse()

bool ts::WaveDescriptor::reverse ( ) const
inlinenodiscardconstexprnoexcept

True when the sampler plays this wave backwards.

◆ ping_pong()

bool ts::WaveDescriptor::ping_pong ( ) const
inlinenodiscardconstexprnoexcept

True when the sampler plays this wave bidirectionally (ping-pong).

◆ native_pitch()

double ts::WaveDescriptor::native_pitch ( ) const
inlinenodiscardconstexprnoexcept

Native pitch in semitones — the effective root, including fine tune.

◆ parse()

constexpr WaveDescriptor ts::WaveDescriptor::parse ( std::span< const std::uint8_t > record)
inlinestaticnodiscardconstexprnoexcept

Parses a descriptor from its stride raw bytes.

◆ operator==

bool operator== ( const WaveDescriptor & ,
const WaveDescriptor &  )
friend

Member Data Documentation

◆ stride

int ts::WaveDescriptor::stride = 0x16
staticconstexpr

Bytes per descriptor record.

◆ region

int ts::WaveDescriptor::region = 0

ROM region, 0–127. Bit 4 selects the bank.

◆ loop

int ts::WaveDescriptor::loop = 0

Start of the sample data — delta index zero.

◆ end

int ts::WaveDescriptor::end = 0

The loop point.

◆ start

int ts::WaveDescriptor::start = 0

The physical end of the data.

◆ root_key

int ts::WaveDescriptor::root_key = 0

MIDI note at which the sample plays back untransposed.

◆ fine_tune

int ts::WaveDescriptor::fine_tune = 0

Fine-tune word; native pitch is root_key + (1024 - fine_tune) / 1000.

◆ flags

int ts::WaveDescriptor::flags = 0

Raw flag byte.

Bit 0 is bidirectional, bit 2 is reverse; bit 1 takes no part in the dispatch.


The documentation for this struct was generated from the following file: