OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 // m_virtualReadIndex is a sample-frame index into our buffer representing the | 89 // m_virtualReadIndex is a sample-frame index into our buffer representing the |
90 // current playback position. Since it's floating-point, it has sub-sample | 90 // current playback position. Since it's floating-point, it has sub-sample |
91 // accuracy. | 91 // accuracy. |
92 double m_virtualReadIndex; | 92 double m_virtualReadIndex; |
93 | 93 |
94 // Stores sample-accurate values calculated according to frequency and detune. | 94 // Stores sample-accurate values calculated according to frequency and detune. |
95 AudioFloatArray m_phaseIncrements; | 95 AudioFloatArray m_phaseIncrements; |
96 AudioFloatArray m_detuneValues; | 96 AudioFloatArray m_detuneValues; |
97 | 97 |
98 // This Persistent doesn't make a reference cycle including the owner | 98 // This Persistent doesn't make a reference cycle including the owner |
99 // OscillatorNode. | 99 // OscillatorNode. It is cross-thread, as it will be accessed by the audio |
100 Persistent<PeriodicWave> m_periodicWave; | 100 // thread. |
| 101 CrossThreadPersistent<PeriodicWave> m_periodicWave; |
101 }; | 102 }; |
102 | 103 |
103 class OscillatorNode final : public AudioScheduledSourceNode { | 104 class OscillatorNode final : public AudioScheduledSourceNode { |
104 DEFINE_WRAPPERTYPEINFO(); | 105 DEFINE_WRAPPERTYPEINFO(); |
105 | 106 |
106 public: | 107 public: |
107 static OscillatorNode* create(BaseAudioContext&, ExceptionState&); | 108 static OscillatorNode* create(BaseAudioContext&, ExceptionState&); |
108 static OscillatorNode* create(BaseAudioContext*, | 109 static OscillatorNode* create(BaseAudioContext*, |
109 const OscillatorOptions&, | 110 const OscillatorOptions&, |
110 ExceptionState&); | 111 ExceptionState&); |
111 DECLARE_VIRTUAL_TRACE(); | 112 DECLARE_VIRTUAL_TRACE(); |
112 | 113 |
113 String type() const; | 114 String type() const; |
114 void setType(const String&, ExceptionState&); | 115 void setType(const String&, ExceptionState&); |
115 AudioParam* frequency(); | 116 AudioParam* frequency(); |
116 AudioParam* detune(); | 117 AudioParam* detune(); |
117 void setPeriodicWave(PeriodicWave*); | 118 void setPeriodicWave(PeriodicWave*); |
118 | 119 |
119 private: | 120 private: |
120 OscillatorNode(BaseAudioContext&); | 121 OscillatorNode(BaseAudioContext&); |
121 OscillatorHandler& oscillatorHandler() const; | 122 OscillatorHandler& oscillatorHandler() const; |
122 | 123 |
123 Member<AudioParam> m_frequency; | 124 Member<AudioParam> m_frequency; |
124 Member<AudioParam> m_detune; | 125 Member<AudioParam> m_detune; |
125 }; | 126 }; |
126 | 127 |
127 } // namespace blink | 128 } // namespace blink |
128 | 129 |
129 #endif // OscillatorNode_h | 130 #endif // OscillatorNode_h |
OLD | NEW |