Well, looking at the code there are two problems:
err = snd_pcm_hw_params_set_channels_max(alsa_device.outhandle, hw_params, &outchans); to
err = snd_pcm_hw_params_set_channels(alsa_device.outhandle, hw_params, outchans);
The max function doesn't seem to be reliable or at least do what I expect. All of these functions need to be looked at. The deal is that alsa-lib is supposed to have functions that say 'set to this value or the closest valid value above/below/whatever' but I have never been able to make them work reliably. The plain set_* functions will fail if the exact param cannot be set, which is hardly ideal. The last time I really tested all of this was before the beta versions came out, so maybe things are improved. I will check.
nchannels. In the debugging process this got set to incorrectly. This makes the alsa_send_dacs function actually deal with frames :)
Hope this helps,
Karl
P.S. To make things less confusing I am removing my pd versions from my website.
On Sun, 22 Apr 2001, Karl MacMillan wrote:
Great! Not certain about the problems that you are having - I will be interested to see the solution. I tried to do a pretty straight port of the 0.5 code so it is a little surprising that things don't work. Almost the only change in alsa_send_dacs is to switch from bytes to frames. The alsa api might be changing again, by the way (this constant change is, to say the least, tiresome). Maybe a formal release should wait until alsa 1.0 comes out, whenever that is!
Karl
On Sun, 22 Apr 2001, Miller Puckette wrote:
I've merged Karl's version with mine (it now conditionally compiles for ALSA 0.5 or 0.9). I'm haveing some trouble getting the 0.9 part to work. On my soundblaster the audio output is an octave down (as if the card were getting addressed in mono.)... my Midiman Delta 66 isn't working at all. I'll try to get this debugged but in the meantime the merged source code is sitting in:
http://crca.ucsd.edu/~msp/Software/pd-src.tar.gz
cheers Miller
On Fri, Apr 20, 2001 at 12:17:57PM -0400, Karl MacMillan wrote:
I decided to go ahead and put up a modified pd with alsa support:
mambo.peabody.jhu.edu/~karlmac/download/pd/pd-032PATCH6-alsa2-linux.tar.gz
This changes -alsadev to allow you to specify the device name - the defualt is still "hw:0,0". It also fixes the bug preventing the use of -noadc and -nodac.
Karl
| Karl W. MacMillan | | Computer Music Department | | Peabody Institute of the Johns Hopkins University | | karlmac@peabody.jhu.edu | | www.peabody.jhu.edu/~karlmac |
| Karl W. MacMillan | | Computer Music Department | | Peabody Institute of the Johns Hopkins University | | karlmac@peabody.jhu.edu | | www.peabody.jhu.edu/~karlmac |
| Karl W. MacMillan | | Computer Music Department | | Peabody Institute of the Johns Hopkins University | | karlmac@peabody.jhu.edu | | www.peabody.jhu.edu/~karlmac |