19 static long initialized =
false;
20 static t_hashtab *hash_modules = NULL;
44 TTString* DocumentationFormat = NULL;
49 void jamoma_init(
void)
52 t_fourcc outtype, filetype =
'TEXT';
53 char name[MAX_PATH_CHARS];
58 t_object *max = SymbolGen(
"max")->s_thing;
59 TTString JamomaConfigurationFilePath;
64 if (maxversion() >= 0x0519)
67 if (maxversion() >= 0x0600)
82 JamomaApplicationManager =
TTObject(
"ApplicationManager");
85 err = JamomaApplicationManager.
send(
"ApplicationInstantiateLocal", kTTSym_Jamoma, out);
88 TTLogError(
"Error : can't create Jamoma application \n");
92 JamomaApplication = out[0];
95 strncpy_zero(name, TTFoundationBinaryPath.data(), TTFoundationBinaryPath.
size()-6);
96 JamomaConfigurationFilePath = name;
97 JamomaConfigurationFilePath +=
"misc/JamomaConfiguration.xml";
100 strncpy_zero(name, JamomaConfigurationFilePath.data(), MAX_PATH_CHARS);
101 if (locatefile_extended(name, &outvol, &outtype, &filetype, 1))
102 return error(
"Jamoma not loaded : can't find %s", JamomaConfigurationFilePath.data());
105 TTObject anXmlHandler(kTTSym_XmlHandler);
106 anXmlHandler.
set(kTTSym_object, JamomaApplication);
107 v =
TTSymbol(JamomaConfigurationFilePath);
108 anXmlHandler.
send(kTTSym_Read, v, out);
111 common_symbols_init();
124 ModelPatcherFormat =
new TTString(
"%s.model.maxpat");
125 ModelPresetFormat =
new TTString(
"%s.model.presets.txt");
126 ViewPresetFormat =
new TTString(
"%s.view.presets.txt");
127 HelpPatcherFormat =
new TTString(
"%s.model");
128 RefpageFormat =
new TTString(
"%s.model");
129 DocumentationFormat =
new TTString(
"%s.model.html");
132 hash_modules = (t_hashtab*)hashtab_new(0);
138 atom_setsym(a+0, SymbolGen(
"k"));
139 atom_setsym(a+1, SymbolGen(
"patcher"));
140 atom_setsym(a+2, SymbolGen(
"inserttextobj"));
141 atom_setsym(a+3, SymbolGen(
"j."));
142 object_method_typed(max, SymbolGen(
"definecommand"), 4, a, NULL);
163 t_symbol *jamomaSymbol = SymbolGen(
"jamoma");
169 post(
"Jamoma (build %s) Version %s | jamoma.org", JAMOMA_MAX_REV, JAMOMA_MAX_VERSION);
176 #pragma mark Utilities
183 sysmem_copyptr(src, dst,
sizeof(t_atom));
192 if (atom_getfloat(a1) == atom_getfloat(a2))
196 if (atom_getlong(a1) == atom_getlong(a2))
200 if (atom_getsym(a1) == atom_getsym(a2))
206 if (a1->a_w.w_float == a2->a_w.w_float)
210 if (a1->a_w.w_long == a2->a_w.w_long)
215 if ((a1->a_type == A_LONG) && (a2->a_type == A_LONG)) {
216 if (a1->a_w.w_long == a2->a_w.w_long)
219 else if ((a1->a_type == A_FLOAT) && (a2->a_type == A_FLOAT)) {
220 if (a1->a_w.w_float == a2->a_w.w_float)
223 else if ((a1->a_type == A_SYM) && (a2->a_type == A_SYM)) {
224 if (a1->a_w.w_sym == a2->a_w.w_sym)
229 error(
"atom_compare: cannot do comparison on this data type");
237 short len1 = strlen(s1);
238 short len2 = strlen(s2);
240 bool keepgoing =
true;
245 for (i =0 ; i < len1 && keepgoing; i++) {
250 else if (s1[i] > s2[i])
263 c = class_findbyname(jps_box, objectname);
265 p = (t_object *)newinstance(objectname, 0, NULL);
267 c = class_findbyname(jps_box, objectname);
272 error(
"jamoma: could not load extern (%s) within the core", objectname->s_name);
277 if (*
object != NULL) {
278 object_free(*
object);
282 *
object = (t_object *)object_new_typed(CLASS_BOX, objectname, argc, argv);
JAMOMA_EXPORT t_symbol * jps_generic
Pointer to the symbol "generic", one of the parameter and message data types.
JAMOMA_EXPORT t_symbol * jps_decimal
Pointer to the symbol "decimal", one of the parameter and message data types.
TTErr send(const TTSymbol aName)
Send a message to this object with no arguments.
Create and use Jamoma object instances.
void jamoma_object_initclass(void)
Set up the class.
JAMOMA_EXPORT t_symbol * jps_string
Pointer to the symbol "string", one of the parameter and message data types.
JAMOMA_EXPORT t_symbol * jps_integer
Pointer to the symbol "integer", one of the parameter and message data types.
JAMOMA_EXPORT t_symbol * jps_integerArray
Pointer to the symbol "integerArray", one of the parameter and message data types. Used for arrays of decimal values.
t_object * jamoma_object_new()
Object instantiation.
TTErr set(const TTSymbol aName, T aValue)
Set an attribute value for an object.
The TTSymbol class is used to represent a string and efficiently pass and compare that string...
void TTFOUNDATION_EXPORT TTLogError(TTImmutableCString message,...)
Platform and host independent method for posting errors.
JAMOMA_EXPORT t_symbol * jps_boolean
Pointer to the symbol "boolean", one of the parameter and message data types.
TTErr
Jamoma Error Codes Enumeration of error codes that might be returned by any of the TTBlue functions a...
size_t size() const
Find out the length of a string.
void TTMODULAR_EXPORT TTModularInit(const char *binaries=nullptr, bool loadFromBuiltinPaths=false)
Initialize the Modular library and intanciate the TTModular object.
The TTString class is used to represent a string.
JAMOMA_EXPORT t_symbol * jps_array
This is deprecated, please use #jps_list, jps_decimalArray or jps_integerArray instead.
[doxygenAppendixC_copyExample]
JAMOMA_EXPORT t_symbol * jps_decimalArray
Pointer to the symbol "decimalArray", one of the parameter and message data types. Used for arrays of decimal values.