Serializer for N-SPC music data to ROM format. More...
#include <spc_parser.h>
Classes | |
| struct | SerializeOptions |
| Serialization options. More... | |
| struct | SerializeResult |
| Result of serialization with relocation info. More... | |
Public Member Functions | |
| SpcSerializer ()=default | |
| ~SpcSerializer ()=default | |
Static Public Member Functions | |
| static absl::StatusOr< SerializeResult > | SerializeSong (const MusicSong &song, uint16_t base_address) |
| Serialize a complete song to binary format. | |
| static std::vector< uint8_t > | SerializeTrack (const MusicTrack &track) |
| Serialize a single track to binary format. | |
| static int | CalculateRequiredSpace (const MusicSong &song) |
| Calculate the space required for a song. | |
| static std::vector< uint8_t > | SerializeNote (const Note ¬e, uint8_t *current_duration) |
| Serialize a note event. | |
| static std::vector< uint8_t > | SerializeCommand (const MusicCommand &command) |
| Serialize a command event. | |
| static void | ApplyBaseAddress (SerializeResult *result, uint16_t new_base_address) |
| Adjust all serialized pointers to a new base address. | |
| static absl::StatusOr< SerializeResult > | SerializeSong (const MusicSong &song, uint16_t base_address) |
| static absl::StatusOr< SerializeResult > | SerializeSongFromSegment (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 ¬e, uint8_t *current_duration) |
| static std::vector< uint8_t > | SerializeCommand (const MusicCommand &command) |
Serializer for N-SPC music data to ROM format.
Serializes MusicSong to N-SPC byte format for direct ARAM upload.
This class handles converting the internal song representation back to the binary format expected by the SNES APU.
Produces a complete sound bank block that can be uploaded to ARAM:
This enables preview of custom songs without saving to ROM first.
Definition at line 175 of file spc_parser.h.
|
default |
|
default |
|
static |
Serialize a complete song to binary format.
| song | The song to serialize. |
| base_address | The target SPC address. |
Definition at line 9 of file spc_serializer.cc.
References yaze::zelda3::music::SpcSerializer::SerializeResult::base_address, yaze::zelda3::music::SpcSerializer::SerializeResult::data, yaze::zelda3::music::MusicSong::HasLoop(), yaze::zelda3::music::MusicSong::loop_point, yaze::zelda3::music::SpcSerializer::SerializeResult::relocations, yaze::zelda3::music::MusicSong::segments, and SerializeTrack().
Referenced by yaze::editor::music::MusicPlayer::PreviewCustomSong(), yaze::editor::music::MusicPlayer::PreviewSegment(), yaze::zelda3::music::MusicBank::SaveSongTable(), and SerializeSongFromSegment().

|
static |
Serialize a single track to binary format.
| track | The track to serialize. |
Definition at line 159 of file spc_serializer.cc.
References yaze::zelda3::music::TrackEvent::Command, yaze::zelda3::music::TrackEvent::End, yaze::zelda3::music::MusicTrack::events, yaze::zelda3::music::kTrackEnd, yaze::zelda3::music::TrackEvent::Note, SerializeCommand(), and SerializeNote().
Referenced by CalculateRequiredSpace(), and SerializeSong().

|
static |
Calculate the space required for a song.
| song | The song to measure. |
Definition at line 194 of file spc_serializer.cc.
References yaze::zelda3::music::MusicSong::HasLoop(), yaze::zelda3::music::MusicSong::segments, and SerializeTrack().

|
static |
Serialize a note event.
| note | The note to serialize. |
| current_duration | The current duration state. |
Definition at line 215 of file spc_serializer.cc.
References yaze::zelda3::music::Note::duration, yaze::zelda3::music::Note::has_duration_prefix, yaze::zelda3::music::Note::pitch, and yaze::zelda3::music::Note::velocity.
Referenced by SerializeTrack().
|
static |
Serialize a command event.
| command | The command to serialize. |
Definition at line 236 of file spc_serializer.cc.
References yaze::zelda3::music::MusicCommand::GetParamCount(), yaze::zelda3::music::MusicCommand::opcode, and yaze::zelda3::music::MusicCommand::params.
Referenced by SerializeTrack().

|
static |
Adjust all serialized pointers to a new base address.
| result | Serialized blob to patch (in-place). |
| new_base_address | Target SPC base address. |
Definition at line 249 of file spc_serializer.cc.
References yaze::zelda3::music::SpcSerializer::SerializeResult::base_address, yaze::zelda3::music::SpcSerializer::SerializeResult::data, and yaze::zelda3::music::SpcSerializer::SerializeResult::relocations.
Referenced by yaze::zelda3::music::MusicBank::SaveSongTable().
|
static |
|
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 123 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().

|
static |
|
static |
|
staticprivate |
|
staticprivate |
|
staticprivate |