summaryrefslogtreecommitdiff
path: root/Source/WebCore/Modules/webaudio/PeriodicWave.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/Modules/webaudio/PeriodicWave.h')
-rw-r--r--Source/WebCore/Modules/webaudio/PeriodicWave.h27
1 files changed, 15 insertions, 12 deletions
diff --git a/Source/WebCore/Modules/webaudio/PeriodicWave.h b/Source/WebCore/Modules/webaudio/PeriodicWave.h
index 79a098c55..0a1253c89 100644
--- a/Source/WebCore/Modules/webaudio/PeriodicWave.h
+++ b/Source/WebCore/Modules/webaudio/PeriodicWave.h
@@ -10,7 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
- * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * 3. Neither the name of Apple Inc. ("Apple") nor the names of
* its contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
@@ -26,13 +26,11 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef PeriodicWave_h
-#define PeriodicWave_h
+#pragma once
#include "AudioArray.h"
#include <memory>
#include <runtime/Float32Array.h>
-#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
@@ -41,13 +39,13 @@ namespace WebCore {
class PeriodicWave : public RefCounted<PeriodicWave> {
public:
- static PassRefPtr<PeriodicWave> createSine(float sampleRate);
- static PassRefPtr<PeriodicWave> createSquare(float sampleRate);
- static PassRefPtr<PeriodicWave> createSawtooth(float sampleRate);
- static PassRefPtr<PeriodicWave> createTriangle(float sampleRate);
+ static Ref<PeriodicWave> createSine(float sampleRate);
+ static Ref<PeriodicWave> createSquare(float sampleRate);
+ static Ref<PeriodicWave> createSawtooth(float sampleRate);
+ static Ref<PeriodicWave> createTriangle(float sampleRate);
// Creates an arbitrary wave given the frequency components (Fourier coefficients).
- static PassRefPtr<PeriodicWave> create(float sampleRate, Float32Array* real, Float32Array* imag);
+ static Ref<PeriodicWave> create(float sampleRate, Float32Array& real, Float32Array& imag);
// Returns pointers to the lower and higher wave data for the pitch range containing
// the given fundamental frequency. These two tables are in adjacent "pitch" ranges
@@ -64,9 +62,16 @@ public:
float sampleRate() const { return m_sampleRate; }
private:
+ enum class Type {
+ Sine,
+ Square,
+ Sawtooth,
+ Triangle,
+ };
+
explicit PeriodicWave(float sampleRate);
- void generateBasicWaveform(int);
+ void generateBasicWaveform(Type);
float m_sampleRate;
unsigned m_periodicWaveSize;
@@ -93,5 +98,3 @@ private:
};
} // namespace WebCore
-
-#endif // PeriodicWave_h