From 9ac980fd47d057cccd89eb52909bd2afec79569a Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Sat, 15 Oct 2005 23:14:28 +0000 Subject: Bug fixes, notably for mac if no audio input device is available; also worked around a problem in ASIO support on MSW (but need to fix it better.) svn path=/trunk/; revision=3717 --- pd/src/t_tkcmd.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) (limited to 'pd/src/t_tkcmd.c') diff --git a/pd/src/t_tkcmd.c b/pd/src/t_tkcmd.c index def4a328..755aa1a0 100644 --- a/pd/src/t_tkcmd.c +++ b/pd/src/t_tkcmd.c @@ -479,13 +479,6 @@ static void pd_startfromgui( void) static void pdgui_setupsocket(void) { -#ifdef DEBUGCONNECT - debugfd = fopen("/Users/msp/bratwurst", "w"); - fprintf(debugfd, "turning stderr back on\n"); - fflush(debugfd); - dup2(fileno(debugfd), 2); - fprintf(stderr, "duped to stderr?\n"); -#endif #ifdef MSW pdgui_connecttosocket(); #else @@ -624,8 +617,26 @@ int Pdtcl_Init(Tcl_Interp *interp) { const char *argv = Tcl_GetVar(interp, "argv", 0); int portno, argno = 0; + /* argument passing seems to be different in MSW as opposed to + unix-likes. Here we check if we got sent a "port number" as an + argument. If so. we're to connect to a previously running pd (i.e., + pd got started first). If not, we start Pd from here. */ +#ifdef MSW if (argv && (portno = atoi(argv)) > 1) +#else + char *firstspace; + if (argv && (firstspace = strchr(argv, ' ')) && (portno = atoi(firstspace)) > 1) +#endif pdgui_setsock(portno); +#ifdef DEBUGCONNECT + debugfd = fopen("/Users/msp/bratwurst", "w"); + fprintf(debugfd, "turning stderr back on\n"); + fflush(debugfd); + dup2(fileno(debugfd), 2); + fprintf(stderr, "duped to stderr?\n"); + fprintf(stderr, "portno %d\n", pd_portno); + fprintf(stderr, "argv %s\n", argv); +#endif tk_pdinterp = interp; pdgui_startup(interp); interp->result = "loaded pdtcl_init"; -- cgit v1.2.1