Exports MusicSong to Oracle of Secrets music_macros.asm format. More...
#include <asm_exporter.h>
Public Member Functions | |
| AsmExporter ()=default | |
| ~AsmExporter ()=default | |
| absl::StatusOr< std::string > | ExportSong (const MusicSong &song, const AsmExportOptions &options) |
| Export a song to ASM string. | |
| absl::Status | ExportToFile (const MusicSong &song, const std::string &path, const AsmExportOptions &options) |
| Export a song to a file. | |
Private Member Functions | |
| std::string | GenerateHeader (const MusicSong &song, const AsmExportOptions &options) |
| std::string | GenerateChannelPointers (const MusicSong &song, const AsmExportOptions &options) |
| std::string | GenerateChannelData (const MusicTrack &track, int channel_index, const AsmExportOptions &options) |
| std::string | ConvertEventToAsm (const TrackEvent &event, const AsmExportOptions &options, uint8_t ¤t_duration) |
| std::string | ConvertNoteToAsm (const Note ¬e, const AsmExportOptions &options, uint8_t ¤t_duration) |
| std::string | ConvertCommandToAsm (const MusicCommand &cmd, const AsmExportOptions &options) |
Static Private Member Functions | |
| static const char * | GetDurationConstant (uint8_t duration) |
| static std::string | GetNoteName (uint8_t pitch) |
| static const char * | GetInstrumentMacro (uint8_t instrument_id) |
| static const char * | GetCommandMacro (uint8_t opcode) |
| static int | GetCommandParamCount (uint8_t opcode) |
Exports MusicSong to Oracle of Secrets music_macros.asm format.
The exported ASM file can be assembled with asar and integrated into Oracle of Secrets or similar ROM hack music systems.
Output format follows the music_macros.asm conventions:
Definition at line 41 of file asm_exporter.h.
|
default |
|
default |
| absl::StatusOr< std::string > yaze::zelda3::music::AsmExporter::ExportSong | ( | const MusicSong & | song, |
| const AsmExportOptions & | options ) |
Export a song to ASM string.
| song | The song to export. |
| options | Export options. |
Definition at line 12 of file asm_exporter.cc.
References GenerateChannelData(), GenerateChannelPointers(), GenerateHeader(), yaze::zelda3::music::AsmExportOptions::include_comments, yaze::zelda3::music::MusicSong::name, and yaze::zelda3::music::MusicSong::segments.
Referenced by yaze::editor::MusicEditor::ExportSongToAsm(), and ExportToFile().

| absl::Status yaze::zelda3::music::AsmExporter::ExportToFile | ( | const MusicSong & | song, |
| const std::string & | path, | ||
| const AsmExportOptions & | options ) |
Export a song to a file.
| song | The song to export. |
| path | Output file path. |
| options | Export options. |
Definition at line 53 of file asm_exporter.cc.
References ExportSong().

|
private |
Definition at line 73 of file asm_exporter.cc.
References yaze::zelda3::music::AsmExportOptions::base_aram_address, yaze::zelda3::music::MusicSong::HasLoop(), and yaze::zelda3::music::AsmExportOptions::label_prefix.
Referenced by ExportSong().

|
private |
Definition at line 102 of file asm_exporter.cc.
References yaze::zelda3::music::AsmExportOptions::label_prefix, and yaze::zelda3::music::MusicSong::segments.
Referenced by ExportSong().
|
private |
Definition at line 129 of file asm_exporter.cc.
References ConvertEventToAsm(), and yaze::zelda3::music::MusicTrack::events.
Referenced by ExportSong().

|
private |
Definition at line 151 of file asm_exporter.cc.
References yaze::zelda3::music::TrackEvent::Command, yaze::zelda3::music::TrackEvent::command, ConvertCommandToAsm(), ConvertNoteToAsm(), yaze::zelda3::music::TrackEvent::End, yaze::zelda3::music::TrackEvent::Note, yaze::zelda3::music::TrackEvent::note, yaze::zelda3::music::TrackEvent::SubroutineCall, and yaze::zelda3::music::TrackEvent::type.
Referenced by GenerateChannelData().

|
private |
Definition at line 167 of file asm_exporter.cc.
References yaze::zelda3::music::Note::duration, GetDurationConstant(), GetNoteName(), yaze::zelda3::music::Note::has_duration_prefix, yaze::zelda3::music::Note::pitch, and yaze::zelda3::music::Note::velocity.
Referenced by ConvertEventToAsm().

|
private |
Definition at line 196 of file asm_exporter.cc.
References GetCommandMacro(), GetCommandParamCount(), GetInstrumentMacro(), yaze::zelda3::music::MusicCommand::GetParamCount(), yaze::zelda3::music::MusicCommand::opcode, yaze::zelda3::music::MusicCommand::params, and yaze::zelda3::music::AsmExportOptions::use_instrument_macros.
Referenced by ConvertEventToAsm().

|
staticprivate |
Definition at line 233 of file asm_exporter.cc.
References yaze::zelda3::music::kDurationConstants.
Referenced by ConvertNoteToAsm().
|
staticprivate |
Definition at line 242 of file asm_exporter.cc.
References yaze::zelda3::music::kNoteMaxPitch, yaze::zelda3::music::kNoteMinPitch, yaze::zelda3::music::kNoteRest, yaze::zelda3::music::kNoteTie, and yaze::zelda3::music::kTrackEnd.
Referenced by ConvertNoteToAsm().
|
staticprivate |
Definition at line 263 of file asm_exporter.cc.
References yaze::zelda3::music::kInstrumentMacros.
Referenced by ConvertCommandToAsm().
|
staticprivate |
Definition at line 272 of file asm_exporter.cc.
Referenced by ConvertCommandToAsm().
|
staticprivate |
Definition at line 305 of file asm_exporter.cc.
References yaze::zelda3::music::kCommandParamCount.
Referenced by ConvertCommandToAsm().