Add missing cast.
[wine] / dlls / quartz / amundoc.c
1 #include "config.h"
2
3 #include <math.h>
4 #include "windef.h"
5
6 #include "debugtools.h"
7 DEFAULT_DEBUG_CHANNEL(quartz);
8
9 /***********************************************************************
10  *              AmpFactorToDB (QUARTZ.@)
11  *
12  *      undocumented.
13  *  converting from Amp to dB?
14  *
15  */
16 LONG WINAPI QUARTZ_AmpFactorToDB( LONG amp )
17 {
18         LONG    dB;
19
20         FIXME( "(%08ld): undocumented API.\n", amp );
21
22         if ( amp <= 0 || amp > 65536 )
23                 return 0;
24
25         dB = (LONG)(2000.0 * log10((double)amp / 65536.0) + 0.5);
26         if ( dB >= 0 ) dB = 0;
27         if ( dB < -10000 ) dB = -10000;
28
29         return dB;
30 }
31
32 /***********************************************************************
33  *              DBToAmpFactor (QUARTZ.@)
34  *
35  *      undocumented.
36  *  converting from dB to Amp?
37  */
38 LONG WINAPI QUARTZ_DBToAmpFactor( LONG dB )
39 {
40         LONG    amp;
41
42         FIXME( "(%08ld): undocumented API.\n", dB );
43
44         if ( dB >= 0 )
45                 return 65535;
46         if ( dB < -10000 )
47                 return 0;
48
49         amp = (LONG)(pow(10.0,dB / 2000.0) * 65536.0 + 0.5);
50         if ( amp <= 0 ) amp = 1;
51         if ( amp >= 65536 ) amp = 65535;
52
53         return amp;
54 }
55