OLD | NEW |
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_FAKE_AUDIO_RENDER_CALLBACK_H_ | 5 #ifndef MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
6 #define MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ | 6 #define MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 | 37 |
38 // AudioTransform::ProvideAudioTransformInput implementation. | 38 // AudioTransform::ProvideAudioTransformInput implementation. |
39 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; | 39 double ProvideInput(AudioBus* audio_bus, uint32_t frames_delayed) override; |
40 | 40 |
41 // Toggles only filling half the requested amount during Render(). | 41 // Toggles only filling half the requested amount during Render(). |
42 void set_half_fill(bool half_fill) { half_fill_ = half_fill; } | 42 void set_half_fill(bool half_fill) { half_fill_ = half_fill; } |
43 | 43 |
44 // Reset the sine state to initial value. | 44 // Reset the sine state to initial value. |
45 void reset() { x_ = 0; } | 45 void reset() { x_ = 0; } |
46 | 46 |
47 // Returns the last |frames_delayed| provided to Render() or -1 if | 47 // Returns the last |delay| provided to Render() or base::TimeDelta::Max() |
48 // no Render() call occurred. | 48 // if no Render() call occurred. |
49 int last_frames_delayed() const { return last_frames_delayed_; } | 49 base::TimeDelta last_delay() const { return last_delay_; } |
50 | 50 |
51 // Set volume information used by ProvideAudioTransformInput(). | 51 // Set volume information used by ProvideAudioTransformInput(). |
52 void set_volume(double volume) { volume_ = volume; } | 52 void set_volume(double volume) { volume_ = volume; } |
53 | 53 |
54 int last_channel_count() const { return last_channel_count_; } | 54 int last_channel_count() const { return last_channel_count_; } |
55 | 55 |
56 private: | 56 private: |
57 int RenderInternal(AudioBus* audio_bus, | 57 int RenderInternal(AudioBus* audio_bus, base::TimeDelta delay, double volume); |
58 uint32_t frames_delayed, | |
59 double volume); | |
60 | 58 |
61 bool half_fill_; | 59 bool half_fill_; |
62 double x_; | 60 double x_; |
63 double step_; | 61 double step_; |
64 int last_frames_delayed_; | 62 base::TimeDelta last_delay_; |
65 int last_channel_count_; | 63 int last_channel_count_; |
66 double volume_; | 64 double volume_; |
67 | 65 |
68 DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback); | 66 DISALLOW_COPY_AND_ASSIGN(FakeAudioRenderCallback); |
69 }; | 67 }; |
70 | 68 |
71 } // namespace media | 69 } // namespace media |
72 | 70 |
73 #endif // MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ | 71 #endif // MEDIA_BASE_FAKE_AUDIO_RENDER_CALLBACK_H_ |
OLD | NEW |