OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012, Google Inc. All rights reserved. | 2 * Copyright (C) 2012, 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 // These must be defined as in the .idl file. | 47 // These must be defined as in the .idl file. |
48 enum { | 48 enum { |
49 SINE = 0, | 49 SINE = 0, |
50 SQUARE = 1, | 50 SQUARE = 1, |
51 SAWTOOTH = 2, | 51 SAWTOOTH = 2, |
52 TRIANGLE = 3, | 52 TRIANGLE = 3, |
53 CUSTOM = 4 | 53 CUSTOM = 4 |
54 }; | 54 }; |
55 | 55 |
56 static PassRefPtr<OscillatorHandler> create(AudioNode&, float sampleRate, Au
dioParamHandler& frequency, AudioParamHandler& detune); | 56 static PassRefPtr<OscillatorHandler> create(AudioNode&, float sampleRate, Au
dioParamHandler& frequency, AudioParamHandler& detune); |
57 virtual ~OscillatorHandler(); | 57 ~OscillatorHandler() override; |
58 | 58 |
59 // AudioHandler | 59 // AudioHandler |
60 virtual void process(size_t framesToProcess) override; | 60 void process(size_t framesToProcess) override; |
61 | 61 |
62 String type() const; | 62 String type() const; |
63 void setType(const String&, ExceptionState&); | 63 void setType(const String&, ExceptionState&); |
64 | 64 |
65 void setPeriodicWave(PeriodicWave*); | 65 void setPeriodicWave(PeriodicWave*); |
66 | 66 |
67 private: | 67 private: |
68 OscillatorHandler(AudioNode&, float sampleRate, AudioParamHandler& frequency
, AudioParamHandler& detune); | 68 OscillatorHandler(AudioNode&, float sampleRate, AudioParamHandler& frequency
, AudioParamHandler& detune); |
69 bool setType(unsigned); // Returns true on success. | 69 bool setType(unsigned); // Returns true on success. |
70 | 70 |
71 // Returns true if there are sample-accurate timeline parameter changes. | 71 // Returns true if there are sample-accurate timeline parameter changes. |
72 bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess); | 72 bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess); |
73 | 73 |
74 virtual bool propagatesSilence() const override; | 74 bool propagatesSilence() const override; |
75 | 75 |
76 // One of the waveform types defined in the enum. | 76 // One of the waveform types defined in the enum. |
77 unsigned short m_type; | 77 unsigned short m_type; |
78 | 78 |
79 // Frequency value in Hertz. | 79 // Frequency value in Hertz. |
80 RefPtr<AudioParamHandler> m_frequency; | 80 RefPtr<AudioParamHandler> m_frequency; |
81 | 81 |
82 // Detune value (deviating from the frequency) in Cents. | 82 // Detune value (deviating from the frequency) in Cents. |
83 RefPtr<AudioParamHandler> m_detune; | 83 RefPtr<AudioParamHandler> m_detune; |
84 | 84 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 OscillatorNode(AudioContext&, float sampleRate); | 116 OscillatorNode(AudioContext&, float sampleRate); |
117 OscillatorHandler& oscillatorHandler() const; | 117 OscillatorHandler& oscillatorHandler() const; |
118 | 118 |
119 Member<AudioParam> m_frequency; | 119 Member<AudioParam> m_frequency; |
120 Member<AudioParam> m_detune; | 120 Member<AudioParam> m_detune; |
121 }; | 121 }; |
122 | 122 |
123 } // namespace blink | 123 } // namespace blink |
124 | 124 |
125 #endif // OscillatorNode_h | 125 #endif // OscillatorNode_h |
OLD | NEW |