| 468 | if (!path.parent_path().empty()) { |
| 469 | std::filesystem::create_directories(path.parent_path()); |
| 470 | } |
| 471 | engine::audio::WavPcm16Sink().write(path, engine::audio::AudioBuffer{ |
| 472 | audio.sample_rate, |
| 473 | audio.channels, |
| 474 | audio.samples, |
| 475 | }); |
| 476 | } |
| 477 | |
| 478 | engine::io::json::Value expanded_json(const engine::io::json::Value & value, const WorkflowContext & context) { |
| 479 | if (value.is_string()) { |
| 480 | return engine::io::json::Value::make_string(expand_value(value.as_string(), context)); |
| 481 | } |
| 482 | if (value.is_array()) { |
| 483 | engine::io::json::Value::Array out; |
| 484 | for (const auto & item : value.as_array()) { |
| 485 | out.push_back(expanded_json(item, context)); |
| 486 | } |
| 487 | return engine::io::json::Value::make_array(std::move(out)); |
| 488 | } |
| 489 | if (value.is_object()) { |
| 490 | engine::io::json::Value::Object out; |
| 491 | for (const auto & [key, item] : value.as_object()) { |
| 492 | out.emplace(key, expanded_json(item, context)); |
no test coverage detected