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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 m_frame.imagp = 0; | 73 m_frame.imagp = 0; |
74 | 74 |
75 m_FFTSize = 0; | 75 m_FFTSize = 0; |
76 m_log2FFTSize = 0; | 76 m_log2FFTSize = 0; |
77 } | 77 } |
78 | 78 |
79 // Copy constructor | 79 // Copy constructor |
80 FFTFrame::FFTFrame(const FFTFrame& frame) | 80 FFTFrame::FFTFrame(const FFTFrame& frame) |
81 : m_FFTSize(frame.m_FFTSize) | 81 : m_FFTSize(frame.m_FFTSize) |
82 , m_log2FFTSize(frame.m_log2FFTSize) | 82 , m_log2FFTSize(frame.m_log2FFTSize) |
83 , m_FFTSetup(frame.m_FFTSetup) | |
84 , m_realData(frame.m_FFTSize) | 83 , m_realData(frame.m_FFTSize) |
85 , m_imagData(frame.m_FFTSize) | 84 , m_imagData(frame.m_FFTSize) |
| 85 , m_FFTSetup(frame.m_FFTSetup) |
86 { | 86 { |
87 // Setup frame data | 87 // Setup frame data |
88 m_frame.realp = m_realData.data(); | 88 m_frame.realp = m_realData.data(); |
89 m_frame.imagp = m_imagData.data(); | 89 m_frame.imagp = m_imagData.data(); |
90 | 90 |
91 // Copy/setup frame data | 91 // Copy/setup frame data |
92 unsigned nbytes = sizeof(float) * m_FFTSize; | 92 unsigned nbytes = sizeof(float) * m_FFTSize; |
93 memcpy(realData(), frame.m_frame.realp, nbytes); | 93 memcpy(realData(), frame.m_frame.realp, nbytes); |
94 memcpy(imagData(), frame.m_frame.imagp, nbytes); | 94 memcpy(imagData(), frame.m_frame.imagp, nbytes); |
95 } | 95 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 for (int i = 0; i < kMaxFFTPow2Size; ++i) { | 147 for (int i = 0; i < kMaxFFTPow2Size; ++i) { |
148 if (fftSetups[i]) | 148 if (fftSetups[i]) |
149 vDSP_destroy_fftsetup(fftSetups[i]); | 149 vDSP_destroy_fftsetup(fftSetups[i]); |
150 } | 150 } |
151 | 151 |
152 free(fftSetups); | 152 free(fftSetups); |
153 fftSetups = 0; | 153 fftSetups = 0; |
154 } | 154 } |
155 | 155 |
156 float* FFTFrame::realData() const | |
157 { | |
158 return m_frame.realp; | |
159 } | |
160 | |
161 float* FFTFrame::imagData() const | |
162 { | |
163 return m_frame.imagp; | |
164 } | |
165 | |
166 } // namespace blink | 156 } // namespace blink |
167 | 157 |
168 #endif // #if OS(MACOSX) | 158 #endif // #if OS(MACOSX) |
169 | 159 |
170 #endif // ENABLE(WEB_AUDIO) | 160 #endif // ENABLE(WEB_AUDIO) |
OLD | NEW |