[Cs-dev] Jack module
Date | 2013-09-03 20:57 |
From | Andres Cabrera |
Subject | [Cs-dev] Jack module |
Attachments | None None |
Hi, I've just pushed a fix to the rtjack.c module. It seemed there were some wrong things there, but I don't know the code that well to know if it's the right fix. It still seems to me that there are still some writes that shouldn't be there, the appending of the channel numbers for connection (shouldn't the string be copied with extra space?). Can someone check?Andrés |
Date | 2013-09-03 22:27 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Jack module |
I am not sure what is/was wrong, maybe you can give more details. Did it crash? As far as I can remember the appending was right, but I am not completely sure. On 3 Sep 2013, at 20:57, Andres Cabrera wrote: > Hi, > > I've just pushed a fix to the rtjack.c module. It seemed there were some wrong things there, but I don't know the code that well to know if it's the right fix. It still seems to me that there are still some writes that shouldn't be there, the appending of the channel numbers for connection (shouldn't the string be copied with extra space?). Can someone check? > > Cheers, > Andrés > ------------------------------------------------------------------------------ > Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! > Discover the easy way to master current and previous Microsoft technologies > and advance your career. Get an incredible 1,500+ hours of step-by-step > tutorial videos with LearnDevNow. Subscribe today and save! > http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk_______________________________________________ > Csound-devel mailing list > Csound-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/csound-devel Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-09-03 22:29 |
From | Steven Yi |
Subject | Re: [Cs-dev] Jack module |
I'm not sure if it was the same issue, but I had forgotten that I had seen some crashes with Jack too. It had to do with looking for Jack inputs to list in Blue's configuration dialog. Somehow that crashed, but looking for Jack outputs was alright. Not sure how helpful that information is; I'll try to remember to pull and test with Blue. On Tue, Sep 3, 2013 at 10:27 PM, Victor Lazzarini |
Date | 2013-09-03 22:35 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Jack module |
Attachments | None None |
Yes, it was crashing for me. Here's the diff: (I removed querying the devices on startup, I think it should only try to connect if you have provided a connection device)@@ -488,54 +488,36 @@ static void openJackStreams(RtJackGlobals *p) /* connect ports if requested */ if (p->inputEnabled) { char *dev, *sp; - { - int i,n = listDevices(csound,NULL,0); - CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *) - malloc(n*sizeof(CS_AUDIODEVICE)); - listDevices(csound,devs,0); - for(i=0; i < n; i++) - csound->Message(csound, " %d: %s (%s)\n", - i, devs[i].device_id, devs[i].device_name); - dev = devs[0].device_name; - free(devs); - } - if(p->inDevName != NULL) - dev = p->inDevName; - sp = strchr(dev, '\0'); - if(!isalpha(dev[0])) dev++; + dev = p->inDevName; - for (i = 0; i < p->nChannels; i++) { - sprintf(sp, "%d", i + 1); - if (UNLIKELY(jack_connect(p->client, dev, - jack_port_name(p->inPorts[i])) != 0)) { - rtJack_Error(csound, -1, Str("error connecting input ports")); + if (dev) { + sp = strchr(dev, '\0'); + if(!isalpha(dev[0])) dev++; + + for (i = 0; i < p->nChannels; i++) { + sprintf(sp, "%d", i + 1); + if (UNLIKELY(jack_connect(p->client, dev, + jack_port_name(p->inPorts[i])) != 0)) { + rtJack_Error(csound, -1, Str("error connecting input ports")); + } } + *sp = (char) 0; } - *sp = (char) 0; } - if (p->outputEnabled){ + if (p->outputEnabled) { char *dev, *sp; - { - int i,n = listDevices(csound,NULL,1); - CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *) - malloc(n*sizeof(CS_AUDIODEVICE)); - listDevices(csound,devs,1); - for(i=0; i < n; i++) - csound->Message(csound, " %d: %s (%s)\n", - i, devs[i].device_id, devs[i].device_name); - dev = devs[0].device_name; - free(devs); - } - if(p->outDevName != NULL) dev = p->outDevName; - sp = strchr(dev, '\0'); - if(!isalpha(dev[0])) dev++; - for (i = 0; i < p->nChannels; i++) { - sprintf(sp, "%d", i + 1); - if (jack_connect(p->client, jack_port_name(p->outPorts[i]), dev) != 0) { - rtJack_Error(csound, -1, Str("error connecting output ports")); + dev = p->outDevName; + if (dev) { + sp = strchr(dev, '\0'); + if(!isalpha(dev[0])) dev++; + for (i = 0; i < p->nChannels; i++) { + sprintf(sp, "%d", i + 1); + if (jack_connect(p->client, jack_port_name(p->outPorts[i]), dev) != 0) { + rtJack_Error(csound, -1, Str("error connecting output ports")); + } } + *sp = (char) 0; } - *sp = (char) 0; } /* stream is now active */ p->jackState = 0; And what looks suspicious to me is: sprintf(sp, "%d", i + 1); This is actually writing to the command line flag (I think), maybe a new string should be allocated and used here? Cheers, Andrés On Tue, Sep 3, 2013 at 2:27 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: I am not sure what is/was wrong, maybe you can give more details. Did it crash? As far as I can remember the appending was right, but I am not completely sure. |
Date | 2013-09-03 22:36 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Jack module |
Attachments | None None |
Hi Steven, I was having problems when running with jack. Listing seemed OK, although I'm not sure if I tried listing inputs.The problem could be related, though. Andrés On Tue, Sep 3, 2013 at 2:29 PM, Steven Yi <stevenyi@gmail.com> wrote: I'm not sure if it was the same issue, but I had forgotten that I had |
Date | 2013-09-03 22:51 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Jack module |
To me, listing the devices was useful, why remove it? Also, if you don't give a device, I had made it connect to the default output, did you take that out? On 3 Sep 2013, at 22:35, Andres Cabrera wrote: > Yes, it was crashing for me. Here's the diff: > > (I removed querying the devices on startup, I think it should only try to connect if you have provided a connection device) > > @@ -488,54 +488,36 @@ static void openJackStreams(RtJackGlobals *p) > /* connect ports if requested */ > if (p->inputEnabled) { > char *dev, *sp; > - { > - int i,n = listDevices(csound,NULL,0); > - CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *) > - malloc(n*sizeof(CS_AUDIODEVICE)); > - listDevices(csound,devs,0); > - for(i=0; i < n; i++) > - csound->Message(csound, " %d: %s (%s)\n", > - i, devs[i].device_id, devs[i].device_name); > - dev = devs[0].device_name; > - free(devs); > - } > - if(p->inDevName != NULL) > - dev = p->inDevName; > - sp = strchr(dev, '\0'); > - if(!isalpha(dev[0])) dev++; > + dev = p->inDevName; > > - for (i = 0; i < p->nChannels; i++) { > - sprintf(sp, "%d", i + 1); > - if (UNLIKELY(jack_connect(p->client, dev, > - jack_port_name(p->inPorts[i])) != 0)) { > - rtJack_Error(csound, -1, Str("error connecting input ports")); > + if (dev) { > + sp = strchr(dev, '\0'); > + if(!isalpha(dev[0])) dev++; > + > + for (i = 0; i < p->nChannels; i++) { > + sprintf(sp, "%d", i + 1); > + if (UNLIKELY(jack_connect(p->client, dev, > + jack_port_name(p->inPorts[i])) != 0)) { > + rtJack_Error(csound, -1, Str("error connecting input ports")); > + } > } > + *sp = (char) 0; > } > - *sp = (char) 0; > } > - if (p->outputEnabled){ > + if (p->outputEnabled) { > char *dev, *sp; > - { > - int i,n = listDevices(csound,NULL,1); > - CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *) > - malloc(n*sizeof(CS_AUDIODEVICE)); > - listDevices(csound,devs,1); > - for(i=0; i < n; i++) > - csound->Message(csound, " %d: %s (%s)\n", > - i, devs[i].device_id, devs[i].device_name); > - dev = devs[0].device_name; > - free(devs); > - } > - if(p->outDevName != NULL) dev = p->outDevName; > - sp = strchr(dev, '\0'); > - if(!isalpha(dev[0])) dev++; > - for (i = 0; i < p->nChannels; i++) { > - sprintf(sp, "%d", i + 1); > - if (jack_connect(p->client, jack_port_name(p->outPorts[i]), dev) != 0) { > - rtJack_Error(csound, -1, Str("error connecting output ports")); > + dev = p->outDevName; > + if (dev) { > + sp = strchr(dev, '\0'); > + if(!isalpha(dev[0])) dev++; > + for (i = 0; i < p->nChannels; i++) { > + sprintf(sp, "%d", i + 1); > + if (jack_connect(p->client, jack_port_name(p->outPorts[i]), dev) != 0) { > + rtJack_Error(csound, -1, Str("error connecting output ports")); > + } > } > + *sp = (char) 0; > } > - *sp = (char) 0; > } > /* stream is now active */ > p->jackState = 0; > > > And what looks suspicious to me is: > sprintf(sp, "%d", i + 1); > > This is actually writing to the command line flag (I think), maybe a new string should be allocated and used here? > > Cheers, > Andrés > > > > On Tue, Sep 3, 2013 at 2:27 PM, Victor Lazzarini |
Date | 2013-09-03 23:02 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Jack module |
well that is supposed to write to the end of p->outDevName, and there is space for it /* NOTE: this assumes max. 999 channels (the current limit is 255) */ nBytes = strlen(parm->devName) + 4; so the write is OK. But maybe it should not happen if p->outDevName is NULL. On 3 Sep 2013, at 22:35, Andres Cabrera wrote: > sprintf(sp, "%d", i + 1); Dr Victor Lazzarini Senior Lecturer Dept. of Music NUI Maynooth Ireland tel.: +353 1 708 3545 Victor dot Lazzarini AT nuim dot ie ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Csound-devel mailing list Csound-devel@lists.sourceforge.net |
Date | 2013-09-03 23:07 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Jack module |
Attachments | None None |
Ah, OK, I suspected there might be something like this. The crashing I had, occured here:- { - int i,n = listDevices(csound,NULL,1); - CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *) - malloc(n*sizeof(CS_AUDIODEVICE)); - listDevices(csound,devs,1); - for(i=0; i < n; i++) - csound->Message(csound, " %d: %s (%s)\n", - i, devs[i].device_id, devs[i].device_name); - dev = devs[0].device_name; - free(devs); - } Cheers, Andres On Tue, Sep 3, 2013 at 3:02 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: well that is supposed to write to the end of p->outDevName, and there is space for it |
Date | 2013-09-03 23:16 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Jack module |
it makes sense now. Thanks. On 3 Sep 2013, at 23:07, Andres Cabrera wrote: > Ah, OK, I suspected there might be something like this. > > The crashing I had, occured here: > > - { > - int i,n = listDevices(csound,NULL,1); > - CS_AUDIODEVICE *devs = (CS_AUDIODEVICE *) > - malloc(n*sizeof(CS_AUDIODEVICE)); > - listDevices(csound,devs,1); > - for(i=0; i < n; i++) > - csound->Message(csound, " %d: %s (%s)\n", > - i, devs[i].device_id, devs[i].device_name); > - dev = devs[0].device_name; > - free(devs); > - } > > As soon as you free devs, what happens to dev is unpredictable, so I was getting garbage and crashes right after that. So I'll just fix that, and put back the listing of devices. > > Cheers, > Andres > > > On Tue, Sep 3, 2013 at 3:02 PM, Victor Lazzarini |
Date | 2013-09-03 23:26 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Jack module |
Attachments | None None |
OK, I've put things back, but I commented out: It doesn't make sense to me why you would want to skip the start of the name... Is it for whitespace maybe?if(!isalpha(dev[0])) dev++; Cheers, Andrés On Tue, Sep 3, 2013 at 3:16 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: it makes sense now. Thanks. |
Date | 2013-09-03 23:32 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Jack module |
I think it could be the colon (-odac:....) or possiblu whitespace. On 3 Sep 2013, at 23:26, Andres Cabrera wrote: > OK, I've put things back, but I commented out: > if(!isalpha(dev[0])) dev++; > > It doesn't make sense to me why you would want to skip the start of the name... Is it for whitespace maybe? > > Cheers, > Andrés > > > On Tue, Sep 3, 2013 at 3:16 PM, Victor Lazzarini |
Date | 2013-09-03 23:36 |
From | Victor Lazzarini |
Subject | Re: [Cs-dev] Jack module |
There was a reason... I can't remember exactly, but I think there was a device that started with whitespace, so that was the only way to connect. I think it is no harm to keep this in. On 3 Sep 2013, at 23:32, Victor Lazzarini wrote: > I think it could be the colon (-odac:....) or possiblu whitespace. > > > On 3 Sep 2013, at 23:26, Andres Cabrera wrote: > >> OK, I've put things back, but I commented out: >> if(!isalpha(dev[0])) dev++; >> >> It doesn't make sense to me why you would want to skip the start of the name... Is it for whitespace maybe? >> >> Cheers, >> Andrés >> >> >> On Tue, Sep 3, 2013 at 3:16 PM, Victor Lazzarini |
Date | 2013-09-04 22:13 |
From | Andres Cabrera |
Subject | Re: [Cs-dev] Jack module |
Attachments | None None |
OK, in any case, I've put this back, but fixed the previous problem. Cheers, Andrés On Tue, Sep 3, 2013 at 3:36 PM, Victor Lazzarini <Victor.Lazzarini@nuim.ie> wrote: There was a reason... I can't remember exactly, but I think there was a device that started with whitespace, so that was the only way |