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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "wtf/Noncopyable.h" | 35 #include "wtf/Noncopyable.h" |
36 #include <memory> | 36 #include <memory> |
37 | 37 |
38 namespace blink { | 38 namespace blink { |
39 | 39 |
40 class ReverbAccumulationBuffer; | 40 class ReverbAccumulationBuffer; |
41 class ReverbConvolver; | 41 class ReverbConvolver; |
42 class FFTConvolver; | 42 class FFTConvolver; |
43 class DirectConvolver; | 43 class DirectConvolver; |
44 | 44 |
45 // A ReverbConvolverStage represents the convolution associated with a sub-secti
on of a large impulse response. | 45 // A ReverbConvolverStage represents the convolution associated with a |
46 // It incorporates a delay line to account for the offset of the sub-section wit
hin the larger impulse response. | 46 // sub-section of a large impulse response. It incorporates a delay line to |
| 47 // account for the offset of the sub-section within the larger impulse |
| 48 // response. |
47 class PLATFORM_EXPORT ReverbConvolverStage { | 49 class PLATFORM_EXPORT ReverbConvolverStage { |
48 USING_FAST_MALLOC(ReverbConvolverStage); | 50 USING_FAST_MALLOC(ReverbConvolverStage); |
49 WTF_MAKE_NONCOPYABLE(ReverbConvolverStage); | 51 WTF_MAKE_NONCOPYABLE(ReverbConvolverStage); |
50 | 52 |
51 public: | 53 public: |
52 // renderPhase is useful to know so that we can manipulate the pre versus post
delay so that stages will perform | 54 // renderPhase is useful to know so that we can manipulate the pre versus post |
53 // their heavy work (FFT processing) on different slices to balance the load i
n a real-time thread. | 55 // delay so that stages will perform their heavy work (FFT processing) on |
| 56 // different slices to balance the load in a real-time thread. |
54 ReverbConvolverStage(const float* impulseResponse, | 57 ReverbConvolverStage(const float* impulseResponse, |
55 size_t responseLength, | 58 size_t responseLength, |
56 size_t reverbTotalLatency, | 59 size_t reverbTotalLatency, |
57 size_t stageOffset, | 60 size_t stageOffset, |
58 size_t stageLength, | 61 size_t stageLength, |
59 size_t fftSize, | 62 size_t fftSize, |
60 size_t renderPhase, | 63 size_t renderPhase, |
61 size_t renderSliceSize, | 64 size_t renderSliceSize, |
62 ReverbAccumulationBuffer*, | 65 ReverbAccumulationBuffer*, |
63 bool directMode = false); | 66 bool directMode = false); |
64 | 67 |
65 // WARNING: framesToProcess must be such that it evenly divides the delay buff
er size (stage_offset). | 68 // WARNING: framesToProcess must be such that it evenly divides the delay |
| 69 // buffer size (stage_offset). |
66 void process(const float* source, size_t framesToProcess); | 70 void process(const float* source, size_t framesToProcess); |
67 | 71 |
68 void processInBackground(ReverbConvolver* convolver, size_t framesToProcess); | 72 void processInBackground(ReverbConvolver* convolver, size_t framesToProcess); |
69 | 73 |
70 void reset(); | 74 void reset(); |
71 | 75 |
72 // Useful for background processing | 76 // Useful for background processing |
73 int inputReadIndex() const { return m_inputReadIndex; } | 77 int inputReadIndex() const { return m_inputReadIndex; } |
74 | 78 |
75 private: | 79 private: |
(...skipping 14 matching lines...) Expand all Loading... |
90 AudioFloatArray m_temporaryBuffer; | 94 AudioFloatArray m_temporaryBuffer; |
91 | 95 |
92 bool m_directMode; | 96 bool m_directMode; |
93 std::unique_ptr<AudioFloatArray> m_directKernel; | 97 std::unique_ptr<AudioFloatArray> m_directKernel; |
94 std::unique_ptr<DirectConvolver> m_directConvolver; | 98 std::unique_ptr<DirectConvolver> m_directConvolver; |
95 }; | 99 }; |
96 | 100 |
97 } // namespace blink | 101 } // namespace blink |
98 | 102 |
99 #endif // ReverbConvolverStage_h | 103 #endif // ReverbConvolverStage_h |
OLD | NEW |