mustux-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Mustux-devel] Regarding alsa


From: Remon Sijrier
Subject: [Mustux-devel] Regarding alsa
Date: Thu, 13 Nov 2003 19:57:00 +0100
User-agent: KMail/1.5.3

Hi,

Luciano, I have some questions about the alsa stuff.

1. Why isn't the alsa implementation done with a callback mechanism?

2. Trying to solve the bug for Reinhard in MADM (=MAB) I realized that there 
is much work to be done for the alsa implementation. One of the things I do 
not understand is:
MAB is designed full duplex, but when taking a closer look, its just doing one 
job at a time.
This is what happens in all methods which are alsa related (transferring data, 
opening busses, etc... ):

if (stream==MustuxAudioDeviceMapper::CAPTURE)
        {
        do all things related to capture,
        when finished, end this method,
        so only the capture is handled;
        }
else
        {
        do all things related to playback,
        when finished, end this method,
        so only the playback is handled;
        }
        
My suggestion is, make "playback" and "capture" separate things, and have all 
alsa parameters for both "playback" and "capture"
So the:
snd_pcm_t* pcmHandle;
will be like:
snd_pcm_t* capture_handle, playback_handle;

So this will for example happen in 

int Bus::open(rate, frames, etc...)
        {
        if (playback_handle)
                {
                r = snd_pcm_open(&playback_handle, ((const char*) 
get_real_descriptor().ascii()), SND_PCM_STREAM_PLAYBACK, 0);
        }
        if (capture_handle)
                {
                r = snd_pcm_open(&capture_handle, ((const char*) 
get_real_descriptor().ascii()), SND_PCM_STREAM_CAPTURE, 0);
        }

        and so on for all capture/playback related stuff...

        return 1;
        }

Mixer then has only 1 thread, which only calls Bus->transfer(blabla) an all 
duplex stuff will be handled within Bus::transfer (like in Bus::open) 
_at_the_same_time_ !
Synchronizing playback/capture streams is also much easier from within 1 
thread?

Then there will be the multiple bit depth support, and thats something out of 
my sight. So I wanted to know from you what you think about all this, it 
requires some huge changes, but IMHO we will end up with a much stabler 
MustuxAudioBus related to alsa stuff. Also mixer will have only one thread 
instead of two, which makes life easier. (synchronizing two threads, or 
actually the dataflow in these threads, how to do that?)

I'm not going to work on the bug Reinhard has with his soundcard, as all the 
work I do now will be probably removed if this is gonna happen.
Also, I don't want to do things which makes it difficult to add multiple 
bitdepth/etc. support.

I hope that I've made clear what I wanted to make clear ;-)

Thanks,

Remon

P.S.
Reinhard, your bug isn't actually a bug, one of your playback busses ONLY 
works with 48 kHz. To make it work, you have to set the "rate" to "48000".
The only thing which is a bit strange is that "plughw" isn't working with your 
setup. But I gues it has to do with the alsa implementation in MAB, which 
would be solved if we decide to change it in the way explainded above. (much 
more robust, no longer one "handler" for different devices)





reply via email to

[Prev in Thread] Current Thread [Next in Thread]