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 * 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 17 matching lines...) Expand all Loading... |
28 #include "modules/webaudio/AudioBuffer.h" | 28 #include "modules/webaudio/AudioBuffer.h" |
29 #include "modules/webaudio/AudioNode.h" | 29 #include "modules/webaudio/AudioNode.h" |
30 #include "platform/audio/AudioBus.h" | 30 #include "platform/audio/AudioBus.h" |
31 #include "platform/audio/AudioIOCallback.h" | 31 #include "platform/audio/AudioIOCallback.h" |
32 #include "platform/audio/AudioSourceProvider.h" | 32 #include "platform/audio/AudioSourceProvider.h" |
33 | 33 |
34 namespace blink { | 34 namespace blink { |
35 | 35 |
36 class AudioBus; | 36 class AudioBus; |
37 class AbstractAudioContext; | 37 class AbstractAudioContext; |
| 38 class AudioTimestamp; |
38 | 39 |
39 class AudioDestinationHandler : public AudioHandler, public AudioIOCallback { | 40 class AudioDestinationHandler : public AudioHandler, public AudioIOCallback { |
40 public: | 41 public: |
41 AudioDestinationHandler(AudioNode&, float sampleRate); | 42 AudioDestinationHandler(AudioNode&, float sampleRate); |
42 ~AudioDestinationHandler() override; | 43 ~AudioDestinationHandler() override; |
43 | 44 |
44 // AudioHandler | 45 // AudioHandler |
45 void process(size_t) final { } // we're pulled by hardware so this is never
called | 46 void process(size_t) final { } // we're pulled by hardware so this is never
called |
46 | 47 |
47 // The audio hardware calls render() to get the next render quantum of audio
into destinationBus. | 48 // The audio hardware calls render() to get the next render quantum of audio
into destinationBus. |
48 // It will optionally give us local/live audio input in sourceBus (if it's n
ot 0). | 49 // It will optionally give us local/live audio input in sourceBus (if it's n
ot 0). |
49 void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFr
ames) final; | 50 void render(AudioBus* sourceBus, AudioBus* destinationBus, size_t numberOfFr
ames, const WebAudioTimestamp& outputTimestamp) final; |
50 | 51 |
51 size_t currentSampleFrame() const { return acquireLoad(&m_currentSampleFrame
); } | 52 size_t currentSampleFrame() const { return acquireLoad(&m_currentSampleFrame
); } |
52 double currentTime() const { return currentSampleFrame() / static_cast<doubl
e>(sampleRate()); } | 53 double currentTime() const { return currentSampleFrame() / static_cast<doubl
e>(sampleRate()); } |
53 | 54 |
54 virtual unsigned long maxChannelCount() const { return 0; } | 55 virtual unsigned long maxChannelCount() const { return 0; } |
55 | 56 |
56 virtual void startRendering() = 0; | 57 virtual void startRendering() = 0; |
57 virtual void stopRendering() = 0; | 58 virtual void stopRendering() = 0; |
58 | 59 |
59 protected: | 60 protected: |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 | 99 |
99 unsigned long maxChannelCount() const; | 100 unsigned long maxChannelCount() const; |
100 | 101 |
101 protected: | 102 protected: |
102 AudioDestinationNode(AbstractAudioContext&); | 103 AudioDestinationNode(AbstractAudioContext&); |
103 }; | 104 }; |
104 | 105 |
105 } // namespace blink | 106 } // namespace blink |
106 | 107 |
107 #endif // AudioDestinationNode_h | 108 #endif // AudioDestinationNode_h |
OLD | NEW |