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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 AudioDSPKernel(float sampleRate) | 50 AudioDSPKernel(float sampleRate) |
51 : m_kernelProcessor(nullptr), m_sampleRate(sampleRate) {} | 51 : m_kernelProcessor(nullptr), m_sampleRate(sampleRate) {} |
52 | 52 |
53 virtual ~AudioDSPKernel(); | 53 virtual ~AudioDSPKernel(); |
54 | 54 |
55 // Subclasses must override process() to do the processing and reset() to | 55 // Subclasses must override process() to do the processing and reset() to |
56 // reset DSP state. | 56 // reset DSP state. |
57 virtual void process(const float* source, | 57 virtual void process(const float* source, |
58 float* destination, | 58 float* destination, |
59 size_t framesToProcess) = 0; | 59 size_t framesToProcess) = 0; |
| 60 // Subclasses that have AudioParams must override this to process the |
| 61 // AudioParams. |
| 62 virtual void processOnlyAudioParams(size_t framesToProcess){}; |
60 virtual void reset() = 0; | 63 virtual void reset() = 0; |
61 | 64 |
62 float sampleRate() const { return m_sampleRate; } | 65 float sampleRate() const { return m_sampleRate; } |
63 double nyquist() const { return 0.5 * sampleRate(); } | 66 double nyquist() const { return 0.5 * sampleRate(); } |
64 | 67 |
65 AudioDSPKernelProcessor* processor() { return m_kernelProcessor; } | 68 AudioDSPKernelProcessor* processor() { return m_kernelProcessor; } |
66 const AudioDSPKernelProcessor* processor() const { return m_kernelProcessor; } | 69 const AudioDSPKernelProcessor* processor() const { return m_kernelProcessor; } |
67 | 70 |
68 virtual double tailTime() const = 0; | 71 virtual double tailTime() const = 0; |
69 virtual double latencyTime() const = 0; | 72 virtual double latencyTime() const = 0; |
70 | 73 |
71 protected: | 74 protected: |
72 // This raw pointer is safe because the AudioDSPKernelProcessor object is | 75 // This raw pointer is safe because the AudioDSPKernelProcessor object is |
73 // guaranteed to be kept alive while the AudioDSPKernel object is alive. | 76 // guaranteed to be kept alive while the AudioDSPKernel object is alive. |
74 AudioDSPKernelProcessor* m_kernelProcessor; | 77 AudioDSPKernelProcessor* m_kernelProcessor; |
75 float m_sampleRate; | 78 float m_sampleRate; |
76 }; | 79 }; |
77 | 80 |
78 } // namespace blink | 81 } // namespace blink |
79 | 82 |
80 #endif // AudioDSPKernel_h | 83 #endif // AudioDSPKernel_h |
OLD | NEW |