Hallo,
Mark Constable hat gesagt: // Mark Constable wrote:

> On Sun, 19 Oct 2003 05:21 am, Bob Rossi wrote:
> > ...
> > Does anyone know how to get OSS applications to use the aoss wrapper
> > with dmix in order to get software mixing to work?
> >
> > Any help would be really appreciated. Does using dmix allow multiple
> > applications to open /dev/dsp?
> >
> > What about /dev/mixer?
> >
> > It would be extremely helpfull to see a full example of how to set this
> > up. I don't think there is such an example on the web.
> 
> Sorry I can't help with your question but if anyone can come
> up with a working example could they please please please put
> the info on the Wiki at http://alsa.opensrc.org for the rest
> of us. Thanks heaps.

I don't want to put half tested things up there, but if some people
could try the following: 

1) Install aoss, alsaplayer, mpg123(rsp. mpg321)

2) Test basic dmix on alsa with: 
   
   alsaplayer -o alsa -d plug:dmix some.mp3 &
   aplay -D plug:dmix some.wav &
   alsaplayer -o alsa -d plug:dmix some.mp3 &

This should work everywhere with ALSA 0.9.7.

3) configure asoundrc for aoss-testing: 

        # ~/.asoundrc:

        pcm.dsp0 {
                        type plug
                        slave.pcm "hw:0"
        }
        # or: 
        #  pcm.dsp0 pcm.default
        # if "default" hasn't been redefined
 
        ctl.mixer0 {
                        type hw
                        card 0
        }

4) Test aoss with mpg123 in oss mode:
        
        aoss mpg123 some.mp3

This should play the file, but not yet "dmix"ed. 

Now comes the tricky and rather difficult part: redefinig dsp0 to be
some kind of dmix.

5) The simple approach:

        # ~/.asoundrc
        pcm.dsp0 {
                        type plug
                        slave.pcm "dmix"
        }
        # mixer0 can stay unchanged, because it isn't used anyway, I guess
        # ;)
        ctl.mixer0 {
                        type hw
                        card 0
        }

Test this setup with mpg123 like under 4). This should enable dmixed
OSS playback, but it will not work on cards like the M-Audio
Audiophile or other Delta cards, that need a certain audio data format
for playback on hw:0 (which dmix uses by default).

6) The complex approach (defining dmix parameters)

Because of the format conversion we need to create a custom dmix
device. I call it ossmix. 


        pcm.ossmix {
                        type dmix
                        ipc_key 1024      # must be unique!
                        slave {
                                        pcm "hw:0,0"      # you cannot use a "plug" 
device
                                                          # here, darn.
                                        period_time 0
                                        period_size 1024  # must be power of 2
                                        buffer_size 8192  # dito.
                                        #format "S32_LE"
                                        #periods 128      # dito.
                                        #rate 8000        # with rate 8000 you *will* 
hear, 
                                                          # if ossmix is used :)
                        }
        # bindings are not actually needed:
        #               bindings {
        #                               0 0
        #                               1 1
        #               }
        }

        pcm.dsp0 {
                        type plug
                        slave.pcm "ossmix"         # use our new PCM here
        }
        # mixer0 like above
        ctl.mixer0 {
                        type hw
                        card 0
        }



It is important, that this "ossmix" PCM works with your card in ALSA
mode.  That is, the following should produce sound: 

        alsaplayer -o alsa -d ossmix some.mp3

It does not do so here, yet: 
        
        $ alsaplayer -d ossmix
        error on set_format SND_PCM_FORMAT_S16_LE
        Unavailable hw params:
        ACCESS:  RW_INTERLEAVED
        FORMAT:  S32_LE
        SUBFORMAT:  ALL
        SAMPLE_BITS: ALL
        FRAME_BITS: ALL
        CHANNELS: 2
        RATE: 48000
        PERIOD_TIME: (21333 21334)
        PERIOD_SIZE: 1024
        PERIOD_BYTES: ALL
        PERIODS: (6 7)
        BUFFER_TIME: (136520 136521)
        BUFFER_SIZE: 6553
        BUFFER_BYTES: ALL
        TICK_TIME: ALL

What *does* work, however, is this: 

        alsaplayer -o alsa -d plug:ossmix some.mp3

Theoretically you should be able to somehow get the right settings to
at last enable the OSS-dmix-bridge on Delta cards this way, but I
couldn't find the correct settings yet. It does work if I use hw:1,
which is a SBLive, though. But there I don't need sw-mixing.

To be honest, I don't need sw-mixing anyway, but I'm working on an
article where configuring dmix is one topic, so I'd really like to see
someone test this. ;)

Then we could put it on the ALSA-Wiki and I would write a really quick
Quicktoot for Dave's site.

ciao
-- 
 Frank Barknecht                               _ ______footils.org__


-------------------------------------------------------
This SF.net email sponsored by: Enterprise Linux Forum Conference & Expo
The Event For Linux Datacenter Solutions & Strategies in The Enterprise 
Linux in the Boardroom; in the Front Office; & in the Server Room 
http://www.enterpriselinuxforum.com
_______________________________________________
Alsa-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-user

Reply via email to