diff options
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); } |
