diff options
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); |