-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathmin.conan.cpp
60 lines (45 loc) · 1.8 KB
/
min.conan.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/// @file
/// @ingroup minexamples
/// @copyright Copyright 2018 The Min-DevKit Authors. All rights reserved.
/// @license Use of this source code is governed by the MIT License found in the License.md file.
#include "c74_min.h"
using namespace c74::min;
class conan : public object<conan> {
public:
MIN_DESCRIPTION {"Post to the Max Console."};
MIN_TAGS {"utilities"};
MIN_AUTHOR {"Cycling '74"};
MIN_RELATED {"print, jit.print, dict.print"};
inlet<> input { this, "(bang) post greeting to the max console" };
outlet<> output { this, "(anything) output the message which is posted to the max console" };
// define an optional argument for setting the message
argument<symbol> greeting_arg { this, "greeting", "Initial value for the greeting attribute.",
MIN_ARGUMENT_FUNCTION {
greeting = arg;
}
};
// the actual attribute for the message
attribute<symbol> greeting { this, "greeting", "hello world",
description {
"Greeting to be posted. "
"The greeting will be posted to the Max console when a bang is received."
}
};
// respond to the bang message to do something
message<> bang { this, "bang", "Post the greeting.",
MIN_FUNCTION {
symbol the_greeting = greeting; // fetch the symbol itself from the attribute named greeting
cout << the_greeting << endl; // post to the max console
output.send(the_greeting); // send out our outlet
return {};
}
};
// post to max window == but only when the class is loaded the first time
message<> maxclass_setup { this, "maxclass_setup",
MIN_FUNCTION {
cout << "hello world" << endl;
return {};
}
};
};
MIN_EXTERNAL(conan);