diff options
| author | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
|---|---|---|
| committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2009-07-03 22:16:11 +0000 |
| commit | 0d4560cb0305029fa5f0739670286176ab47cb65 (patch) | |
| tree | 9899f4324664a77e6a5884fdd1541818a28a2172 /apps/plugins/pdbox/PDa/src/m_fixed.c | |
| parent | eabeb928ddfdbe5fc6379efb87d9522803310649 (diff) | |
| download | rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.zip rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.gz rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.bz2 rockbox-0d4560cb0305029fa5f0739670286176ab47cb65.tar.xz | |
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/PDa/src/m_fixed.c')
| -rw-r--r-- | apps/plugins/pdbox/PDa/src/m_fixed.c | 34 |
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 7beaa80..374f92c 100644 --- a/apps/plugins/pdbox/PDa/src/m_fixed.c +++ b/apps/plugins/pdbox/PDa/src/m_fixed.c @@ -1,9 +1,14 @@ +#ifdef ROCKBOX +#include "plugin.h" +#include "pdbox.h" +#else /* ROCKBOX */ #include <sys/socket.h> #include <netinet/in.h> #include <netinet/tcp.h> #include <netdb.h> #include <stdio.h> +#endif /* ROCKBOX */ #include "m_pd.h" #include "m_imp.h" @@ -21,8 +26,19 @@ static t_int x_fd = -1; -static void ipod_connect() +static void ipod_connect(void) { +#ifdef ROCKBOX + if (x_fd >= 0) + { + error("ipod_connect: already connected"); + return; + } + else + { + x_fd++; + } +#else /* ROCKBOX */ struct sockaddr_in server; struct hostent *hp; int sockfd; @@ -65,6 +81,7 @@ static void ipod_connect() } post("connected %s %d",hostname,portno); x_fd = sockfd; +#endif /* ROCKBOX */ } @@ -72,8 +89,13 @@ static void ipod_connect() static void ipod_bang(t_ipod *x) { static char sendme[200]; +#ifdef ROCKBOX + snprintf(sendme, sizeof(sendme)-1, "%s bang;\n", x->x_what->s_name); + SEND_FROM_CORE(sendme); +#else /* ROCKBOX */ sprintf(sendme,"%s bang;\n",x->x_what->s_name); send(x_fd,sendme,strlen(sendme),0); +#endif /*ROCKBOX */ // if (x->x_sym->s_thing) pd_bang(x->x_sym->s_thing); } @@ -81,9 +103,19 @@ static void ipod_bang(t_ipod *x) static void ipod_float(t_ipod *x, t_float f) { static char sendme[200]; +#ifdef ROCKBOX + char f_buf[32]; + + ftoan(f, f_buf, sizeof(f_buf)-1); + strcpy(sendme, x->x_what->s_name); + strcat(sendme, " "); + strcat(sendme, f_buf); + SEND_FROM_CORE(sendme); +#else /* ROCKBOX */ sprintf(sendme,"%s %f;\n",x->x_what->s_name,f); send(x_fd,sendme,strlen(sendme),0); +#endif /* ROCKBOX */ // post("forwarding float %s",x->x_what->s_name); // if (x->x_sym->s_thing) pd_float(x->x_sym->s_thing, f); |