wavelength 1.0.0
Loading...
Searching...
No Matches
SampleDesc Class Reference

How a program plays one sample over a key range, as the bank file records it. More...

#include <sampledesc.h>

Inheritance diagram for SampleDesc:

Public Member Functions

 SampleDesc ()
 Construct a descriptor with the defaults Init() sets.
void Init ()
 Reset every field to its default.
int Pack (unsigned char *data) const
 Write the descriptor as a serialised record of version 3.
int PackedSize () const
 Report the size of a serialised record of version 3.
int Unpack (const unsigned char *data)
 Read the descriptor from a serialised record of version 1, 2, or 3.
void Validate ()
 Check the descriptor after Unpack().
void Dump () const
 Print every field to the console.

Public Attributes

unsigned char mLowKeymap
unsigned char mHighKeymap
unsigned char mBaseKey
signed char mTranspose
signed char mFineTranspose
unsigned char mAttackRate
unsigned short mAttackMode
unsigned char mDecayRate
unsigned char mSusLevel
unsigned char mSusRate
unsigned short mSusMode
unsigned char mReleaseRate
unsigned short mReleaseMode
unsigned char mVolume
unsigned char mPan
unsigned short mSampleIndex
unsigned short mBus
unsigned short mBusMode
signed char mSurround

Detailed Description

How a program plays one sample over a key range, as the bank file records it.

The class has no RTTI. Its name is inferred from the iSd the dump prints, and the member names are the ones the dump prints. The envelope fields store the SPU2 ADSR rates and modes. The serialised record is a version word followed by the fields in a fixed order with no padding. Version 1 stops after mSampleIndex, version 2 adds mBus and mBusMode, and version 3 adds mSurround.

Constructor & Destructor Documentation

◆ SampleDesc()

SampleDesc::SampleDesc ( )

Construct a descriptor with the defaults Init() sets.

Ghidra address:
NTSC-U/C: 0x00001678
Ghidra address:
PAL: 0x00001678

Member Function Documentation

◆ Init()

void SampleDesc::Init ( )

Reset every field to its default.

Ghidra address:
NTSC-U/C: 0x000016a0
Ghidra address:
PAL: 0x000016a0

◆ Pack()

int SampleDesc::Pack ( unsigned char * data) const

Write the descriptor as a serialised record of version 3.

Parameters
dataReceives the record, at any alignment.
Returns
The bytes written.
Ghidra address:
NTSC-U/C: 0x00001704
Ghidra address:
PAL: 0x00001704

◆ PackedSize()

int SampleDesc::PackedSize ( ) const

Report the size of a serialised record of version 3.

Returns
The size in bytes.
Ghidra address:
NTSC-U/C: 0x0000183c
Ghidra address:
PAL: 0x0000183c

◆ Unpack()

int SampleDesc::Unpack ( const unsigned char * data)

Read the descriptor from a serialised record of version 1, 2, or 3.

Fields a version does not record retain their defaults. A record of an unknown version does not change the descriptor.

Parameters
dataThe record, at any alignment.
Returns
The bytes consumed, four for an unknown version.
Ghidra address:
NTSC-U/C: 0x00001844
Ghidra address:
PAL: 0x00001844

◆ Validate()

void SampleDesc::Validate ( )

Check the descriptor after Unpack().

The body is empty.

Ghidra address:
NTSC-U/C: 0x00001670
Ghidra address:
PAL: 0x00001670

◆ Dump()

void SampleDesc::Dump ( ) const

Print every field to the console.

Ghidra address:
NTSC-U/C: 0x00001cd4
Ghidra address:
PAL: 0x00001cd4

Member Data Documentation

◆ mLowKeymap

unsigned char SampleDesc::mLowKeymap

Lowest note the descriptor plays.

◆ mHighKeymap

unsigned char SampleDesc::mHighKeymap

Highest note the descriptor plays.

◆ mBaseKey

unsigned char SampleDesc::mBaseKey

Note at which the sample plays at its sample rate.

◆ mTranspose

signed char SampleDesc::mTranspose

Transposition in semitones.

◆ mFineTranspose

signed char SampleDesc::mFineTranspose

Transposition in cents.

◆ mAttackRate

unsigned char SampleDesc::mAttackRate

ADSR attack rate.

◆ mAttackMode

unsigned short SampleDesc::mAttackMode

Nonzero for an exponential attack.

◆ mDecayRate

unsigned char SampleDesc::mDecayRate

ADSR decay rate.

◆ mSusLevel

unsigned char SampleDesc::mSusLevel

ADSR sustain level.

◆ mSusRate

unsigned char SampleDesc::mSusRate

ADSR sustain rate.

◆ mSusMode

unsigned short SampleDesc::mSusMode

ADSR sustain mode, zero to three.

◆ mReleaseRate

unsigned char SampleDesc::mReleaseRate

ADSR release rate.

◆ mReleaseMode

unsigned short SampleDesc::mReleaseMode

Nonzero for an exponential release.

◆ mVolume

unsigned char SampleDesc::mVolume

Volume, an index into the volume curve.

◆ mPan

unsigned char SampleDesc::mPan

Pan offset, where 64 is the centre.

◆ mSampleIndex

unsigned short SampleDesc::mSampleIndex

Index of the sample in its bank.

◆ mBus

unsigned short SampleDesc::mBus

Core the voice prefers when the channel defers to it.

◆ mBusMode

unsigned short SampleDesc::mBusMode

Dry and reverb mix when the channel defers to it.

◆ mSurround

signed char SampleDesc::mSurround

Nonzero to invert one side for the surround decoder.


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