| 471 | |
| 472 | template <typename Processor> |
| 473 | void dump_audio() |
| 474 | { |
| 475 | header(); |
| 476 | |
| 477 | // Every audio input: |
| 478 | // add an osc~ objet. |
| 479 | static constexpr const int input_channels = avnd::input_channels<Processor>(1); |
| 480 | static constexpr const int output_channels = avnd::output_channels<Processor>(1); |
| 481 | |
| 482 | int num_objects = 0; |
| 483 | // Every audio output: *~ and a gain to prevent pops |
| 484 | |
| 485 | int x = 30; |
| 486 | int y = 30; |
| 487 | for(int i = 0; i < input_channels; i++) |
| 488 | { |
| 489 | // Add input |
| 490 | fmt::print(outfile, "#X obj {} {} osc~ 220;\n", x, y); |
| 491 | x += 30; |
| 492 | num_objects++; |
| 493 | } |
| 494 | |
| 495 | // Add the object |
| 496 | x = 30; |
| 497 | y = 30 + 50 * 2; |
| 498 | |
| 499 | fmt::print(outfile, "#X obj {} {} {};\n", x, y, avnd::get_c_name<Processor>()); |
| 500 | num_objects++; |
| 501 | |
| 502 | y = 30 + 50 * 3; |
| 503 | for(int i = 0; i < output_channels; i++) |
| 504 | { |
| 505 | // Add output |
| 506 | fmt::print(outfile, "#X obj {} {} clip~ -0.95 0.95;\n", x, y); |
| 507 | num_objects++; |
| 508 | x += 30; |
| 509 | } |
| 510 | |
| 511 | // Add dac~ |
| 512 | x = 30; |
| 513 | y = 30 + 50 * 4; |
| 514 | fmt::print(outfile, "#X obj {} {} dac~;\n", x, y); |
| 515 | num_objects++; |
| 516 | |
| 517 | // Connect |
| 518 | // Each input to the object |
| 519 | { |
| 520 | for(int i = 0; i < input_channels; i++) |
| 521 | { |
| 522 | const int osc_index = i; |
| 523 | const int osc_out_port = 0; |
| 524 | |
| 525 | const int obj_index = input_channels; |
| 526 | const int obj_in_port = i; |
| 527 | |
| 528 | fmt::print( |
| 529 | outfile, "#X connect {} {} {} {};\n", osc_index, osc_out_port, obj_index, |
| 530 | obj_in_port); |