Subject: Problem with async callbacks stopping
Hi,
I've combed the web for a possible solution to my problem and I can't seem
to find anything germane, so here goes !
I'm hoping someone can lead me in the right direction, as this has become
very frustrating.
Some History:
A few years ago I wrote a dedicated app specific record/playback application
on alsa 1.0.15, running on a Sun 64bit machine running Suse 10.
The soundcard was a professional 32 channel RME DSP Hammerfall.
It used an async receive callback and memory mapping (mmap). Eventually I
got it all working smoothly. It performs both playback (on 2 channels
31/32 or 63/64, depending on whether sample rate was 96k or 48k) and
sampling on up to 32 channels simultaneously. I have a comment in the code
that I had troubles getting both receive and transmit callbacks working at
the same time, so I simply ended up calling the transmit routine from the
receive callback (the rate was the same) and that worked fine.
Recently I have had need to re-visit this project. The Sun machine has died,
but the RME soundcard lives on.
It was installed on a new HP 64bit machine, now running Suse 11 which has
alsa 1.0.18.
Running my original program (recompiled with the new alsa libs), I can get
about 1s of audio out. The program then hangs. On closer investigation, it
seems the async receive callback runs for a while, then simply stops.
I can get sounds out using aplay, but they are skipping and distorted.
Pulse audio has been disabled by simply removing the alsa-pulse.conf file in
/etc.
I downloaded and installed the lastest alsa 1.0.27, but the symptoms were
the same. In desperation I also tried the original alsa 1.0.15, but that
didn't help either.
All other soundcards are disabled. There is on-board sound (both Intel, and
on the Nvidea video card for HDMI) so I can't physically remove them.
Thinking there may be some problem with the old soundcard hardware, a modern
Asus Xonar STX was fitted. I have modified my application to use only 2
channels, and interleaved samples (the STX hardware doesn't support
non-interleaved at the low level, and I'm trying to avoid using plughw to be
sure I'm getting exactly what I want). The card appears as card 2 for some
reason. That's OK, just use hw:2,0 instead.
Encouragingly, aplay seems to behave OK, playing 48k wav files through plug.
Unfortunately, after all this effort, the callbacks seem to die in pretty
much the same way as they did with the RME card. I can see I get up to about
49000 samples (or roughly 1s at 48k sample rate). Then no more callbacks.
No xrun errors are reported in the callbacks that do happen.
The application architecture is quite similar in structure to the alsa
example code pcm.c.
I can give you /proc or other outputs as required, but as I'm actually
communicating with the soundcard I'm not sure that's much help.
I tweaked the hardware parameters passed in hwparams as required so as not
to get an error back from the card driver that something wasn't supported.
Currently using on the STX: SND_PCM_ACCESS_MMAP_INTERLEAVED, 48k, 2
channels, SND_PCM_FORMAT_S32_LE.
On the RME I was using: SND_PCM_ACCESS_MMAP_NONINTERLEAVED, 48k/96k,
64/32 channels, SND_PCM_FORMAT_S32_LE
It could be the code, but it used to work on the Sun.....
It coud be the soundcard, but the RME worked on the Sun and neither the RME
or the STX work on the HP....
It could be the HP, but how ?
I'm not sure what to do now ?
A basic polled method doesn't lend itself well to handling 32 channels, and
would result in double buffer handling.
--
Cheers,
Bruce
--
Cheers,
Bruce