2 * Copyright (C) Hidenori TAKESHIMA
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 #include "wine/obj_base.h"
25 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(quartz
);
28 #include "quartz_private.h"
30 /***********************************************************************
31 * AmpFactorToDB (QUARTZ.@)
34 * converting from Amp to dB?
37 LONG WINAPI
QUARTZ_AmpFactorToDB( LONG amp
)
41 TRACE( "(%ld)\n", amp
);
43 if ( amp
<= 0 || amp
> 65536 )
46 dB
= (LONG
)(2000.0 * log10((double)amp
/ 65536.0) + 0.5);
47 if ( dB
>= 0 ) dB
= 0;
48 if ( dB
< -10000 ) dB
= -10000;
53 /***********************************************************************
54 * DBToAmpFactor (QUARTZ.@)
57 * converting from dB to Amp?
59 LONG WINAPI
QUARTZ_DBToAmpFactor( LONG dB
)
63 TRACE( "(%ld)\n", dB
);
70 amp
= (LONG
)(pow(10.0,dB
/ 2000.0) * 65536.0 + 0.5);
71 if ( amp
<= 0 ) amp
= 1;
72 if ( amp
>= 65536 ) amp
= 65535;