Jamoma API  0.6.0.a19
JamomaForMax.h
Go to the documentation of this file.
1 /** @file
2  *
3  * @ingroup implementationMaxLibrary
4  *
5  * @brief Various utilities for interfacing with Max that are not specific to JamomaModular as such.
6  *
7  * @details Functions and resources used by Max objects.
8  *
9  * @authors Tim Place, Théo de la Hogue, Trond Lossius
10  *
11  * @copyright Copyright © 2013, Tim Place & Théo de la Hogue @n
12  * This code is licensed under the terms of the "New BSD License" @n
13  * http://creativecommons.org/licenses/BSD/
14  */
15 
16 #ifndef __JAMOMA_FOR_MAX_H__
17 #define __JAMOMA_FOR_MAX_H__
18 
19 #ifdef WIN_VERSION
20 #pragma warning(disable:4083) //warning C4083: expected 'newline'; found identifier 's'
21 #endif // WIN_VERSION
22 
23 #ifndef WIN_VERSION
24 #include <Carbon/Carbon.h>
25 #endif
26 
27 #ifdef TT_PLATFORM_WIN
28 
29  #include "windows.h"
30  #define JAMOMA_EXPORT_MAXOBJ __declspec(dllexport)
31 
32  #ifdef JAMOMA_EXPORTS
33  #define JAMOMA_EXPORT __declspec(dllexport)
34 
35  #else
36  #ifdef JAMOMA_STATIC
37  #define JAMOMA_EXPORT
38 
39  #else
40  #define JAMOMA_EXPORT __declspec(dllimport)
41 
42  #endif
43  #endif
44 
45 #else // TT_PLATFORM_MAC
46 
47  #define JAMOMA_EXPORT_MAXOBJ __attribute__((visibility("default")))
48 
49  #ifdef JAMOMA_EXPORTS
50  #define JAMOMA_EXPORT __attribute__((visibility("default")))
51  #else
52  #define JAMOMA_EXPORT
53  #endif
54 
55 #endif
56 
57 // Jamoma Core includes
58 #include "TTFoundationAPI.h"
59 #include "TTModular.h"
60 #ifdef TTSCORE_IMPORT
61 #include "TTScore.h"
62 #endif
63 
64 // Max includes
65 #include "ext.h"
66 #include "ext_common.h"
67 #include "ext_obex.h" // Max Object Extensions (attributes) Header
68 #include "ext_strings.h" // String Functions
69 #include "ext_critical.h"
70 #include "jpatcher_api.h"
71 #include "z_dsp.h"
72 #include "commonsyms.h" // Common symbols used by the Max 4.5 API
73 
74 // standard includes
75 #include <math.h>
76 #include <stdlib.h>
77 
78 // Jamoma Max includes
79 #include "JamomaMaxVersion.h"
80 #include "JamomaObject.h"
81 #include "JamomaMaxObjectTypes.h"
82 #include "JamomaSymbols.h"
83 #include "JamomaModularForMax.h"
84 
85 
86 #define JAMOMA "Jamoma"
87 #define JAMOMA_UNIT_HEIGHT 35.0
88 #define JAMOMA_UNIT_WIDTH 150.0
89 #define JAMOMA_MENU_FONT "Arial"
90 #define JAMOMA_MENU_FONTSIZE 11.0
91 #define JAMOMA_DEFAULT_FONT "Verdana"
92 #define JAMOMA_DEFAULT_FONTSIZE 9.0
93 #define JAMOMA_BUTTON_FONT JAMOMA_DEFAULT_FONT
94 
95 void JAMOMA_EXPORT jamoma_init(void);
96 
97 
98 /** Utility function to perform an atom copy.
99  @param dst The destination t_atom.
100  @param src The t_atom to be copied.
101  */
102 void JAMOMA_EXPORT jamoma_atom_copy(t_atom *dst, t_atom *src);
103 
104 
105 /** Utility function to compare two t_atoms.
106  @param type The atom type of a1.
107  @param a1 A t_atom.
108  @param a2 The t_atom to compare against.
109  @return true if the t_atom's are the same.
110  */
111 bool JAMOMA_EXPORT jamoma_atom_compare(t_symbol *type, t_atom *a1, t_atom *a2);
112 
113 /** Compare two strings.
114  @param s1 Pointer to the first of the two strings to compare-
115  @param s2 Pointer to the second of the two strings to compare.
116  @return true if the strings are the same.
117  */
118 bool JAMOMA_EXPORT jamoma_string_compare(char *s1, char *s2);
119 
120 
121 /** Load obex externals for use within other externals.
122  @param objectname The object name (i.e. SymbolGen("j.send")).
123  @param argc Number of arguments to the external to be loaded.
124  @param argv Pointer to the first of an array of atom arguments to the external that is to be loaded.
125  @param object If the object is loaded successfully, this will be a pointer to the object pointer.
126  @return true if successfully loaded, otherwise false.
127  */
128 bool JAMOMA_EXPORT jamoma_loadextern(t_symbol *objectname, long argc, t_atom *argv, t_object **object);
129 
130 
131 #endif //__JAMOMA_FOR_MAX_H__
132 
JamomaModular For Max Shared Library.
bool JAMOMA_EXPORT jamoma_loadextern(t_symbol *objectname, long argc, t_atom *argv, t_object **object)
Load obex externals for use within other externals.
Data types for Max objects that fit more naturally with the Jamoma coding style.
void JAMOMA_EXPORT jamoma_atom_copy(t_atom *dst, t_atom *src)
Utility function to perform an atom copy.
bool JAMOMA_EXPORT jamoma_string_compare(char *s1, char *s2)
Compare two strings.
The global Jamoma object.
Jamoma symbols cached to avoid repeated calls to the expensive SymbolGen() function.
bool JAMOMA_EXPORT jamoma_atom_compare(t_symbol *type, t_atom *a1, t_atom *a2)
Utility function to compare two t_atoms.
the Modular Application Programming Interface