Skip to content

Commit

Permalink
[max] Implement proper support for dicts as outputs
Browse files Browse the repository at this point in the history
  • Loading branch information
jcelerier committed Sep 26, 2024
1 parent 441ba98 commit 2ef9fdf
Show file tree
Hide file tree
Showing 10 changed files with 868 additions and 59 deletions.
1 change: 1 addition & 0 deletions cmake/avendish.max.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ function(avnd_make_max)
"${AVND_SOURCE_DIR}/include/avnd/binding/max/atom_iterator.hpp"
"${AVND_SOURCE_DIR}/include/avnd/binding/max/audio_processor.hpp"
"${AVND_SOURCE_DIR}/include/avnd/binding/max/configure.hpp"
"${AVND_SOURCE_DIR}/include/avnd/binding/max/dict.hpp"
"${AVND_SOURCE_DIR}/include/avnd/binding/max/dsp.hpp"
"${AVND_SOURCE_DIR}/include/avnd/binding/max/from_atoms.hpp"
"${AVND_SOURCE_DIR}/include/avnd/binding/max/helpers.hpp"
Expand Down
4 changes: 3 additions & 1 deletion cmake/avendish.sources.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ if(MSVC)
"-Zc:inline"
"-Zc:preprocessor"
"-Zc:templateScope"
-wd4244)
-wd4244 # float -> int lossy conversion warning
-wd4068 # disables warning C4068: unknown pragma 'GCC'
)
target_compile_definitions(Avendish PUBLIC -DNOMINMAX=1 -DWIN32_LEAN_AND_MEAN=1)
elseif(APPLE)
target_compile_options(Avendish
Expand Down
20 changes: 10 additions & 10 deletions examples/Complete/CompleteMessageExample.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,20 +136,20 @@ struct CompleteMessageExample
halp::val_port<"out_0", int> out_int;

// Case 2: outputting a basic tuple
// pd: will output [float 123 456 789>
// max: will output [float 123 456 789>
// pd: will output [list 123 456 789>
// max: will output [list 123 456 789>
halp::val_port<"out_1", std::array<float, 3>> out_vec3;

// Case 2: outputting an object without names
// Note that the object can be defined elsewhere.
// Only rules are no specific constructors / destructors, only aggregate types.
// pd: a list
// max: a list
// pd: will output [list 123 foo>
// max: will output [list 123 foo>
halp::val_port<"out_2", some_object> out_obj1;

// Case 3: outputting an object with names
// pd: a list
// max: a dict
// pd: will output [list 123 foo>
// max: will output [dict x:123 v:foo>
halp::val_port<"out_3", some_object_named> out_obj2;

// Case 4: outputting messages
Expand Down Expand Up @@ -188,11 +188,11 @@ struct CompleteMessageExample
std::cerr << "Test1: " << inputs.test1.value << "\n";
std::cerr << "Test2: " << inputs.test2.value << "\n";
std::cerr << "Test3: " << inputs.test3.value << "\n";
outputs.out_int = 123;
outputs.out_int++;
outputs.out_vec3 = std::array{4.f, 5.f, 6.f};
outputs.out_obj1 = some_object{13, "hello"};
outputs.out_obj2 = some_object_named{31, "bye"};
outputs.out_msg1(inputs.slider.value, 2, "from bang");
outputs.out_obj1 = some_object{outputs.out_int, "hello"};
outputs.out_obj2 = some_object_named{outputs.out_int, "bye"};
outputs.out_msg1(inputs.slider.value, outputs.out_int, "from bang");
outputs.out_msg2("text1", "text2");
outputs.out_msg_list(std::vector<std::string>{"text1", "text2", "text3"});
std::vector<std::string> v{"a", "b", "c", "d"};
Expand Down
Loading

0 comments on commit 2ef9fdf

Please sign in to comment.