Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(23)

Side by Side Diff: Source/modules/webaudio/OscillatorNode.h

Issue 205173002: Move webaudio to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 // The waveform type. 45 // The waveform type.
46 // These must be defined as in the .idl file. 46 // These must be defined as in the .idl file.
47 enum { 47 enum {
48 SINE = 0, 48 SINE = 0,
49 SQUARE = 1, 49 SQUARE = 1,
50 SAWTOOTH = 2, 50 SAWTOOTH = 2,
51 TRIANGLE = 3, 51 TRIANGLE = 3,
52 CUSTOM = 4 52 CUSTOM = 4
53 }; 53 };
54 54
55 static PassRefPtr<OscillatorNode> create(AudioContext*, float sampleRate); 55 static PassRefPtrWillBeRawPtr<OscillatorNode> create(AudioContext*, float sa mpleRate);
56 56
57 virtual ~OscillatorNode(); 57 virtual ~OscillatorNode();
58 58
59 // AudioNode 59 // AudioNode
60 virtual void process(size_t framesToProcess) OVERRIDE; 60 virtual void process(size_t framesToProcess) OVERRIDE;
61 61
62 String type() const; 62 String type() const;
63 63
64 void setType(const String&); 64 void setType(const String&);
65 65
66 AudioParam* frequency() { return m_frequency.get(); } 66 AudioParam* frequency() { return m_frequency.get(); }
67 AudioParam* detune() { return m_detune.get(); } 67 AudioParam* detune() { return m_detune.get(); }
68 68
69 void setPeriodicWave(PeriodicWave*); 69 void setPeriodicWave(PeriodicWave*);
70 70
71 virtual void trace(Visitor*) OVERRIDE;
72
71 private: 73 private:
72 OscillatorNode(AudioContext*, float sampleRate); 74 OscillatorNode(AudioContext*, float sampleRate);
73 75
74 bool setType(unsigned); // Returns true on success. 76 bool setType(unsigned); // Returns true on success.
75 77
76 // Returns true if there are sample-accurate timeline parameter changes. 78 // Returns true if there are sample-accurate timeline parameter changes.
77 bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess); 79 bool calculateSampleAccuratePhaseIncrements(size_t framesToProcess);
78 80
79 virtual bool propagatesSilence() const OVERRIDE; 81 virtual bool propagatesSilence() const OVERRIDE;
80 82
81 // One of the waveform types defined in the enum. 83 // One of the waveform types defined in the enum.
82 unsigned short m_type; 84 unsigned short m_type;
83 85
84 // Frequency value in Hertz. 86 // Frequency value in Hertz.
85 RefPtr<AudioParam> m_frequency; 87 RefPtrWillBeMember<AudioParam> m_frequency;
86 88
87 // Detune value (deviating from the frequency) in Cents. 89 // Detune value (deviating from the frequency) in Cents.
88 RefPtr<AudioParam> m_detune; 90 RefPtrWillBeMember<AudioParam> m_detune;
89 91
90 bool m_firstRender; 92 bool m_firstRender;
91 93
92 // m_virtualReadIndex is a sample-frame index into our buffer representing t he current playback position. 94 // m_virtualReadIndex is a sample-frame index into our buffer representing t he current playback position.
93 // Since it's floating-point, it has sub-sample accuracy. 95 // Since it's floating-point, it has sub-sample accuracy.
94 double m_virtualReadIndex; 96 double m_virtualReadIndex;
95 97
96 // This synchronizes process(). 98 // This synchronizes process().
97 mutable Mutex m_processLock; 99 mutable Mutex m_processLock;
98 100
99 // Stores sample-accurate values calculated according to frequency and detun e. 101 // Stores sample-accurate values calculated according to frequency and detun e.
100 AudioFloatArray m_phaseIncrements; 102 AudioFloatArray m_phaseIncrements;
101 AudioFloatArray m_detuneValues; 103 AudioFloatArray m_detuneValues;
102 104
103 RefPtr<PeriodicWave> m_periodicWave; 105 RefPtrWillBeMember<PeriodicWave> m_periodicWave;
104 }; 106 };
105 107
106 } // namespace WebCore 108 } // namespace WebCore
107 109
108 #endif // OscillatorNode_h 110 #endif // OscillatorNode_h
OLDNEW
« no previous file with comments | « Source/modules/webaudio/OfflineAudioDestinationNode.cpp ('k') | Source/modules/webaudio/OscillatorNode.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698