yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
yaze::zelda3::music::BrrCodec Class Reference

BRR sample encoder/decoder. More...

#include <spc_parser.h>

Static Public Member Functions

static std::vector< int16_t > Decode (const std::vector< uint8_t > &brr_data, int *loop_start=nullptr)
 Decode BRR data to PCM samples.
 
static std::vector< uint8_t > Encode (const std::vector< int16_t > &pcm_data, int loop_start=-1)
 Encode PCM samples to BRR format.
 

Static Private Attributes

static constexpr int kFilter1 [4] = {0, 15, 61, 115}
 
static constexpr int kFilter2 [4] = {0, 4, 5, 6}
 
static constexpr int kFilter3 [4] = {0, 0, 15, 13}
 

Detailed Description

BRR sample encoder/decoder.

Handles conversion between PCM audio and the SNES BRR format.

Definition at line 247 of file spc_parser.h.

Member Function Documentation

◆ Decode()

std::vector< int16_t > yaze::zelda3::music::BrrCodec::Decode ( const std::vector< uint8_t > & brr_data,
int * loop_start = nullptr )
static

Decode BRR data to PCM samples.

Parameters
brr_dataThe BRR-encoded data.
loop_startReceives the loop start point.
Returns
Decoded 16-bit PCM samples.

Definition at line 420 of file spc_parser.cc.

References kFilter1, kFilter2, and kFilter3.

Referenced by yaze::zelda3::music::MusicBank::LoadSamples().

◆ Encode()

std::vector< uint8_t > yaze::zelda3::music::BrrCodec::Encode ( const std::vector< int16_t > & pcm_data,
int loop_start = -1 )
static

Encode PCM samples to BRR format.

Parameters
pcm_dataThe source PCM samples.
loop_startLoop start point (-1 for no loop).
Returns
BRR-encoded data.

Definition at line 489 of file spc_parser.cc.

References kFilter1, kFilter2, and kFilter3.

Member Data Documentation

◆ kFilter1

constexpr int yaze::zelda3::music::BrrCodec::kFilter1[4] = {0, 15, 61, 115}
staticconstexprprivate

Definition at line 269 of file spc_parser.h.

Referenced by Decode(), and Encode().

◆ kFilter2

constexpr int yaze::zelda3::music::BrrCodec::kFilter2[4] = {0, 4, 5, 6}
staticconstexprprivate

Definition at line 270 of file spc_parser.h.

Referenced by Decode(), and Encode().

◆ kFilter3

constexpr int yaze::zelda3::music::BrrCodec::kFilter3[4] = {0, 0, 15, 13}
staticconstexprprivate

Definition at line 271 of file spc_parser.h.

Referenced by Decode(), and Encode().


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