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 * 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 void getByteFrequencyData(DOMUint8Array* array, double currentTime) { | 68 void getByteFrequencyData(DOMUint8Array* array, double currentTime) { |
69 m_analyser.getByteFrequencyData(array, currentTime); | 69 m_analyser.getByteFrequencyData(array, currentTime); |
70 } | 70 } |
71 void getFloatTimeDomainData(DOMFloat32Array* array) { | 71 void getFloatTimeDomainData(DOMFloat32Array* array) { |
72 m_analyser.getFloatTimeDomainData(array); | 72 m_analyser.getFloatTimeDomainData(array); |
73 } | 73 } |
74 void getByteTimeDomainData(DOMUint8Array* array) { | 74 void getByteTimeDomainData(DOMUint8Array* array) { |
75 m_analyser.getByteTimeDomainData(array); | 75 m_analyser.getByteTimeDomainData(array); |
76 } | 76 } |
77 | 77 |
| 78 // AnalyserNode needs special handling when updating the pull status |
| 79 // because the node must get pulled even if there are no inputs or |
| 80 // outputs so that the internal state is properly updated with the |
| 81 // correct time data. |
| 82 void updatePullStatus() override; |
| 83 |
78 private: | 84 private: |
79 AnalyserHandler(AudioNode&, float sampleRate); | 85 AnalyserHandler(AudioNode&, float sampleRate); |
| 86 bool propagatesSilence() const { |
| 87 // An AnalyserNode does actually propogate silence, but to get the |
| 88 // time and FFT data updated correctly, process() needs to be |
| 89 // called even if all the inputs are silent. |
| 90 return false; |
| 91 } |
80 | 92 |
81 RealtimeAnalyser m_analyser; | 93 RealtimeAnalyser m_analyser; |
82 }; | 94 }; |
83 | 95 |
84 class AnalyserNode final : public AudioBasicInspectorNode { | 96 class AnalyserNode final : public AudioBasicInspectorNode { |
85 DEFINE_WRAPPERTYPEINFO(); | 97 DEFINE_WRAPPERTYPEINFO(); |
86 | 98 |
87 public: | 99 public: |
88 static AnalyserNode* create(BaseAudioContext&, ExceptionState&); | 100 static AnalyserNode* create(BaseAudioContext&, ExceptionState&); |
89 static AnalyserNode* create(BaseAudioContext*, | 101 static AnalyserNode* create(BaseAudioContext*, |
(...skipping 17 matching lines...) Expand all Loading... |
107 private: | 119 private: |
108 AnalyserNode(BaseAudioContext&); | 120 AnalyserNode(BaseAudioContext&); |
109 AnalyserHandler& analyserHandler() const; | 121 AnalyserHandler& analyserHandler() const; |
110 | 122 |
111 void setMinMaxDecibels(double min, double max, ExceptionState&); | 123 void setMinMaxDecibels(double min, double max, ExceptionState&); |
112 }; | 124 }; |
113 | 125 |
114 } // namespace blink | 126 } // namespace blink |
115 | 127 |
116 #endif // AnalyserNode_h | 128 #endif // AnalyserNode_h |
OLD | NEW |