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