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

One waveform of a bank, as the bank file records it. More...

#include <sample.h>

Public Member Functions

 Sample ()
 Construct a sample with the defaults Init() sets.
void Init ()
 Reset every field to zero.
int Unpack (const unsigned char *data)
 Read the sample from a serialised record.
int Pack (unsigned char *data) const
 Write the sample as a serialised record of the current version.
int PackedSize () const
 Report the size of a serialised record of the current version.
void Dump () const
 Print the sample to the console.
 Sample ()
 Create a sample and reset it.
void Init ()
 Reset every field to zero.
int FromStream (const unsigned char *data)
 Read the sample from its stream form.
int ToStream (unsigned char *data) const
 Write the sample in its stream form, as version 1.
void Dump () const
 Print the fields to the diagnostic stream.

Static Public Member Functions

static int StreamSize ()
 Report the size of the stream form.

Public Attributes

unsigned short mSampleRate
unsigned int mLoopStart
unsigned int mLoopEnd
unsigned int mOffset
int mLoopStart
int mLoopStop
int mSampleStart

Detailed Description

One waveform of a bank, as the bank file records it.

Playback parameters of one waveform of a bank, shared with the synthesiser on the IOP.

The class has no RTTI, and its name is inferred from its role. Offsets are bytes from the start of the bank's area in SPU2 memory. The serialised record is a version word followed by the fields in member order, with no padding.

The class has no RTTI, and its name is inferred from its source file. The record is 0x10 bytes. Its stream form is a version word followed by the fields, 0x12 bytes in all.

Constructor & Destructor Documentation

◆ Sample() [1/2]

Sample::Sample ( )

Construct a sample with the defaults Init() sets.

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

◆ Sample() [2/2]

Sample::Sample ( )

Create a sample and reset it.

Ghidra address:
0x1002a820

Member Function Documentation

◆ Init() [1/2]

void Sample::Init ( )

Reset every field to zero.

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

◆ Unpack()

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

Read the sample from a serialised record.

A record of an unknown version does not change the sample.

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

◆ Pack()

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

Write the sample as a serialised record of the current version.

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

◆ PackedSize()

int Sample::PackedSize ( ) const

Report the size of a serialised record of the current version.

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

◆ Dump() [1/2]

void Sample::Dump ( ) const

Print the sample to the console.

The body is empty.

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

◆ Init() [2/2]

void Sample::Init ( )

Reset every field to zero.

Ghidra address:
0x1002a83a

◆ FromStream()

int Sample::FromStream ( const unsigned char * data)

Read the sample from its stream form.

Only version 1 is accepted.

Parameters
dataThe stream form.
Returns
The number of bytes read.
Ghidra address:
0x1002a865

◆ ToStream()

int Sample::ToStream ( unsigned char * data) const

Write the sample in its stream form, as version 1.

Parameters
dataReceives StreamSize() bytes.
Returns
The number of bytes written.
Ghidra address:
0x1002a973

◆ StreamSize()

int Sample::StreamSize ( )
static

Report the size of the stream form.

Returns
The size in bytes.
Ghidra address:
0x1002aa33

◆ Dump() [2/2]

void Sample::Dump ( ) const

Print the fields to the diagnostic stream.

Ghidra address:
0x1002aa3d

Member Data Documentation

◆ mSampleRate

unsigned short Sample::mSampleRate

Rate in hertz at which the waveform plays at its base key.

◆ mLoopStart [1/2]

unsigned int Sample::mLoopStart

Start of the loop.

◆ mLoopEnd

unsigned int Sample::mLoopEnd

End of the loop, or zero for a one-shot waveform.

◆ mOffset

unsigned int Sample::mOffset

Start of the waveform.

◆ mLoopStart [2/2]

int Sample::mLoopStart

Start of the loop.

◆ mLoopStop

int Sample::mLoopStop

End of the loop, or zero for a one-shot waveform.

◆ mSampleStart

int Sample::mSampleStart

Offset of the waveform in the audio data file.


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