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 18 matching lines...) Expand all Loading... |
29 #include "modules/webaudio/AudioNode.h" | 29 #include "modules/webaudio/AudioNode.h" |
30 #include "modules/webaudio/AudioParam.h" | 30 #include "modules/webaudio/AudioParam.h" |
31 #include "wtf/PassRefPtr.h" | 31 #include "wtf/PassRefPtr.h" |
32 #include "wtf/Threading.h" | 32 #include "wtf/Threading.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class BaseAudioContext; | 36 class BaseAudioContext; |
37 class GainOptions; | 37 class GainOptions; |
38 | 38 |
39 // GainNode is an AudioNode with one input and one output which applies a gain (
volume) change to the audio signal. | 39 // GainNode is an AudioNode with one input and one output which applies a gain |
40 // De-zippering (smoothing) is applied when the gain value is changed dynamicall
y. | 40 // (volume) change to the audio signal. De-zippering (smoothing) is applied |
| 41 // when the gain value is changed dynamically. |
41 | 42 |
42 class GainHandler final : public AudioHandler { | 43 class GainHandler final : public AudioHandler { |
43 public: | 44 public: |
44 static PassRefPtr<GainHandler> create(AudioNode&, | 45 static PassRefPtr<GainHandler> create(AudioNode&, |
45 float sampleRate, | 46 float sampleRate, |
46 AudioParamHandler& gain); | 47 AudioParamHandler& gain); |
47 | 48 |
48 // AudioHandler | 49 // AudioHandler |
49 void process(size_t framesToProcess) override; | 50 void process(size_t framesToProcess) override; |
50 | 51 |
51 // Called in the main thread when the number of channels for the input may hav
e changed. | 52 // Called in the main thread when the number of channels for the input may |
| 53 // have changed. |
52 void checkNumberOfChannelsForInput(AudioNodeInput*) override; | 54 void checkNumberOfChannelsForInput(AudioNodeInput*) override; |
53 | 55 |
54 private: | 56 private: |
55 GainHandler(AudioNode&, float sampleRate, AudioParamHandler& gain); | 57 GainHandler(AudioNode&, float sampleRate, AudioParamHandler& gain); |
56 | 58 |
57 float m_lastGain; // for de-zippering | 59 float m_lastGain; // for de-zippering |
58 RefPtr<AudioParamHandler> m_gain; | 60 RefPtr<AudioParamHandler> m_gain; |
59 | 61 |
60 AudioFloatArray m_sampleAccurateGainValues; | 62 AudioFloatArray m_sampleAccurateGainValues; |
61 }; | 63 }; |
(...skipping 12 matching lines...) Expand all Loading... |
74 | 76 |
75 private: | 77 private: |
76 GainNode(BaseAudioContext&); | 78 GainNode(BaseAudioContext&); |
77 | 79 |
78 Member<AudioParam> m_gain; | 80 Member<AudioParam> m_gain; |
79 }; | 81 }; |
80 | 82 |
81 } // namespace blink | 83 } // namespace blink |
82 | 84 |
83 #endif // GainNode_h | 85 #endif // GainNode_h |
OLD | NEW |