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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 static AudioBuffer* createFromAudioBus(AudioBus*); | 54 static AudioBuffer* createFromAudioBus(AudioBus*); |
55 | 55 |
56 // Format | 56 // Format |
57 size_t length() const { return m_length; } | 57 size_t length() const { return m_length; } |
58 double duration() const { return length() / static_cast<double>(sampleRate()
); } | 58 double duration() const { return length() / static_cast<double>(sampleRate()
); } |
59 float sampleRate() const { return m_sampleRate; } | 59 float sampleRate() const { return m_sampleRate; } |
60 | 60 |
61 // Channel data access | 61 // Channel data access |
62 unsigned numberOfChannels() const { return m_channels.size(); } | 62 unsigned numberOfChannels() const { return m_channels.size(); } |
63 PassRefPtr<DOMFloat32Array> getChannelData(unsigned channelIndex, ExceptionS
tate&); | 63 DOMFloat32Array* getChannelData(unsigned channelIndex, ExceptionState&); |
64 DOMFloat32Array* getChannelData(unsigned channelIndex); | 64 DOMFloat32Array* getChannelData(unsigned channelIndex); |
65 void copyFromChannel(DOMFloat32Array*, long channelNumber, ExceptionState&); | 65 void copyFromChannel(DOMFloat32Array*, long channelNumber, ExceptionState&); |
66 void copyFromChannel(DOMFloat32Array*, long channelNumber, unsigned long sta
rtInChannel, ExceptionState&); | 66 void copyFromChannel(DOMFloat32Array*, long channelNumber, unsigned long sta
rtInChannel, ExceptionState&); |
67 void copyToChannel(DOMFloat32Array*, long channelNumber, ExceptionState&); | 67 void copyToChannel(DOMFloat32Array*, long channelNumber, ExceptionState&); |
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 { |
| 74 visitor->trace(m_channels); |
| 75 } |
73 | 76 |
74 private: | 77 private: |
75 static PassRefPtr<DOMFloat32Array> createFloat32ArrayOrNull(size_t length); | 78 static DOMFloat32Array* createFloat32ArrayOrNull(size_t length); |
76 | 79 |
77 protected: | 80 protected: |
78 AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRa
te); | 81 AudioBuffer(unsigned numberOfChannels, size_t numberOfFrames, float sampleRa
te); |
79 explicit AudioBuffer(AudioBus*); | 82 explicit AudioBuffer(AudioBus*); |
80 bool createdSuccessfully(unsigned desiredNumberOfChannels) const; | 83 bool createdSuccessfully(unsigned desiredNumberOfChannels) const; |
81 | 84 |
82 float m_sampleRate; | 85 float m_sampleRate; |
83 size_t m_length; | 86 size_t m_length; |
84 | 87 |
85 Vector<RefPtr<DOMFloat32Array>> m_channels; | 88 HeapVector<Member<DOMFloat32Array>> m_channels; |
86 }; | 89 }; |
87 | 90 |
88 } // namespace blink | 91 } // namespace blink |
89 | 92 |
90 #endif // AudioBuffer_h | 93 #endif // AudioBuffer_h |
OLD | NEW |