summaryrefslogtreecommitdiff
path: root/apps/plugins/pdbox/PDa/src/m_fixed.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/plugins/pdbox/PDa/src/m_fixed.c')
-rw-r--r--apps/plugins/pdbox/PDa/src/m_fixed.c34
1 files changed, 33 insertions, 1 deletions
diff --git a/apps/plugins/pdbox/PDa/src/m_fixed.c b/apps/plugins/pdbox/PDa/src/m_fixed.c
index 7beaa8077a..374f92cbca 100644
--- a/apps/plugins/pdbox/PDa/src/m_fixed.c
+++ b/apps/plugins/pdbox/PDa/src/m_fixed.c
@@ -1,9 +1,14 @@
1 1
2#ifdef ROCKBOX
3#include "plugin.h"
4#include "pdbox.h"
5#else /* ROCKBOX */
2#include <sys/socket.h> 6#include <sys/socket.h>
3#include <netinet/in.h> 7#include <netinet/in.h>
4#include <netinet/tcp.h> 8#include <netinet/tcp.h>
5#include <netdb.h> 9#include <netdb.h>
6#include <stdio.h> 10#include <stdio.h>
11#endif /* ROCKBOX */
7 12
8#include "m_pd.h" 13#include "m_pd.h"
9#include "m_imp.h" 14#include "m_imp.h"
@@ -21,8 +26,19 @@ static t_int x_fd = -1;
21 26
22 27
23 28
24static void ipod_connect() 29static void ipod_connect(void)
25{ 30{
31#ifdef ROCKBOX
32 if (x_fd >= 0)
33 {
34 error("ipod_connect: already connected");
35 return;
36 }
37 else
38 {
39 x_fd++;
40 }
41#else /* ROCKBOX */
26 struct sockaddr_in server; 42 struct sockaddr_in server;
27 struct hostent *hp; 43 struct hostent *hp;
28 int sockfd; 44 int sockfd;
@@ -65,6 +81,7 @@ static void ipod_connect()
65 } 81 }
66 post("connected %s %d",hostname,portno); 82 post("connected %s %d",hostname,portno);
67 x_fd = sockfd; 83 x_fd = sockfd;
84#endif /* ROCKBOX */
68} 85}
69 86
70 87
@@ -72,8 +89,13 @@ static void ipod_connect()
72static void ipod_bang(t_ipod *x) 89static void ipod_bang(t_ipod *x)
73{ 90{
74 static char sendme[200]; 91 static char sendme[200];
92#ifdef ROCKBOX
93 snprintf(sendme, sizeof(sendme)-1, "%s bang;\n", x->x_what->s_name);
94 SEND_FROM_CORE(sendme);
95#else /* ROCKBOX */
75 sprintf(sendme,"%s bang;\n",x->x_what->s_name); 96 sprintf(sendme,"%s bang;\n",x->x_what->s_name);
76 send(x_fd,sendme,strlen(sendme),0); 97 send(x_fd,sendme,strlen(sendme),0);
98#endif /*ROCKBOX */
77 99
78// if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); 100// if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing);
79} 101}
@@ -81,9 +103,19 @@ static void ipod_bang(t_ipod *x)
81static void ipod_float(t_ipod *x, t_float f) 103static void ipod_float(t_ipod *x, t_float f)
82{ 104{
83 static char sendme[200]; 105 static char sendme[200];
106#ifdef ROCKBOX
107 char f_buf[32];
108
109 ftoan(f, f_buf, sizeof(f_buf)-1);
110 strcpy(sendme, x->x_what->s_name);
111 strcat(sendme, " ");
112 strcat(sendme, f_buf);
84 113
114 SEND_FROM_CORE(sendme);
115#else /* ROCKBOX */
85 sprintf(sendme,"%s %f;\n",x->x_what->s_name,f); 116 sprintf(sendme,"%s %f;\n",x->x_what->s_name,f);
86 send(x_fd,sendme,strlen(sendme),0); 117 send(x_fd,sendme,strlen(sendme),0);
118#endif /* ROCKBOX */
87 119
88// post("forwarding float %s",x->x_what->s_name); 120// post("forwarding float %s",x->x_what->s_name);
89// if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); 121// if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f);