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 24 matching lines...) Expand all Loading... |
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 GainHandler final : public AudioHandler { | 40 class GainHandler final : public AudioHandler { |
41 public: | 41 public: |
42 static PassRefPtr<GainHandler> create(AudioNode&, float sampleRate, AudioPar
amHandler& gain); | 42 static PassRefPtr<GainHandler> create(AudioNode&, float sampleRate, AudioPar
amHandler& gain); |
43 | 43 |
44 // AudioHandler | 44 // AudioHandler |
45 virtual void process(size_t framesToProcess) override; | 45 void process(size_t framesToProcess) override; |
46 | 46 |
47 // Called in the main thread when the number of channels for the input may h
ave changed. | 47 // Called in the main thread when the number of channels for the input may h
ave changed. |
48 virtual void checkNumberOfChannelsForInput(AudioNodeInput*) override; | 48 void checkNumberOfChannelsForInput(AudioNodeInput*) override; |
49 | 49 |
50 private: | 50 private: |
51 GainHandler(AudioNode&, float sampleRate, AudioParamHandler& gain); | 51 GainHandler(AudioNode&, float sampleRate, AudioParamHandler& gain); |
52 | 52 |
53 float m_lastGain; // for de-zippering | 53 float m_lastGain; // for de-zippering |
54 RefPtr<AudioParamHandler> m_gain; | 54 RefPtr<AudioParamHandler> m_gain; |
55 | 55 |
56 AudioFloatArray m_sampleAccurateGainValues; | 56 AudioFloatArray m_sampleAccurateGainValues; |
57 }; | 57 }; |
58 | 58 |
59 class GainNode final : public AudioNode { | 59 class GainNode final : public AudioNode { |
60 DEFINE_WRAPPERTYPEINFO(); | 60 DEFINE_WRAPPERTYPEINFO(); |
61 public: | 61 public: |
62 static GainNode* create(AudioContext&, float sampleRate); | 62 static GainNode* create(AudioContext&, float sampleRate); |
63 DECLARE_VIRTUAL_TRACE(); | 63 DECLARE_VIRTUAL_TRACE(); |
64 | 64 |
65 AudioParam* gain() const; | 65 AudioParam* gain() const; |
66 | 66 |
67 private: | 67 private: |
68 GainNode(AudioContext&, float sampleRate); | 68 GainNode(AudioContext&, float sampleRate); |
69 | 69 |
70 Member<AudioParam> m_gain; | 70 Member<AudioParam> m_gain; |
71 }; | 71 }; |
72 | 72 |
73 } // namespace blink | 73 } // namespace blink |
74 | 74 |
75 #endif // GainNode_h | 75 #endif // GainNode_h |
OLD | NEW |