Hallo,
I desperatly needed 4-channel audio out on my Quattro on Linux and I know, lots of others needed that, too. So I made an ugly hack without actually hoping it would work at all, but interestingly it did work.
In CVS-Pd, tagged devel_0_37 edit s_audio_alsa.c and change this near line 111:
/* device names are hw:0, plughw:0, hw:1, and so on. */ if (devno & 1) sprintf(devname, "plughw:%d", devno/2); else sprintf(devname, "hw:%d", devno/2);
to be that:
/* device names are hw:0, plughw:0, hw:1, and so on. */ /* if (devno & 1) sprintf(devname, "plughw:%d", devno/2); else sprintf(devname, "hw:%d", devno/2); */
/* HACK: hardcode quattro devices */ if (devno & 1) sprintf(devname, "q4"); /* Quattro plug */ else sprintf(devname, "q4b"); /* Quattro route */
while using the usual asoundrc, that defines q4 and q4b.
Recompile.
You will now only be able to use the Quattro devices with that Pd and you'll have to use this command line:
$ pd -alsa -noadc -outchannels 4
because trying to use audio-in at the same time results in that error:
opened 1 MIDI input device(s) and 0 MIDI output device(s). Sample width set to 2 bytes ALSA lib pcm.c:1148:(snd_pcm_link) SNDRV_PCM_IOCTL_LINK failed: Operation already in progress
Now, the interesting part here, and the reason I post this to pd-dev, is, that Pd's ALSA subsystem in CVS obviously is practically ready to use freely named ALSA devices, that are not called plughw:X or hw:X.
The only thing missing is a way, to specify other names for Pd to use either on the command line, or in a free form text field in the Media menu, and get rid of the hardcoded "hw" and "plughw" specifiers in the ALSA code.
After that, Quattro users, abd maybe also the RME users, would be soo happy.
(Oh, and there also is this SNDRV_PCM_IOCTL_LINK error, but this probably is another story.)
ciao
I desperatly needed 4-channel audio out on my Quattro on Linux and I know, lots of others needed that, too. So I made an ugly hack without actually hoping it would work at all, but interestingly it did work.
finally someone managed to get a quattro working with 0.37 ... just a week before i'll buy an rme ;-)
anyway, good job ...
Tim mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.nyds-exp-discogs.tk -- The only people for me are the mad ones, the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn, burn, like fabulous yellow roman candles exploding like spiders across the stars and in the middle you see the blue centerlight pop and everybody goes "Awww!" Jack Kerouac
Hallo, Tim Blechmann hat gesagt: // Tim Blechmann wrote:
I desperatly needed 4-channel audio out on my Quattro on Linux and I know, lots of others needed that, too. So I made an ugly hack without actually hoping it would work at all, but interestingly it did work.
finally someone managed to get a quattro working with 0.37 ... just a week before i'll buy an rme ;-)
You might run into a very similar problem, maybe exactly the same. (But then, exactly the same "solution" could work)
anyway, good job ...
Not good, dirty.
I was thinking of a slightly less dirty solution: How about allowing the option -audiodev be negative (-1) for ALSA and if it is negative, just select the ALSA device "default" inside Pd. Then one could redefine "default" in asoundrc to be any PCM of choice, like:
# use q4b as default: pcm.!default pcm.q4b
Or we could just aggree on a special name for a Pd ALSA device, like
pcm.pd { ... }
Just some ideas...
ciao
(Oh, and there also is this SNDRV_PCM_IOCTL_LINK error, but this probably is another story.)
well, it is also possible to use only the 4 input channels if you move the code from
if (inchans) { ... }
to in front of the code
if (outchans) { ... }
i'm not into the alsa api, but isn't is possible to open both in and out channels at one time?
take care...
Tim mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.nyds-exp-discogs.tk -- The only people for me are the mad ones, the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn, burn, like fabulous yellow roman candles exploding like spiders across the stars and in the middle you see the blue centerlight pop and everybody goes "Awww!" Jack Kerouac
Hallo, Tim Blechmann hat gesagt: // Tim Blechmann wrote:
(Oh, and there also is this SNDRV_PCM_IOCTL_LINK error, but this probably is another story.)
well, it is also possible to use only the 4 input channels if you move the code from
if (inchans) { ... }
to in front of the code
if (outchans) { ... }
I don't think, this is necessary, you could also just use "-nodac" with my first patch, and then you get only inputs, but no outputs.
i'm not into the alsa api, but isn't is possible to open both in and out channels at one time?
Yes, this is possible, I already did achieve that with Jack and the Quattro (some time ago, though). I've no idea why the linking fails.
ciao
Yes, this is possible, I already did achieve that with Jack and the Quattro (some time ago, though). I've no idea why the linking fails.
well, it worked fine with devel_0_36!!!
Tim mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.nyds-exp-discogs.tk -- The only people for me are the mad ones, the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn, burn, like fabulous yellow roman candles exploding like spiders across the stars and in the middle you see the blue centerlight pop and everybody goes "Awww!" Jack Kerouac
(Oh, and there also is this SNDRV_PCM_IOCTL_LINK error, but this probably is another story.)
i had a look at the different alsa implementations in 0.36 and 0.37.
it seems that in 0.36 in and out channels are configured at one time ... in 0.37 first the out channels are configured and then the in channels... and a function alsa_pcm_link is being run ...
could this cause the different behaviour?
Tim mailto:TimBlechmann@gmx.de ICQ: 96771783 http://www.nyds-exp-discogs.tk -- The only people for me are the mad ones, the ones who are mad to live, mad to talk, mad to be saved, desirous of everything at the same time, the ones who never yawn or say a commonplace thing, but burn, burn, burn, like fabulous yellow roman candles exploding like spiders across the stars and in the middle you see the blue centerlight pop and everybody goes "Awww!" Jack Kerouac
Hallo, Tim Blechmann hat gesagt: // Tim Blechmann wrote:
(Oh, and there also is this SNDRV_PCM_IOCTL_LINK error, but this probably is another story.)
i had a look at the different alsa implementations in 0.36 and 0.37.
it seems that in 0.36 in and out channels are configured at one time ... in 0.37 first the out channels are configured and then the in channels... and a function alsa_pcm_link is being run ...
could this cause the different behaviour?
I tried with a removed snd_pcm_link block, but although that got rid of the error, it didn't help at all: "audio i/o stuck"
But I'm in no way intimate with ALSA programming nor the Pd internals.
ciao