diff options
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/x_misc.c')
-rw-r--r-- | apps/plugins/pdbox/PDa/src/x_misc.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/apps/plugins/pdbox/PDa/src/x_misc.c b/apps/plugins/pdbox/PDa/src/x_misc.c index e7d0005421..e929646e7c 100644 --- a/apps/plugins/pdbox/PDa/src/x_misc.c +++ b/apps/plugins/pdbox/PDa/src/x_misc.c | |||
@@ -4,6 +4,13 @@ | |||
4 | 4 | ||
5 | /* misc. */ | 5 | /* misc. */ |
6 | 6 | ||
7 | #ifdef ROCKBOX | ||
8 | #include "plugin.h" | ||
9 | #include "pdbox.h" | ||
10 | #include "m_pd.h" | ||
11 | #include "s_stuff.h" | ||
12 | extern uint64_t runningtime; | ||
13 | #else /* ROCKBOX */ | ||
7 | #include "m_pd.h" | 14 | #include "m_pd.h" |
8 | #include "s_stuff.h" | 15 | #include "s_stuff.h" |
9 | #include <math.h> | 16 | #include <math.h> |
@@ -19,6 +26,7 @@ | |||
19 | #include <wtypes.h> | 26 | #include <wtypes.h> |
20 | #include <time.h> | 27 | #include <time.h> |
21 | #endif | 28 | #endif |
29 | #endif /* ROCKBOX */ | ||
22 | 30 | ||
23 | #if defined (MACOSX) || defined (__FreeBSD__) | 31 | #if defined (MACOSX) || defined (__FreeBSD__) |
24 | #define HZ CLK_TCK | 32 | #define HZ CLK_TCK |
@@ -68,6 +76,9 @@ static void random_bang(t_random *x) | |||
68 | 76 | ||
69 | static void random_seed(t_random *x, float f, float glob) | 77 | static void random_seed(t_random *x, float f, float glob) |
70 | { | 78 | { |
79 | #ifdef ROCKBOX | ||
80 | (void) glob; | ||
81 | #endif | ||
71 | x->x_state = f; | 82 | x->x_state = f; |
72 | } | 83 | } |
73 | 84 | ||
@@ -155,6 +166,10 @@ typedef struct _serial | |||
155 | 166 | ||
156 | static void serial_float(t_serial *x, t_float f) | 167 | static void serial_float(t_serial *x, t_float f) |
157 | { | 168 | { |
169 | #ifdef ROCKBOX | ||
170 | (void) x; | ||
171 | (void) f; | ||
172 | #else /* ROCKBOX */ | ||
158 | int n = f; | 173 | int n = f; |
159 | char message[MAXSERIAL * 4 + 100]; | 174 | char message[MAXSERIAL * 4 + 100]; |
160 | if (!x->x_open) | 175 | if (!x->x_open) |
@@ -164,6 +179,7 @@ static void serial_float(t_serial *x, t_float f) | |||
164 | } | 179 | } |
165 | sprintf(message, "com%d_send \"\\%3.3o\"\n", x->x_portno, n); | 180 | sprintf(message, "com%d_send \"\\%3.3o\"\n", x->x_portno, n); |
166 | sys_gui(message); | 181 | sys_gui(message); |
182 | #endif /* ROCKBOX */ | ||
167 | } | 183 | } |
168 | 184 | ||
169 | static void *serial_new(t_floatarg fportno) | 185 | static void *serial_new(t_floatarg fportno) |
@@ -190,6 +206,9 @@ static t_class *cputime_class; | |||
190 | typedef struct _cputime | 206 | typedef struct _cputime |
191 | { | 207 | { |
192 | t_object x_obj; | 208 | t_object x_obj; |
209 | #ifdef ROCKBOX | ||
210 | uint64_t x_runningtime; | ||
211 | #endif | ||
193 | #ifdef UNIX | 212 | #ifdef UNIX |
194 | struct tms x_setcputime; | 213 | struct tms x_setcputime; |
195 | #endif | 214 | #endif |
@@ -202,6 +221,9 @@ typedef struct _cputime | |||
202 | 221 | ||
203 | static void cputime_bang(t_cputime *x) | 222 | static void cputime_bang(t_cputime *x) |
204 | { | 223 | { |
224 | #ifdef ROCKBOX | ||
225 | x->x_runningtime = runningtime; | ||
226 | #endif | ||
205 | #ifdef UNIX | 227 | #ifdef UNIX |
206 | times(&x->x_setcputime); | 228 | times(&x->x_setcputime); |
207 | #endif | 229 | #endif |
@@ -221,9 +243,16 @@ static void cputime_bang(t_cputime *x) | |||
221 | #endif | 243 | #endif |
222 | } | 244 | } |
223 | 245 | ||
246 | #ifndef ROCKBOX | ||
224 | #define HZ 100 | 247 | #define HZ 100 |
248 | #endif | ||
225 | static void cputime_bang2(t_cputime *x) | 249 | static void cputime_bang2(t_cputime *x) |
226 | { | 250 | { |
251 | #ifdef ROCKBOX | ||
252 | float elapsedcpu = 1000 * | ||
253 | (runningtime - x->x_runningtime) / HZ; | ||
254 | outlet_float(x->x_obj.ob_outlet, elapsedcpu); | ||
255 | #endif | ||
227 | #ifdef UNIX | 256 | #ifdef UNIX |
228 | float elapsedcpu; | 257 | float elapsedcpu; |
229 | struct tms newcputime; | 258 | struct tms newcputime; |