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

Serializes MusicSong to N-SPC byte format for direct ARAM upload. More...

#include <spc_serializer.h>

Classes

struct  SerializeOptions
 Serialization options. More...
 
struct  SerializeResult
 Serialization result. More...
 

Public Member Functions

 SpcSerializer ()=default
 
 ~SpcSerializer ()=default
 

Static Public Member Functions

static absl::StatusOr< SerializeResultSerializeSong (const MusicSong &song, uint16_t base_address)
 
static absl::StatusOr< SerializeResultSerializeSongFromSegment (const MusicSong &song, int start_segment, uint16_t base_address)
 Serialize a song starting from a specific segment (for seeking).
 
static void ApplyBaseAddress (SerializeResult *result, uint16_t new_base_address)
 
static int CalculateRequiredSpace (const MusicSong &song)
 

Static Private Member Functions

static std::vector< uint8_t > SerializeTrack (const MusicTrack &track)
 
static std::vector< uint8_t > SerializeNote (const Note &note, uint8_t *current_duration)
 
static std::vector< uint8_t > SerializeCommand (const MusicCommand &command)
 

Detailed Description

Serializes MusicSong to N-SPC byte format for direct ARAM upload.

Produces a complete sound bank block that can be uploaded to ARAM:

  • Song header (section pointers)
  • Channel pointer table
  • Channel data (notes, commands, durations)

This enables preview of custom songs without saving to ROM first.

Definition at line 25 of file spc_serializer.h.

Constructor & Destructor Documentation

◆ SpcSerializer()

yaze::zelda3::music::SpcSerializer::SpcSerializer ( )
default

◆ ~SpcSerializer()

yaze::zelda3::music::SpcSerializer::~SpcSerializer ( )
default

Member Function Documentation

◆ SerializeSong()

◆ SerializeSongFromSegment()

absl::StatusOr< SpcSerializer::SerializeResult > yaze::zelda3::music::SpcSerializer::SerializeSongFromSegment ( const MusicSong & song,
int start_segment,
uint16_t base_address )
static

Serialize a song starting from a specific segment (for seeking).

Creates song data starting from segment_index, allowing playback to resume from a specific point in the song.

Definition at line 122 of file spc_serializer.cc.

References yaze::zelda3::music::MusicSong::bank, yaze::zelda3::music::MusicSong::HasLoop(), yaze::zelda3::music::MusicSong::loop_point, yaze::zelda3::music::MusicSong::name, yaze::zelda3::music::MusicSong::segments, and SerializeSong().

Here is the call graph for this function:

◆ ApplyBaseAddress()

◆ CalculateRequiredSpace()

int yaze::zelda3::music::SpcSerializer::CalculateRequiredSpace ( const MusicSong & song)
static

Definition at line 194 of file spc_serializer.cc.

References yaze::zelda3::music::MusicSong::HasLoop(), yaze::zelda3::music::MusicSong::segments, and SerializeTrack().

Here is the call graph for this function:

◆ SerializeTrack()

std::vector< uint8_t > yaze::zelda3::music::SpcSerializer::SerializeTrack ( const MusicTrack & track)
staticprivate

◆ SerializeNote()

std::vector< uint8_t > yaze::zelda3::music::SpcSerializer::SerializeNote ( const Note & note,
uint8_t * current_duration )
staticprivate

◆ SerializeCommand()

std::vector< uint8_t > yaze::zelda3::music::SpcSerializer::SerializeCommand ( const MusicCommand & command)
staticprivate

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