Chromium Code Reviews| Index: media/base/audio_bus.h |
| =================================================================== |
| --- media/base/audio_bus.h (revision 157152) |
| +++ media/base/audio_bus.h (working copy) |
| @@ -30,6 +30,11 @@ |
| static scoped_ptr<AudioBus> Create(int channels, int frames); |
| static scoped_ptr<AudioBus> Create(const AudioParameters& params); |
| + // Creates a new AudioBus with the given number of channels, but zero length. |
| + // It's expected to be used with SetChannelData() and set_frames() to |
| + // reference externally allocated memory. |
| + static scoped_ptr<AudioBus> Create(int channels); |
|
DaleCurtis
2012/09/17 21:17:36
Since this technically isn't a normal Create() how
Chris Rogers
2012/09/17 22:00:42
Ok, SGTM
|
| + |
| // Creates a new AudioBus from an existing channel vector. Does not transfer |
| // ownership of |channel_data| to AudioBus; i.e., |channel_data| must outlive |
| // the returned AudioBus. Each channel must be aligned by kChannelAlignment. |
| @@ -74,9 +79,11 @@ |
| // inf, nan, or between [-1.0, 1.0]) values in the channel data. |
| float* channel(int channel) { return channel_data_[channel]; } |
| const float* channel(int channel) const { return channel_data_[channel]; } |
| + void SetChannelData(int channel, float* data); |
| int channels() const { return channel_data_.size(); } |
| int frames() const { return frames_; } |
| + void set_frames(int frames) { frames_ = frames; } |
|
DaleCurtis
2012/09/17 21:17:36
Hmm, I was thinking more along the lines of:
void
Chris Rogers
2012/09/17 22:00:42
Hmmm, I'm pretty sure we're going to want to be ab
|
| // Helper method for zeroing out all channels of audio data. |
| void Zero(); |
| @@ -90,6 +97,7 @@ |
| AudioBus(int channels, int frames); |
| AudioBus(int channels, int frames, float* data); |
| AudioBus(int frames, const std::vector<float*>& channel_data); |
| + AudioBus(int channels); |
| // Helper method for building |channel_data_| from a block of memory. |data| |
| // must be at least BlockSize() bytes in size. |