[MPlayer-dev-eng] [PATCH] Volume for ao_macosx

Dan Christiansen danchr at daimi.au.dk
Fri May 23 09:38:35 CEST 2003


On Friday, May 23, 2003, at 01:51 AM, Arpi wrote:

> Hi,
>
>> Attached below is a patch which adds volume control to ao_macosx. I
>> took a peak at af_volume etc., to see if that could handle it, but it
>> seemed nearly impossible. So I extracted the required parts from
>
> why impossible?

I was too harsh in my wording, it's not impossible but nearly 
impossible. As pointed out in the more recent mails in the "[PATCH] Mac 
OS X native audio output" thread, this would require either a seriously 
ugly hack (not an option) or a lot of work. Work which, IMHO, simply 
would not be worth it.

I still don't think volume control belongs in a low level driver like 
this one, but it seems that mplayer g1 requires it, and that changing 
it is one of those things which could be improved in g2.

>> af_volume.c and simplified them.
>
> refused!!!!!!!!!!!!
>
> it's like copy video filters code to vo drivers...

Not really. I had made my own attempt at this, and it was very similar 
to the current result, only uglier and non-functional. In the af, there 
are some special cases and extra features which are unnecessary and 
could be removed. It is only in the order of one to two lines of code 
which are intact, the rest where either absent or tweaked for the 
situation always present in ao_macosx. I did indeed begin with 
copy-pasting, which is why I give due credit to the filter, but the 
result is a clean and simple volume control specifically for ao_macosx.

>> There's one small thing that I don't understand me, namely soft
>> clipping:
>>> if (x >=  M_PI/2)
>>>   x = 1.0;
>>> else if(x <= -M_PI/2)
>>>   x = -1.0;
>>> else
>>>   x = sin(x);
>>
>> What does the last line do?
>
> x = sinus x
>
> do you know the sinus curve, don't you? :)

I do know _what_ it does, but I wondered _why_ it did it. (Note to 
self: Go to bed before 1:00 - for the better of the world.) Anders 
answered my question, and I'll either switch to using hard clipping or 
no clipping at all. Reading and understanding are not necessarily the 
same, you know... ;)

Anyway, I thought you had stopped maintaining >0.90 MPlayer?

- Dan



More information about the MPlayer-dev-eng mailing list