OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 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 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #ifndef WebAudioDevice_h | 29 #ifndef WebAudioDevice_h |
30 #define WebAudioDevice_h | 30 #define WebAudioDevice_h |
31 | 31 |
32 #include "WebCommon.h" | 32 #include "WebCommon.h" |
33 #include "WebVector.h" | 33 #include "WebVector.h" |
34 | 34 |
35 namespace blink { | 35 namespace blink { |
36 | 36 |
37 // Abstract interface to the Chromium audio system. | 37 // Abstract interface to the Chromium audio system. |
38 | |
39 class WebAudioDevice { | 38 class WebAudioDevice { |
40 public: | 39 public: |
41 class BLINK_PLATFORM_EXPORT RenderCallback { | 40 class BLINK_PLATFORM_EXPORT RenderCallback { |
42 public: | 41 public: |
| 42 // Note: |delay| and |delayTimestamp| arguments are high-precision |
| 43 // measurements of the state of the system in the recent past. To be clear, |
| 44 // |delay| does *not* represent the point-in-time at which the first |
| 45 // rendered sample will be played out. |
43 virtual void render(const WebVector<float*>& sourceData, | 46 virtual void render(const WebVector<float*>& sourceData, |
44 const WebVector<float*>& destinationData, | 47 const WebVector<float*>& destinationData, |
45 size_t numberOfFrames); | 48 size_t numberOfFrames, |
| 49 double delay, // Output delay in seconds. |
| 50 double delayTimestamp, // System timestamp in seconds |
| 51 // when |delay| was obtained. |
| 52 size_t priorFramesSkipped); |
46 | 53 |
47 protected: | 54 protected: |
48 virtual ~RenderCallback(); | 55 virtual ~RenderCallback(); |
49 }; | 56 }; |
50 | 57 |
51 virtual ~WebAudioDevice() {} | 58 virtual ~WebAudioDevice() {} |
52 | 59 |
53 virtual void start() = 0; | 60 virtual void start() = 0; |
54 virtual void stop() = 0; | 61 virtual void stop() = 0; |
55 virtual double sampleRate() = 0; | 62 virtual double sampleRate() = 0; |
56 }; | 63 }; |
57 | 64 |
58 } // namespace blink | 65 } // namespace blink |
59 | 66 |
60 #endif // WebAudioDevice_h | 67 #endif // WebAudioDevice_h |
OLD | NEW |