diff options
Diffstat (limited to 'apps/plugins/pdbox/pdbox.h')
-rw-r--r-- | apps/plugins/pdbox/pdbox.h | 98 |
1 files changed, 94 insertions, 4 deletions
diff --git a/apps/plugins/pdbox/pdbox.h b/apps/plugins/pdbox/pdbox.h index 640bc43aca..fbca4989dc 100644 --- a/apps/plugins/pdbox/pdbox.h +++ b/apps/plugins/pdbox/pdbox.h | |||
@@ -26,9 +26,69 @@ | |||
26 | #include "bmalloc.h" | 26 | #include "bmalloc.h" |
27 | #include "dmalloc.h" | 27 | #include "dmalloc.h" |
28 | 28 | ||
29 | /* Pure Data */ | ||
30 | #include "m_pd.h" | ||
31 | |||
32 | |||
33 | /* dbestfit declarations. */ | ||
34 | |||
29 | /* Minimal memory size. */ | 35 | /* Minimal memory size. */ |
30 | #define MIN_MEM_SIZE (4 * 1024 * 1024) | 36 | #define MIN_MEM_SIZE (4 * 1024 * 1024) |
31 | 37 | ||
38 | |||
39 | /* Audio declarations. */ | ||
40 | #define PD_SAMPLERATE 32000 | ||
41 | #define PD_SAMPLES_QUOT (PD_SAMPLERATE / HZ) | ||
42 | #define PD_SAMPLES_REM (PD_SAMPLERATE % HZ) | ||
43 | #if PD_SAMPLES_REM == 0 | ||
44 | #define PD_SAMPLES_PER_HZ (PD_SAMPLES_QUOT) | ||
45 | #else | ||
46 | #define PD_SAMPLES_PER_HZ (PD_SAMPLES_QUOT + 1) | ||
47 | #endif | ||
48 | |||
49 | /* Audio data types. */ | ||
50 | #define PD_AUDIO_BLOCK_SIZE PD_SAMPLES_PER_HZ | ||
51 | struct pdbox_audio_block | ||
52 | { | ||
53 | unsigned int fill; | ||
54 | int32_t data[PD_AUDIO_BLOCK_SIZE]; | ||
55 | }; | ||
56 | |||
57 | |||
58 | /* Additional functions. */ | ||
59 | char *rb_strncat(char *s, const char *t, size_t n); | ||
60 | double rb_strtod(const char*, char**); | ||
61 | double rb_atof(const char*); | ||
62 | void rb_ftoan(float, char*, int); | ||
63 | float rb_floor(float); | ||
64 | long rb_atol(const char* s); | ||
65 | float rb_sin(float rad); | ||
66 | float rb_cos(float rad); | ||
67 | int rb_fscanf_f(int fd, float* f); | ||
68 | int rb_fprintf_f(int fd, float f); | ||
69 | float rb_log10(float); | ||
70 | float rb_log(float); | ||
71 | float rb_exp(float); | ||
72 | float rb_pow(float, float); | ||
73 | float rb_sqrt(float); | ||
74 | float rb_fabs(float); | ||
75 | float rb_atan(float); | ||
76 | float rb_atan2(float, float); | ||
77 | float rb_sinh(float); | ||
78 | float rb_tan(float); | ||
79 | typedef struct | ||
80 | { | ||
81 | int quot; | ||
82 | int rem; | ||
83 | } | ||
84 | div_t; | ||
85 | div_t div(int x, int y); | ||
86 | void sys_findlibdir(const char* filename); | ||
87 | int sys_startgui(const char *guidir); | ||
88 | |||
89 | |||
90 | /* Network declarations. */ | ||
91 | |||
32 | /* Maximal size of the datagram. */ | 92 | /* Maximal size of the datagram. */ |
33 | #define MAX_DATAGRAM_SIZE 255 | 93 | #define MAX_DATAGRAM_SIZE 255 |
34 | 94 | ||
@@ -40,7 +100,7 @@ struct datagram | |||
40 | char data[MAX_DATAGRAM_SIZE]; | 100 | char data[MAX_DATAGRAM_SIZE]; |
41 | }; | 101 | }; |
42 | 102 | ||
43 | /* Network functions prototypes. */ | 103 | /* Prototypes of network functions. */ |
44 | void net_init(void); | 104 | void net_init(void); |
45 | void net_destroy(void); | 105 | void net_destroy(void); |
46 | bool send_datagram(struct event_queue* route, int port, | 106 | bool send_datagram(struct event_queue* route, int port, |
@@ -58,13 +118,43 @@ extern struct event_queue core_to_gui; | |||
58 | 118 | ||
59 | /* Convinience macros. */ | 119 | /* Convinience macros. */ |
60 | #define SEND_TO_CORE(data) \ | 120 | #define SEND_TO_CORE(data) \ |
61 | send_datagram(&gui_to_core, PD_CORE_PORT, data, rb->strlen(data)) | 121 | send_datagram(&gui_to_core, PD_CORE_PORT, data, strlen(data)) |
62 | #define RECEIVE_TO_CORE(buffer) \ | 122 | #define RECEIVE_TO_CORE(buffer) \ |
63 | receive_datagram(&gui_to_core, PD_CORE_PORT, buffer) | 123 | receive_datagram(&gui_to_core, PD_CORE_PORT, buffer) |
64 | #define SEND_FROM_CORE(data) \ | 124 | #define SEND_FROM_CORE(data) \ |
65 | send_datagram(&core_to_gui, PD_GUI_PORT, data, rb->strlen(data)) | 125 | send_datagram(&core_to_gui, PD_GUI_PORT, data, strlen(data)) |
66 | #define RECEIVE_FROM_CORE(buffer) \ | 126 | #define RECEIVE_FROM_CORE(buffer) \ |
67 | receive_datagram(&core_to_gui, PD_GUI_PORT, buffer) | 127 | receive_datagram(&core_to_gui, PD_GUI_PORT, buffer) |
68 | 128 | ||
69 | #endif | 129 | /* PD core message callback. */ |
130 | void rockbox_receive_callback(struct datagram* dg); | ||
131 | |||
132 | |||
133 | /* Pure Data declarations. */ | ||
70 | 134 | ||
135 | /* Pure Data function prototypes. */ | ||
136 | void pd_init(void); | ||
137 | |||
138 | |||
139 | /* Redefinitons of ANSI C functions. */ | ||
140 | #include "lib/wrappers.h" | ||
141 | |||
142 | #define strncat rb_strncat | ||
143 | #define floor rb_floor | ||
144 | #define atof rb_atof | ||
145 | #define atol rb_atol | ||
146 | #define ftoan rb_ftoan | ||
147 | #define sin rb_sin | ||
148 | #define cos rb_cos | ||
149 | #define log10 rb_log10 | ||
150 | #define log rb_log | ||
151 | #define exp rb_exp | ||
152 | #define pow rb_pow | ||
153 | #define sqrt rb_sqrt | ||
154 | #define fabs rb_fabs | ||
155 | #define atan rb_atan | ||
156 | #define atan2 rb_atan2 | ||
157 | #define sinh rb_sinh | ||
158 | #define tan rb_tan | ||
159 | |||
160 | #endif | ||