OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 11 matching lines...) Expand all Loading... |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 */ | 23 */ |
24 | 24 |
25 #ifndef AudioUtilities_h | 25 #ifndef AudioUtilities_h |
26 #define AudioUtilities_h | 26 #define AudioUtilities_h |
27 | 27 |
28 #include "platform/PlatformExport.h" | 28 #include "platform/PlatformExport.h" |
29 #include "wtf/build_config.h" | 29 #include "wtf/build_config.h" |
30 #include <cstddef> | 30 #include <cstddef> |
31 | 31 |
32 #if ENABLE(WEB_AUDIO) | |
33 | |
34 namespace blink { | 32 namespace blink { |
35 namespace AudioUtilities { | 33 namespace AudioUtilities { |
36 | 34 |
37 // Standard functions for converting to and from decibel values from linear. | 35 // Standard functions for converting to and from decibel values from linear. |
38 PLATFORM_EXPORT float linearToDecibels(float); | 36 PLATFORM_EXPORT float linearToDecibels(float); |
39 PLATFORM_EXPORT float decibelsToLinear(float); | 37 PLATFORM_EXPORT float decibelsToLinear(float); |
40 | 38 |
41 // timeConstant is the time it takes a first-order linear time-invariant system | 39 // timeConstant is the time it takes a first-order linear time-invariant system |
42 // to reach the value 1 - 1/e (around 63.2%) given a step input response. | 40 // to reach the value 1 - 1/e (around 63.2%) given a step input response. |
43 // discreteTimeConstantForSampleRate() will return the discrete time-constant fo
r the specific sampleRate. | 41 // discreteTimeConstantForSampleRate() will return the discrete time-constant fo
r the specific sampleRate. |
44 PLATFORM_EXPORT double discreteTimeConstantForSampleRate(double timeConstant, do
uble sampleRate); | 42 PLATFORM_EXPORT double discreteTimeConstantForSampleRate(double timeConstant, do
uble sampleRate); |
45 | 43 |
46 // Convert the time to a sample frame at the given sample rate. | 44 // Convert the time to a sample frame at the given sample rate. |
47 PLATFORM_EXPORT size_t timeToSampleFrame(double time, double sampleRate); | 45 PLATFORM_EXPORT size_t timeToSampleFrame(double time, double sampleRate); |
48 | 46 |
49 // Check that |sampleRate| is a valid rate for AudioBuffers. | 47 // Check that |sampleRate| is a valid rate for AudioBuffers. |
50 PLATFORM_EXPORT bool isValidAudioBufferSampleRate(float sampleRate); | 48 PLATFORM_EXPORT bool isValidAudioBufferSampleRate(float sampleRate); |
51 | 49 |
52 // Return max/min sample rate supported by AudioBuffers. | 50 // Return max/min sample rate supported by AudioBuffers. |
53 PLATFORM_EXPORT float minAudioBufferSampleRate(); | 51 PLATFORM_EXPORT float minAudioBufferSampleRate(); |
54 PLATFORM_EXPORT float maxAudioBufferSampleRate(); | 52 PLATFORM_EXPORT float maxAudioBufferSampleRate(); |
55 } // AudioUtilites | 53 } // AudioUtilites |
56 } // namespace blink | 54 } // namespace blink |
57 | 55 |
58 #endif // ENABLE(WEB_AUDIO) | |
59 | |
60 #endif // AudioUtilities_h | 56 #endif // AudioUtilities_h |
OLD | NEW |