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 19 matching lines...) Expand all Loading... |
30 #include "wtf/PassRefPtr.h" | 30 #include "wtf/PassRefPtr.h" |
31 #include "wtf/Threading.h" | 31 #include "wtf/Threading.h" |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 class AudioContext; | 35 class AudioContext; |
36 | 36 |
37 // GainNode is an AudioNode with one input and one output which applies a gain (
volume) change to the audio signal. | 37 // GainNode is an AudioNode with one input and one output which applies a gain (
volume) change to the audio signal. |
38 // De-zippering (smoothing) is applied when the gain value is changed dynamicall
y. | 38 // De-zippering (smoothing) is applied when the gain value is changed dynamicall
y. |
39 | 39 |
40 class GainNode FINAL : public AudioNode { | 40 class GainNode final : public AudioNode { |
41 DEFINE_WRAPPERTYPEINFO(); | 41 DEFINE_WRAPPERTYPEINFO(); |
42 public: | 42 public: |
43 static GainNode* create(AudioContext* context, float sampleRate) | 43 static GainNode* create(AudioContext* context, float sampleRate) |
44 { | 44 { |
45 return adoptRefCountedGarbageCollectedWillBeNoop(new GainNode(context, s
ampleRate)); | 45 return adoptRefCountedGarbageCollectedWillBeNoop(new GainNode(context, s
ampleRate)); |
46 } | 46 } |
47 | 47 |
48 // AudioNode | 48 // AudioNode |
49 virtual void process(size_t framesToProcess) OVERRIDE; | 49 virtual void process(size_t framesToProcess) override; |
50 | 50 |
51 // Called in the main thread when the number of channels for the input may h
ave changed. | 51 // Called in the main thread when the number of channels for the input may h
ave changed. |
52 virtual void checkNumberOfChannelsForInput(AudioNodeInput*) OVERRIDE; | 52 virtual void checkNumberOfChannelsForInput(AudioNodeInput*) override; |
53 | 53 |
54 // JavaScript interface | 54 // JavaScript interface |
55 AudioParam* gain() { return m_gain.get(); } | 55 AudioParam* gain() { return m_gain.get(); } |
56 | 56 |
57 virtual void trace(Visitor*) OVERRIDE; | 57 virtual void trace(Visitor*) override; |
58 | 58 |
59 private: | 59 private: |
60 virtual double tailTime() const OVERRIDE { return 0; } | 60 virtual double tailTime() const override { return 0; } |
61 virtual double latencyTime() const OVERRIDE { return 0; } | 61 virtual double latencyTime() const override { return 0; } |
62 | 62 |
63 GainNode(AudioContext*, float sampleRate); | 63 GainNode(AudioContext*, float sampleRate); |
64 | 64 |
65 float m_lastGain; // for de-zippering | 65 float m_lastGain; // for de-zippering |
66 Member<AudioParam> m_gain; | 66 Member<AudioParam> m_gain; |
67 | 67 |
68 AudioFloatArray m_sampleAccurateGainValues; | 68 AudioFloatArray m_sampleAccurateGainValues; |
69 }; | 69 }; |
70 | 70 |
71 } // namespace blink | 71 } // namespace blink |
72 | 72 |
73 #endif // GainNode_h | 73 #endif // GainNode_h |
OLD | NEW |