| 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 13 matching lines...) Expand all Loading... |
| 24 | 24 |
| 25 #ifndef AnalyserNode_h | 25 #ifndef AnalyserNode_h |
| 26 #define AnalyserNode_h | 26 #define AnalyserNode_h |
| 27 | 27 |
| 28 #include "modules/webaudio/AudioBasicInspectorNode.h" | 28 #include "modules/webaudio/AudioBasicInspectorNode.h" |
| 29 #include "modules/webaudio/RealtimeAnalyser.h" | 29 #include "modules/webaudio/RealtimeAnalyser.h" |
| 30 #include "wtf/Forward.h" | 30 #include "wtf/Forward.h" |
| 31 | 31 |
| 32 namespace WebCore { | 32 namespace WebCore { |
| 33 | 33 |
| 34 class ExceptionState; | |
| 35 | |
| 36 class AnalyserNode : public AudioBasicInspectorNode { | 34 class AnalyserNode : public AudioBasicInspectorNode { |
| 37 public: | 35 public: |
| 38 static PassRefPtr<AnalyserNode> create(AudioContext* context, float sampleRa
te) | 36 static PassRefPtr<AnalyserNode> create(AudioContext* context, float sampleRa
te) |
| 39 { | 37 { |
| 40 return adoptRef(new AnalyserNode(context, sampleRate)); | 38 return adoptRef(new AnalyserNode(context, sampleRate)); |
| 41 } | 39 } |
| 42 | 40 |
| 43 virtual ~AnalyserNode(); | 41 virtual ~AnalyserNode(); |
| 44 | 42 |
| 45 // AudioNode | 43 // AudioNode |
| 46 virtual void process(size_t framesToProcess); | 44 virtual void process(size_t framesToProcess); |
| 47 virtual void reset(); | 45 virtual void reset(); |
| 48 | 46 |
| 49 // Javascript bindings | 47 // Javascript bindings |
| 50 unsigned fftSize() const { return m_analyser.fftSize(); } | 48 unsigned fftSize() const { return m_analyser.fftSize(); } |
| 51 void setFftSize(unsigned size, ExceptionState&); | 49 void setFftSize(unsigned size, ExceptionCode&); |
| 52 | 50 |
| 53 unsigned frequencyBinCount() const { return m_analyser.frequencyBinCount();
} | 51 unsigned frequencyBinCount() const { return m_analyser.frequencyBinCount();
} |
| 54 | 52 |
| 55 void setMinDecibels(float k) { m_analyser.setMinDecibels(k); } | 53 void setMinDecibels(float k) { m_analyser.setMinDecibels(k); } |
| 56 float minDecibels() const { return m_analyser.minDecibels(); } | 54 float minDecibels() const { return m_analyser.minDecibels(); } |
| 57 | 55 |
| 58 void setMaxDecibels(float k) { m_analyser.setMaxDecibels(k); } | 56 void setMaxDecibels(float k) { m_analyser.setMaxDecibels(k); } |
| 59 float maxDecibels() const { return m_analyser.maxDecibels(); } | 57 float maxDecibels() const { return m_analyser.maxDecibels(); } |
| 60 | 58 |
| 61 void setSmoothingTimeConstant(float k) { m_analyser.setSmoothingTimeConstant
(k); } | 59 void setSmoothingTimeConstant(float k) { m_analyser.setSmoothingTimeConstant
(k); } |
| 62 float smoothingTimeConstant() const { return m_analyser.smoothingTimeConstan
t(); } | 60 float smoothingTimeConstant() const { return m_analyser.smoothingTimeConstan
t(); } |
| 63 | 61 |
| 64 void getFloatFrequencyData(Float32Array* array) { m_analyser.getFloatFrequen
cyData(array); } | 62 void getFloatFrequencyData(Float32Array* array) { m_analyser.getFloatFrequen
cyData(array); } |
| 65 void getByteFrequencyData(Uint8Array* array) { m_analyser.getByteFrequencyDa
ta(array); } | 63 void getByteFrequencyData(Uint8Array* array) { m_analyser.getByteFrequencyDa
ta(array); } |
| 66 void getByteTimeDomainData(Uint8Array* array) { m_analyser.getByteTimeDomain
Data(array); } | 64 void getByteTimeDomainData(Uint8Array* array) { m_analyser.getByteTimeDomain
Data(array); } |
| 67 | 65 |
| 68 private: | 66 private: |
| 69 virtual double tailTime() const OVERRIDE { return 0; } | 67 virtual double tailTime() const OVERRIDE { return 0; } |
| 70 virtual double latencyTime() const OVERRIDE { return 0; } | 68 virtual double latencyTime() const OVERRIDE { return 0; } |
| 71 | 69 |
| 72 AnalyserNode(AudioContext*, float sampleRate); | 70 AnalyserNode(AudioContext*, float sampleRate); |
| 73 | 71 |
| 74 RealtimeAnalyser m_analyser; | 72 RealtimeAnalyser m_analyser; |
| 75 }; | 73 }; |
| 76 | 74 |
| 77 } // namespace WebCore | 75 } // namespace WebCore |
| 78 | 76 |
| 79 #endif // AnalyserNode_h | 77 #endif // AnalyserNode_h |
| OLD | NEW |