diff options
| author | skal <pascal.massimino@gmail.com> | 2026-02-03 18:44:41 +0100 |
|---|---|---|
| committer | skal <pascal.massimino@gmail.com> | 2026-02-03 18:44:41 +0100 |
| commit | bf46e44e1cb6027a072819a2a3aa3be32651f6e1 (patch) | |
| tree | 21267e7ef52fd91e7b99271ed87e275e91b3de3c /tools/tracker_compiler.cc | |
| parent | 815c428dea14a6a1ea5c421c400985d0c14d473d (diff) | |
refactor: Task #20 - Platform & Code Hygiene
- Consolidated all WebGPU shims and platform-specific logic into src/platform.h.
- Refactored platform_init to return PlatformState by value and platform_poll to automatically refresh time and aspect_ratio.
- Removed STL dependencies (std::map, std::vector, std::string) from AssetManager and Procedural subsystems.
- Fixed Windows cross-compilation by adjusting include paths and linker flags in CMakeLists.txt and updating build_win.sh.
- Removed redundant direct inclusions of GLFW/glfw3.h and WebGPU headers across the project.
- Applied clang-format and updated documentation.
handoff(Gemini): Completed Task #20 and 20.1. Platform abstraction is now unified, and core paths are STL-free. Windows build is stable.
Diffstat (limited to 'tools/tracker_compiler.cc')
| -rw-r--r-- | tools/tracker_compiler.cc | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/tools/tracker_compiler.cc b/tools/tracker_compiler.cc index 5cecbb8..5669cf9 100644 --- a/tools/tracker_compiler.cc +++ b/tools/tracker_compiler.cc @@ -9,8 +9,8 @@ // Enum to differentiate between sample types enum SampleType { - GENERATED, - ASSET + GENERATED, + ASSET }; // Convert note name (e.g., "C4", "A#3", "Eb2") to frequency in Hz @@ -82,7 +82,7 @@ static bool is_note_name(const std::string& name) { struct Sample { std::string name; SampleType type = GENERATED; // Default to GENERATED - std::string asset_id_name; // Store AssetId name for asset samples + std::string asset_id_name; // Store AssetId name for asset samples // Parameters for generated samples float freq, dur, amp, attack, harmonic_decay; @@ -148,13 +148,16 @@ int main(int argc, char** argv) { if (name.rfind("ASSET_", 0) == 0) { s.type = ASSET; s.asset_id_name = name; - // Parameters for asset samples are ignored, so we don't parse them here. - // However, we must consume the rest of the line to avoid issues if a comma is present. + // Parameters for asset samples are ignored, so we don't parse them + // here. However, we must consume the rest of the line to avoid issues + // if a comma is present. std::string dummy; - while (ss >> dummy) {} // Consume rest of line + while (ss >> dummy) { + } // Consume rest of line } else { s.type = GENERATED; - // Very simple parsing: freq, dur, amp, attack, harmonics, harmonic_decay + // Very simple parsing: freq, dur, amp, attack, harmonics, + // harmonic_decay char comma; ss >> s.freq >> comma >> s.dur >> comma >> s.amp >> comma >> s.attack >> comma >> s.harmonics >> comma >> s.harmonic_decay; @@ -193,10 +196,10 @@ int main(int argc, char** argv) { s.name = sname; s.type = GENERATED; s.freq = note_name_to_freq(sname); - s.dur = 0.5f; // Default note duration - s.amp = 1.0f; // Default amplitude - s.attack = 0.01f; // Default attack - s.harmonics = 3; // Default harmonics + s.dur = 0.5f; // Default note duration + s.amp = 1.0f; // Default amplitude + s.attack = 0.01f; // Default attack + s.harmonics = 3; // Default harmonics s.harmonic_decay = 0.6f; // Default decay sample_map[s.name] = samples.size(); samples.push_back(s); @@ -261,8 +264,9 @@ int main(int argc, char** argv) { for (const auto& e : p.events) { // When referencing a sample, we need to get its index or synth_id. // If it's an asset, the name starts with ASSET_. - // For now, assume sample_map is used for both generated and asset samples. - // This will need refinement if asset samples are not in sample_map directly. + // For now, assume sample_map is used for both generated and asset + // samples. This will need refinement if asset samples are not in + // sample_map directly. fprintf(out_file, " { %.1ff, %d, %.1ff, %.1ff },\n", e.beat, sample_map[e.sample_name], e.volume, e.pan); } |
