diff --git a/examples/Advanced/Granular/Granolette.hpp b/examples/Advanced/Granular/Granolette.hpp index fe3ed5c2..b72d1a63 100644 --- a/examples/Advanced/Granular/Granolette.hpp +++ b/examples/Advanced/Granular/Granolette.hpp @@ -44,7 +44,10 @@ class Granolette return; if(outputs.audio.channels != inputs.sound.channels()) + { outputs.audio.request_channels(inputs.sound.channels()); + return; + } // Just take the first channel of the soundfile. // in is a std::span diff --git a/examples/Helpers/ValueDelay.hpp b/examples/Helpers/ValueDelay.hpp index c097ed00..d205a749 100644 --- a/examples/Helpers/ValueDelay.hpp +++ b/examples/Helpers/ValueDelay.hpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include diff --git a/include/avnd/binding/ossia/node.hpp b/include/avnd/binding/ossia/node.hpp index ac3c696a..9c309ee8 100644 --- a/include/avnd/binding/ossia/node.hpp +++ b/include/avnd/binding/ossia/node.hpp @@ -851,22 +851,13 @@ class safe_node_base : public safe_node_base_base return true; } - void soundfile_release_request(std::string& str, int idx) - { - fprintf(stderr, "%s:%d\n", str.c_str(), idx); - } - - void soundfile_load_request(std::string& str, int idx) - { - fprintf(stderr, "%s:%d\n", str.c_str(), idx); - } void midifile_load_request(std::string& str, int idx) { - fprintf(stderr, "%s:%d\n", str.c_str(), idx); + fprintf(stderr, "midifile_load_request %s:%d\n", str.c_str(), idx); } void raw_file_load_request(std::string& str, int idx) { - fprintf(stderr, "%s:%d\n", str.c_str(), idx); + fprintf(stderr, "raw_file_load_request %s:%d\n", str.c_str(), idx); } template diff --git a/include/avnd/binding/ossia/port_run_preprocess.hpp b/include/avnd/binding/ossia/port_run_preprocess.hpp index 2cf469e6..8ec274c0 100644 --- a/include/avnd/binding/ossia/port_run_preprocess.hpp +++ b/include/avnd/binding/ossia/port_run_preprocess.hpp @@ -300,7 +300,7 @@ struct process_before_run if(!str) return; - self.soundfile_load_request(*str, Idx); + self.soundfiles.load_request(*str, Idx); } template diff --git a/include/avnd/binding/ossia/soundfiles.hpp b/include/avnd/binding/ossia/soundfiles.hpp index a09ca897..9e647c5a 100644 --- a/include/avnd/binding/ossia/soundfiles.hpp +++ b/include/avnd/binding/ossia/soundfiles.hpp @@ -162,6 +162,9 @@ struct soundfile_storage : soundfile_input_storage } } } + + // std::function release_request; + std::function load_request; }; } diff --git a/include/avnd/common/struct_reflection.hpp b/include/avnd/common/struct_reflection.hpp index 050c53a2..7336fe3f 100644 --- a/include/avnd/common/struct_reflection.hpp +++ b/include/avnd/common/struct_reflection.hpp @@ -500,6 +500,28 @@ struct predicate_introspection }(indices_n{}); } } + static constexpr void + for_nth_mapped_n2(type& unfiltered_fields, int n, auto&& func) noexcept + { + if constexpr(size > 0) + { + auto stack_size_helper + = [&]() constexpr noexcept { + func( + pfr::get(unfiltered_fields), avnd::predicate_index{}, + avnd::field_index{}); + }; + + [stack_size_helper, k = index_map[n], &func, + &unfiltered_fields]( + std::integer_sequence, + std::integer_sequence) { + (void)((Index == k + && (stack_size_helper.template operator()(), true)) + || ...); + }(indices_n{}, std::make_index_sequence{}); + } + } }; template <>