summaryrefslogtreecommitdiff
path: root/tools/seq_compiler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'tools/seq_compiler.cc')
-rw-r--r--tools/seq_compiler.cc37
1 files changed, 29 insertions, 8 deletions
diff --git a/tools/seq_compiler.cc b/tools/seq_compiler.cc
index 4a6b554..d89ab3d 100644
--- a/tools/seq_compiler.cc
+++ b/tools/seq_compiler.cc
@@ -38,7 +38,8 @@ std::string trim(const std::string& str) {
}
// Parse key=value parameters from extra_args string
-// Example: "color=1.0,0.0,0.0 decay=0.95" -> {{"color", "1.0,0.0,0.0"}, {"decay", "0.95"}}
+// Example: "color=1.0,0.0,0.0 decay=0.95" -> {{"color", "1.0,0.0,0.0"},
+// {"decay", "0.95"}}
std::vector<std::pair<std::string, std::string>>
parse_parameters(const std::string& args) {
std::vector<std::pair<std::string, std::string>> params;
@@ -167,8 +168,8 @@ void analyze_effect_depth(const std::vector<SequenceEntry>& sequences,
std::cout << "Sample rate: " << sample_rate << " Hz (every " << dt << "s)\n";
std::cout << "\n";
- std::cout << "Max concurrent effects: " << max_depth << " at t=" << max_depth_time
- << "s\n";
+ std::cout << "Max concurrent effects: " << max_depth
+ << " at t=" << max_depth_time << "s\n";
std::cout << "\n";
// Print histogram
@@ -200,7 +201,8 @@ void analyze_effect_depth(const std::vector<SequenceEntry>& sequences,
// Print bottleneck warnings
if (max_depth > 5) {
std::cout << "\n⚠ WARNING: Performance bottlenecks detected!\n";
- std::cout << "Found " << peaks.size() << " time periods with >5 effects:\n\n";
+ std::cout << "Found " << peaks.size()
+ << " time periods with >5 effects:\n\n";
int peak_count = 0;
for (const auto& peak : peaks) {
@@ -850,7 +852,8 @@ int main(int argc, char* argv[]) {
std::string extra_args = "";
if (!rest_of_line.empty()) {
params = parse_parameters(rest_of_line);
- // Keep extra_args for backward compatibility (if no key=value pairs found)
+ // Keep extra_args for backward compatibility (if no key=value pairs
+ // found)
if (params.empty()) {
extra_args = ", " + rest_of_line;
}
@@ -937,9 +940,27 @@ int main(int argc, char* argv[]) {
}
}
- out_file << " seq->add_effect(std::make_shared<" << eff.class_name
- << ">(ctx, p), " << eff.start << "f, " << eff.end << "f, "
- << eff.priority << ");\n";
+ out_file << " seq->add_effect(std::make_shared<"
+ << eff.class_name << ">(ctx, p), " << eff.start << "f, "
+ << eff.end << "f, " << eff.priority << ");\n";
+ out_file << " }\n";
+ } else if (!eff.params.empty() &&
+ eff.class_name == "ChromaAberrationEffect") {
+ // Generate parameter struct initialization for ChromaAberrationEffect
+ out_file << " {\n";
+ out_file << " ChromaAberrationParams p;\n";
+
+ for (const auto& [key, value] : eff.params) {
+ if (key == "offset") {
+ out_file << " p.offset_scale = " << value << "f;\n";
+ } else if (key == "angle") {
+ out_file << " p.angle = " << value << "f;\n";
+ }
+ }
+
+ out_file << " seq->add_effect(std::make_shared<"
+ << eff.class_name << ">(ctx, p), " << eff.start << "f, "
+ << eff.end << "f, " << eff.priority << ");\n";
out_file << " }\n";
} else {
// No parameters or unsupported effect - use default constructor