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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 // The waveform type. | 45 // The waveform type. |
46 // These must be defined as in the .idl file. | 46 // These must be defined as in the .idl file. |
47 enum { | 47 enum { |
48 SINE = 0, | 48 SINE = 0, |
49 SQUARE = 1, | 49 SQUARE = 1, |
50 SAWTOOTH = 2, | 50 SAWTOOTH = 2, |
51 TRIANGLE = 3, | 51 TRIANGLE = 3, |
52 CUSTOM = 4 | 52 CUSTOM = 4 |
53 }; | 53 }; |
54 | 54 |
55 static PassRefPtrWillBeRawPtr<OscillatorNode> create(AudioContext*, float sa
mpleRate); | 55 static OscillatorNode* create(AudioContext*, float sampleRate); |
56 | 56 |
57 virtual ~OscillatorNode(); | 57 virtual ~OscillatorNode(); |
58 | 58 |
59 // AudioNode | 59 // AudioNode |
60 virtual void dispose() OVERRIDE; | 60 virtual void dispose() OVERRIDE; |
61 virtual void process(size_t framesToProcess) OVERRIDE; | 61 virtual void process(size_t framesToProcess) OVERRIDE; |
62 | 62 |
63 String type() const; | 63 String type() const; |
64 | 64 |
65 void setType(const String&); | 65 void setType(const String&); |
(...skipping 12 matching lines...) Expand all Loading... |
78 | 78 |
79 // Returns true if there are sample-accurate timeline parameter changes. | 79 // Returns true if there are sample-accurate timeline parameter changes. |
80 bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess); | 80 bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess); |
81 | 81 |
82 virtual bool propagatesSilence() const OVERRIDE; | 82 virtual bool propagatesSilence() const OVERRIDE; |
83 | 83 |
84 // One of the waveform types defined in the enum. | 84 // One of the waveform types defined in the enum. |
85 unsigned short m_type; | 85 unsigned short m_type; |
86 | 86 |
87 // Frequency value in Hertz. | 87 // Frequency value in Hertz. |
88 RefPtrWillBeMember<AudioParam> m_frequency; | 88 Member<AudioParam> m_frequency; |
89 | 89 |
90 // Detune value (deviating from the frequency) in Cents. | 90 // Detune value (deviating from the frequency) in Cents. |
91 RefPtrWillBeMember<AudioParam> m_detune; | 91 Member<AudioParam> m_detune; |
92 | 92 |
93 bool m_firstRender; | 93 bool m_firstRender; |
94 | 94 |
95 // m_virtualReadIndex is a sample-frame index into our buffer representing t
he current playback position. | 95 // m_virtualReadIndex is a sample-frame index into our buffer representing t
he current playback position. |
96 // Since it's floating-point, it has sub-sample accuracy. | 96 // Since it's floating-point, it has sub-sample accuracy. |
97 double m_virtualReadIndex; | 97 double m_virtualReadIndex; |
98 | 98 |
99 // This synchronizes process(). | 99 // This synchronizes process(). |
100 mutable Mutex m_processLock; | 100 mutable Mutex m_processLock; |
101 | 101 |
102 // Stores sample-accurate values calculated according to frequency and detun
e. | 102 // Stores sample-accurate values calculated according to frequency and detun
e. |
103 AudioFloatArray m_phaseIncrements; | 103 AudioFloatArray m_phaseIncrements; |
104 AudioFloatArray m_detuneValues; | 104 AudioFloatArray m_detuneValues; |
105 | 105 |
106 RefPtrWillBeMember<PeriodicWave> m_periodicWave; | 106 Member<PeriodicWave> m_periodicWave; |
107 }; | 107 }; |
108 | 108 |
109 } // namespace blink | 109 } // namespace blink |
110 | 110 |
111 #endif // OscillatorNode_h | 111 #endif // OscillatorNode_h |
OLD | NEW |