Thread: [Alsa-user] Direct memory write for more than 4 channels
Brought to you by:
perex
|
From: Bruce <abr...@gm...> - 2014-07-15 01:19:39
|
> Hi,
>
>
>
> I’m having difficulty getting more than 4 playback channels to work using
alsa callbacks and direct memory write.
>
>
>
> The sound card is an RME HDSP Madi, and alsa version is 1.0.15. I’m
currently forced to use this old version as having problems with later alsa
and the RME card (long story). The Madi is running in double-speed mode so
supports 32 channels at 96k bps.
>
>
>
> Currently the code works fine for record on all 32 channels.
>
> Previously I only output on the last 2 channels 31 & 32, which is the
stereo output on the PCI card itself. The output code worked fine.
>
>
>
> I’m now attempting to output on multiple channels using and external 8
channel in/out box on the fibre Madi.
>
> The 1st 4 channels work OK if I use slot ID 1, but 5th and higher do not.
Also strange pulsing noises appear on other channels (eg 31,32).
>
>
>
> I’m baffled. As I understand it, all channels work synchronously, so they
all should have the same number of frames free to write to in the ring
buffer at the same time.
>
> If I set the ID to 2, I can’t get channel 8-16 to work at all.
>
>
>
> My code looks like this:
>
> Callback:
>
> <handle record buffers>
>
> size = period_size;
>
> snd_pcm_avail_update(outhand);
>
> while (size > 0) {
>
> frames = size;
>
> err = snd_pcm_mmap_begin(outhand, &my_areas, &offset,
&frames);
>
> <error handling>
>
> load_output(my_areas, offset, frames, (PCMDATA *)data);
>
> commitres = snd_pcm_mmap_commit(outhand, offset, frames);
>
> <error handling>
>
> size -= frames;
>
> }
>
>
>
> static void
>
> load_output(const snd_pcm_channel_area_t *hard,
>
> snd_pcm_uframes_t offset,
>
> int count, PCMDATA *tx)
>
> {
>
> frame_t *outp[MAXCHCH], *hwp[MAXCHCH];
>
> frame_t *psave[MAXCH];
>
> int y;
>
>
>
> for(y=0; y < tx->hwchans; y++)
>
> {
>
> psave[y] = (frame_t *)((unsigned char
*)hard[y].addr + (hard[y].first/8)) + offset;
>
> }
>
> <fill required psave channels directly with my pcm data from
tx>
>
> }
|
|
From: Bruce <abr...@gm...> - 2014-07-15 10:52:22
|
On 15/07/2014 8:41 PM, Clemens Ladisch wrote: > Bruce wrote: >> I’m having difficulty getting more than 4 playback channels to work >> using alsa callbacks and direct memory write. > Does it work with aplay? I know internally aplay uses a polled write, but yes, a good idea to try anyway; I'll see if I can do this. Have to look into aplay options to move it away from default output channels, and maybe just test 2 channels on channels 5 & 6, perhaps. >> The 1st 4 channels work OK if I use slot ID 1, but 5th and higher do >> not. Also strange pulsing noises appear on other channels (eg 31,32). > This sounds like a wrong mixer configuration (if the card has any), or > a driver bug. No mixer. Rather hoping someone won't come up and say 'use a more recent alsa', as this definitely won't work; aplay doesn't work even on default channels. This later alsa may be a weirdo pulseaudio issue (I've tried disabling pulseaudio fully) but have yet to get to the bottom of it. Trying to get arch linux to boot, in order to avoid pulseaudio. -- Cheers, Bruce |
|
From: Clemens L. <cla...@go...> - 2014-07-15 10:41:30
|
Bruce wrote: > I’m having difficulty getting more than 4 playback channels to work > using alsa callbacks and direct memory write. Does it work with aplay? > The 1st 4 channels work OK if I use slot ID 1, but 5th and higher do > not. Also strange pulsing noises appear on other channels (eg 31,32). This sounds like a wrong mixer configuration (if the card has any), or a driver bug. Regards, Clemens |
|
From: Ralf M. <ral...@al...> - 2014-07-16 08:11:27
|
On Tue, 2014-07-15 at 20:51 +1000, Bruce wrote:
> This later alsa may be a weirdo pulseaudio issue (I've tried disabling
> pulseaudio fully) but have yet to get to the bottom of it. Trying to get
> arch linux to boot, in order to avoid pulseaudio.
Assumed there should be hard dependencies to pulseaudio, you could
replace it with a dummy package and ...
pkgname=pulseaudio
pkgver=2014.07.16
pkgrel=1
pkgdesc="Dummy package"
arch=('any')
provides=('pulseaudio')
https://wiki.archlinux.org/index.php/PKGBUILD
... after that kill pulseaudio.
"PulseAudio can be stopped with:
$ pulseaudio --kill" - https://wiki.archlinux.org/index.php/PulseAudio
So IMO no reboot should be needed to completely get rid of it, but
rebooting can't harm.
|
|
From: Bruce <abr...@gm...> - 2014-07-16 12:37:13
|
On 16/07/2014 6:11 PM, Ralf Mardorf wrote:
> On Tue, 2014-07-15 at 20:51 +1000, Bruce wrote:
>> This later alsa may be a weirdo pulseaudio issue (I've tried disabling
>> pulseaudio fully) but have yet to get to the bottom of it. Trying to get
>> arch linux to boot, in order to avoid pulseaudio.
> Assumed there should be hard dependencies to pulseaudio, you could
> replace it with a dummy package and ...
>
> pkgname=pulseaudio
> pkgver=2014.07.16
> pkgrel=1
> pkgdesc="Dummy package"
> arch=('any')
> provides=('pulseaudio')
>
> https://wiki.archlinux.org/index.php/PKGBUILD
Thanks very much for your reply, Ralf.
This could be very useful once I get arch linux going (at this stage
can't get it to even boot !). arch linux has been suggested to me as
possible solution to below.
The possible issue with PulseAudio experienced (stuttering audio) is
using Suse 11+, or recent Ubuntu or Redhat. Any alsa 1.0.18->1.0.28.
The issue with only 4 outputs, but all 32 inputs, working is under Suse
10 with alsa 1.0.15 added afterwards. At least this setup mostly works.
If someone is aware of any RMS driver problem that was fixed relating to
multiple outputs after driver 1.0.15 that'd be helpful to know.
>
> ... after that kill pulseaudio.
>
> "PulseAudio can be stopped with:
> $ pulseaudio --kill" - https://wiki.archlinux.org/index.php/PulseAudio
>
> So IMO no reboot should be needed to completely get rid of it, but
> rebooting can't harm.
>
>
> ------------------------------------------------------------------------------
> Want fast and easy access to all the code in your enterprise? Index and
> search up to 200,000 lines of code with a free copy of Black Duck
> Code Sight - the same software that powers the world's largest code
> search on Ohloh, the Black Duck Open Hub! Try it now.
> http://p.sf.net/sfu/bds
> _______________________________________________
> Alsa-user mailing list
> Als...@li...
> https://lists.sourceforge.net/lists/listinfo/alsa-user
--
Cheers,
Bruce
|