yaze 0.3.2
Link to the Past ROM Editor
 
Loading...
Searching...
No Matches
music_editor.h
Go to the documentation of this file.
1#ifndef YAZE_APP_EDITOR_MUSIC_EDITOR_H
2#define YAZE_APP_EDITOR_MUSIC_EDITOR_H
3
5#include "app/editor/editor.h"
6#include "app/emu/audio/apu.h"
7#include "app/rom.h"
9#include "imgui/imgui.h"
10
11namespace yaze {
12
13// Forward declaration
14namespace emu {
15class Emulator;
16}
17
18namespace editor {
19
20static const char* kGameSongs[] = {"Title",
21 "Light World",
22 "Beginning",
23 "Rabbit",
24 "Forest",
25 "Intro",
26 "Town",
27 "Warp",
28 "Dark world",
29 "Master sword",
30 "File select",
31 "Soldier",
32 "Mountain",
33 "Shop",
34 "Fanfare",
35 "Castle",
36 "Palace (Pendant)",
37 "Cave (Same as Secret Way)",
38 "Clear (Dungeon end)",
39 "Church",
40 "Boss",
41 "Dungeon (Crystal)",
42 "Psychic",
43 "Secret Way (Same as Cave)",
44 "Rescue",
45 "Crystal",
46 "Fountain",
47 "Pyramid",
48 "Kill Agahnim",
49 "Ganon Room",
50 "Last Boss"};
51
52static constexpr absl::string_view kSongNotes[] = {
53 "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C",
54 "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A", "A#", "B", "C"};
55
56const ImGuiTableFlags toolset_table_flags_ = ImGuiTableFlags_SizingFixedFit;
57const ImGuiTableFlags music_editor_flags_ = ImGuiTableFlags_SizingFixedFit |
58 ImGuiTableFlags_Resizable |
59 ImGuiTableFlags_Reorderable;
64class MusicEditor : public Editor {
65 public:
66 explicit MusicEditor(Rom* rom = nullptr) : rom_(rom) {
68 }
69
70 void Initialize() override;
71 absl::Status Load() override;
72 absl::Status Save() override { return absl::UnimplementedError("Save"); }
73 absl::Status Update() override;
74 absl::Status Cut() override { return absl::UnimplementedError("Cut"); }
75 absl::Status Copy() override { return absl::UnimplementedError("Copy"); }
76 absl::Status Paste() override { return absl::UnimplementedError("Paste"); }
77 absl::Status Undo() override { return absl::UnimplementedError("Undo"); }
78 absl::Status Redo() override { return absl::UnimplementedError("Redo"); }
79 absl::Status Find() override { return absl::UnimplementedError("Find"); }
80
81 // Set the ROM pointer
82 void set_rom(Rom* rom) { rom_ = rom; }
83
84 // Get the ROM pointer
85 Rom* rom() const { return rom_; }
86
87 // Emulator integration for live audio playback
89 emu::Emulator* emulator() const { return emulator_; }
90
91 // Audio control methods
92 void PlaySong(int song_id);
93 void StopSong();
94 void SetVolume(float volume); // 0.0 to 1.0
95
96 private:
97 // UI Drawing Methods
101 void DrawToolset();
102
103 // Playback Control
107
110 // Note: APU requires ROM memory, will be initialized when needed
111
112 // UI State
116 bool is_playing_ = false;
117 std::vector<bool> channel_muted_ = std::vector<bool>(8, false);
118 std::vector<bool> channel_soloed_ = std::vector<bool>(8, false);
119 std::vector<std::string> song_names_;
120
121 ImGuiTableFlags music_editor_flags_ =
122 ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter |
123 ImGuiTableFlags_BordersV | ImGuiTableFlags_SizingFixedFit;
124
125 ImGuiTableFlags toolset_table_flags_ =
126 ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_BordersOuter |
127 ImGuiTableFlags_BordersV | ImGuiTableFlags_PadOuterX;
128
130 emu::Emulator* emulator_ = nullptr; // For live audio playback
131};
132
133} // namespace editor
134} // namespace yaze
135
136#endif
The Rom class is used to load, save, and modify Rom data.
Definition rom.h:71
Text editor for modifying assembly code.
Interface for editor classes.
Definition editor.h:82
EditorType type_
Definition editor.h:123
A class for editing music data in a Rom.
absl::Status Find() override
std::vector< bool > channel_soloed_
zelda3::music::Tracker music_tracker_
emu::Emulator * emulator_
absl::Status Paste() override
std::vector< bool > channel_muted_
void SetVolume(float volume)
void Initialize() override
emu::Emulator * emulator() const
absl::Status Save() override
absl::Status Cut() override
absl::Status Load() override
absl::Status Copy() override
absl::Status Update() override
void set_emulator(emu::Emulator *emulator)
ImGuiTableFlags music_editor_flags_
void PlaySong(int song_id)
absl::Status Undo() override
absl::Status Redo() override
ImGuiTableFlags toolset_table_flags_
std::vector< std::string > song_names_
AssemblyEditor assembly_editor_
MusicEditor(Rom *rom=nullptr)
A class for emulating and debugging SNES games.
Definition emulator.h:33
const ImGuiTableFlags music_editor_flags_
const ImGuiTableFlags toolset_table_flags_
Main namespace for the application.