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/PassRefPtr.h" | 35 #include "wtf/PassRefPtr.h" |
36 #include "wtf/RefPtr.h" | 36 #include "wtf/RefPtr.h" |
37 #include "wtf/Vector.h" | 37 #include "wtf/Vector.h" |
38 #include "wtf/build_config.h" | 38 #include "wtf/build_config.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 | 41 |
42 class AudioBus; | 42 class AudioBus; |
43 class ExceptionState; | 43 class ExceptionState; |
44 | 44 |
45 class MODULES_EXPORT AudioBuffer final : public GarbageCollectedFinalized<AudioB
uffer>, public ScriptWrappable { | 45 class MODULES_EXPORT AudioBuffer final : public GarbageCollected<AudioBuffer>, p
ublic ScriptWrappable { |
46 DEFINE_WRAPPERTYPEINFO(); | 46 DEFINE_WRAPPERTYPEINFO(); |
47 public: | 47 public: |
48 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate); | 48 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate); |
49 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); | 49 static AudioBuffer* create(unsigned numberOfChannels, size_t numberOfFrames,
float sampleRate, ExceptionState&); |
50 | 50 |
51 // Returns 0 if data is not a valid audio file. | 51 // Returns 0 if data is not a valid audio file. |
52 static AudioBuffer* createFromAudioFileData(const void* data, size_t dataSiz
e, bool mixToMono, float sampleRate); | 52 static AudioBuffer* createFromAudioFileData(const void* data, size_t dataSiz
e, bool mixToMono, float sampleRate); |
53 | 53 |
54 static AudioBuffer* createFromAudioBus(AudioBus*); | 54 static AudioBuffer* createFromAudioBus(AudioBus*); |
55 | 55 |
(...skipping 12 matching lines...) Expand all Loading... |
68 void copyToChannel(DOMFloat32Array*, long channelNumber, unsigned long start
InChannel, ExceptionState&); | 68 void copyToChannel(DOMFloat32Array*, long channelNumber, unsigned long start
InChannel, ExceptionState&); |
69 | 69 |
70 void zero(); | 70 void zero(); |
71 | 71 |
72 DEFINE_INLINE_TRACE() | 72 DEFINE_INLINE_TRACE() |
73 { | 73 { |
74 visitor->trace(m_channels); | 74 visitor->trace(m_channels); |
75 } | 75 } |
76 | 76 |
77 private: | 77 private: |
| 78 explicit AudioBuffer(AudioBus*); |
| 79 |
78 static DOMFloat32Array* createFloat32ArrayOrNull(size_t length); | 80 static DOMFloat32Array* createFloat32ArrayOrNull(size_t length); |
79 | 81 |
80 protected: | |
81 AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRa
te); | 82 AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRa
te); |
82 explicit AudioBuffer(AudioBus*); | |
83 bool createdSuccessfully(unsigned desiredNumberOfChannels) const; | 83 bool createdSuccessfully(unsigned desiredNumberOfChannels) const; |
84 | 84 |
85 float m_sampleRate; | 85 float m_sampleRate; |
86 size_t m_length; | 86 size_t m_length; |
87 | 87 |
88 HeapVector<Member<DOMFloat32Array>> m_channels; | 88 HeapVector<Member<DOMFloat32Array>> m_channels; |
89 }; | 89 }; |
90 | 90 |
91 } // namespace blink | 91 } // namespace blink |
92 | 92 |
93 #endif // AudioBuffer_h | 93 #endif // AudioBuffer_h |
OLD | NEW |