ALSA implementation

James Courtier-Dutton James at superbug.co.uk
Tue Sep 19 12:03:18 CDT 2006


Aaron Slunt wrote:
> Jan Zerebecki wrote:
>> On Sun, Sep 17, 2006 at 05:26:12PM +0100, James Courtier-Dutton wrote:
>>  
>>> I am an ALSA developer, and at one point tried to fix the wine alsa 
>>> support. I found the wine source code very difficult to read and 
>>> understand. Windows seems to have so many different sound APIs, I 
>>> did not really know where to start.
>>>     
>>
>> Everything in wine that uses alsa is below dlls/winmm/winealsa/.
>> I explained in a different mail to this thread what bugs are in
>> winealsa. (Archive link to that mail is:
>> http://www.winehq.org/pipermail/wine-devel/2006-September/050826.html )
>>
>>  
>>> I suspect that either wine will have to change a lot, or ALSA will 
>>> have to change a lot before they work nicely together.
>>>     
>>
>> As explained in the mail refrenced above the main problem is that
>> in wine the alsa callback signal (that we currently use) won't
>> work properly without special care, but the fd based method (for
>> example with select) should work as expected. We just need
>> someone to code this change.
>>
>> It seems I just found out how to fix the other winealsa problem I
>> mentioned in that mail, I'm currently testing if it works.
>>
>>
>> Jan
>>
>>
>>
>>
>>   
> Jan, could you please clarify what you mean by an fd-based method? 
> Thanks.
>
>
I have not looked at the wine source code lately, but I would advise you 
that it would be sensible to talk to the sound card at only the 48000 Hz 
rate.
If a windows application wants 44.1kHz, I would suggest that you add 
your own resampling code to wine.
The reason for this is that a Linux application can ask for some buffer 
size from the alsa-lib. If the sound card hardware cannot do that buffer 
size in hardware, alsa-lib will reject the request and leave it to the 
application to try a different value. This is all ok for an open source 
application, as one can just fix the application to act accordingly. 
This is not the case with a binary application like all the applications 
running on top of wine. One cannot fix those applications to work nicely 
with alsa-lib. As a majority of sound card hardware works nicely at 
48kHz, but very few sound cards do 44.1kHz in hardware, the application 
must then do the resampling necessary to achieve the task. alsa-lib does 
do resampling currently, but it has some importance constraints that I 
think are incompatible with wine. I would therefore recommend that wine 
does it's own resampling to 48kHz before passing sound to alsa-lib.
In time alsa will remove the resampling constraints present in alsa-lib, 
but that fix is not expected any time soon.
As most windows applications running on wine tend to use the 44.1kHz 
rate, that will cause problems with the current alsa-lib. So, if wine 
want windows games to work better with sound when using alsa-lib, I 
would recommend wine doing the resampling.

James





More information about the wine-devel mailing list