summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/pdbox.h
diff options
context:
space:
mode:
authorPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
committerPeter D'Hoye <peter.dhoye@gmail.com>2009-07-03 22:16:11 +0000
commit0d4560cb0305029fa5f0739670286176ab47cb65 (patch)
tree9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/pdbox.h
parenteabeb928ddfdbe5fc6379efb87d9522803310649 (diff)
downloadrockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz
rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip
Accept FS #10244 by Wincent Balin: more pdbox work done for GSoC; also some keyword and line-ending fixes by me
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@21626 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pdbox/pdbox.h')
-rw-r--r--apps/plugins/pdbox/pdbox.h98
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
51struct pdbox_audio_block
52{
53 unsigned int fill;
54 int32_t data[PD_AUDIO_BLOCK_SIZE];
55};
56
57
58/* Additional functions. */
59char *rb_strncat(char *s, const char *t, size_t n);
60double rb_strtod(const char*, char**);
61double rb_atof(const char*);
62void rb_ftoan(float, char*, int);
63float rb_floor(float);
64long rb_atol(const char* s);
65float rb_sin(float rad);
66float rb_cos(float rad);
67int rb_fscanf_f(int fd, float* f);
68int rb_fprintf_f(int fd, float f);
69float rb_log10(float);
70float rb_log(float);
71float rb_exp(float);
72float rb_pow(float, float);
73float rb_sqrt(float);
74float rb_fabs(float);
75float rb_atan(float);
76float rb_atan2(float, float);
77float rb_sinh(float);
78float rb_tan(float);
79typedef struct
80{
81 int quot;
82 int rem;
83}
84div_t;
85div_t div(int x, int y);
86void sys_findlibdir(const char* filename);
87int 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. */
44void net_init(void); 104void net_init(void);
45void net_destroy(void); 105void net_destroy(void);
46bool send_datagram(struct event_queue* route, int port, 106bool 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. */
130void rockbox_receive_callback(struct datagram* dg);
131
132
133/* Pure Data declarations. */
70 134
135/* Pure Data function prototypes. */
136void 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