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

Side by Side Diff: media/base/audio_bus.h

Issue 13726011: Add vector_math::FMUL. Replace audio_util::AdjustVolume. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments. Created 7 years, 8 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 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef MEDIA_BASE_AUDIO_BUS_H_ 5 #ifndef MEDIA_BASE_AUDIO_BUS_H_
6 #define MEDIA_BASE_AUDIO_BUS_H_ 6 #define MEDIA_BASE_AUDIO_BUS_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/aligned_memory.h" 10 #include "base/memory/aligned_memory.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 85
86 int channels() const { return static_cast<int>(channel_data_.size()); } 86 int channels() const { return static_cast<int>(channel_data_.size()); }
87 int frames() const { return frames_; } 87 int frames() const { return frames_; }
88 void set_frames(int frames); 88 void set_frames(int frames);
89 89
90 // Helper method for zeroing out all channels of audio data. 90 // Helper method for zeroing out all channels of audio data.
91 void Zero(); 91 void Zero();
92 void ZeroFrames(int frames); 92 void ZeroFrames(int frames);
93 void ZeroFramesPartial(int start_frame, int frames); 93 void ZeroFramesPartial(int start_frame, int frames);
94 94
95 // Scale internal channel values by |volume| >= 0. If an invalid value
96 // is provided, no adjustment is done.
97 void Scale(float volume);
98
95 private: 99 private:
96 friend struct base::DefaultDeleter<AudioBus>; 100 friend struct base::DefaultDeleter<AudioBus>;
97 ~AudioBus(); 101 ~AudioBus();
98 102
99 AudioBus(int channels, int frames); 103 AudioBus(int channels, int frames);
100 AudioBus(int channels, int frames, float* data); 104 AudioBus(int channels, int frames, float* data);
101 AudioBus(int frames, const std::vector<float*>& channel_data); 105 AudioBus(int frames, const std::vector<float*>& channel_data);
102 explicit AudioBus(int channels); 106 explicit AudioBus(int channels);
103 107
104 // Helper method for building |channel_data_| from a block of memory. |data| 108 // Helper method for building |channel_data_| from a block of memory. |data|
105 // must be at least BlockSize() bytes in size. 109 // must be at least BlockSize() bytes in size.
106 void BuildChannelData(int channels, int aligned_frame, float* data); 110 void BuildChannelData(int channels, int aligned_frame, float* data);
107 111
108 // Contiguous block of channel memory. 112 // Contiguous block of channel memory.
109 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> data_; 113 scoped_ptr_malloc<float, base::ScopedPtrAlignedFree> data_;
110 114
111 std::vector<float*> channel_data_; 115 std::vector<float*> channel_data_;
112 int frames_; 116 int frames_;
113 117
114 // Protect SetChannelData() and set_frames() for use by CreateWrapper(). 118 // Protect SetChannelData() and set_frames() for use by CreateWrapper().
115 bool can_set_channel_data_; 119 bool can_set_channel_data_;
116 120
117 DISALLOW_COPY_AND_ASSIGN(AudioBus); 121 DISALLOW_COPY_AND_ASSIGN(AudioBus);
118 }; 122 };
119 123
120 } // namespace media 124 } // namespace media
121 125
122 #endif // MEDIA_BASE_AUDIO_BUS_H_ 126 #endif // MEDIA_BASE_AUDIO_BUS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698