Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 28 Jan 2012 14:22:35 +0400
From:      Ruslan Bukin <br@bsdpad.com>
To:        Alexander Motin <mav@FreeBSD.org>
Cc:        freebsd-multimedia@FreeBSD.org
Subject:   Re: multi-mono-channel sound card
Message-ID:  <20120128102235.GA39995@jail.io>
In-Reply-To: <20120122163828.GA18783@jail.io>
References:  <mailpost.1327157687.2711952.14470.mailing.freebsd.multimedia@FreeBSD.cs.nctu.edu.tw> <4F1ADDC8.90104@FreeBSD.org> <20120122163828.GA18783@jail.io>

next in thread | previous in thread | raw e-mail | index | archive | help
On Sun, Jan 22, 2012 at 08:38:28PM +0400, Ruslan Bukin wrote:
> On Sat, Jan 21, 2012 at 05:46:16PM +0200, Alexander Motin wrote:
> > On 01/21/12 16:12, Ruslan Bukin wrote:
> > >My multichannel sound card (RME HDSPe AIO) is support
> > >SND_FORMAT(AFMT_S32_LE, 1, 0) only.
> > >
> > >I call pcm_addchan(..), which triggers chan_init(..,*snd_dbuf,..)
> > >Addr of snd_dbuf I write to card in slot N.
> > >In result I have /dev/dsp0.pN devices (one device per each mono channel)
> > >
> > >Works perfectly, sounds great, but in mono mode.
> > >
> > >I'm interested, what is the right way to implement
> > >stereo pair of channels per one device file like in OSS?
> > 
> > pcm_addchan() registers set of equal playback/record channels that
> > are supposed to be mixed into the same signal. It is hardware
> > equivalent of vchans. It has nothing common with multiple speakers.
> > 
> > Multichannel audio is always multiplexed and AFAIk there is no
> > demultiplexing in sound(4). Sound(4) can upmix/downmix channels,
> > change their order, format, rate, but not demultiplex.
> > 
> > I see only two ways:
> >  - implement demultiplexing in driver -- that is not easy, but I
> > believe it should be possible;
> >  - export each input/output connector as separate PCM device and let
> > some user level software to do demultiplexing -- that is easy and
> > that is what snd_emu10kx does. snd_emu10kx(4) recommends to use
> > pulseaudio for demultiplexing.
> 
> Thanks. I have implemented demultiplexing. Works great.
> I will release the driver soon.
> 

Not great, actually. Demultiplexing need some time,
but seems that PCMTRIG_EMLDMAWR event trigger is not the 
moment where we have it.

If I just copy buffer (memcpy) on PCMTRIG_EMLDMAWR no problem at all,
card generates 12k IRQ/s.

but simple demultiplex (for loop) on each IRQ reduce speed to 6-10k IRQ/s
and causes producing high-pitched sound goes from some chip 
on card or may be motherboard (its difficult to identify source)

it happens only on small period sizes, like 32 samples
(choices are 32,64,..4096).

samples - IRQ/s
32      - 12k
64      - 6k
128     - 3k
256     - 1.5k
512     - 0.6k
1024    - 0.3k
2048    - 0.15k
4096    - 0.08k

card bufsize is 64k bytes (16k samples)

so we have only 1/12k = 0.0000833s to demultiplex,
but it is not possible, right?

-Ruslan



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20120128102235.GA39995>