| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011, Google Inc. All rights reserved. | 2 * Copyright (C) 2011, 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 |
| 11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
| 12 * | 12 * |
| 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND |
| 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | 14 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE | 15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE | 16 * ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE |
| 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | 17 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH | 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH |
| 23 * DAMAGE. | 23 * DAMAGE. |
| 24 */ | 24 */ |
| 25 | 25 |
| 26 #ifndef DefaultAudioDestinationNode_h | 26 #ifndef DefaultAudioDestinationNode_h |
| 27 #define DefaultAudioDestinationNode_h | 27 #define DefaultAudioDestinationNode_h |
| 28 | 28 |
| 29 #include <memory> |
| 29 #include "modules/webaudio/AudioDestinationNode.h" | 30 #include "modules/webaudio/AudioDestinationNode.h" |
| 30 #include "platform/audio/AudioDestination.h" | 31 #include "platform/audio/AudioDestination.h" |
| 31 #include <memory> | 32 #include "public/platform/WebAudioLatencyHint.h" |
| 32 | 33 |
| 33 namespace blink { | 34 namespace blink { |
| 34 | 35 |
| 35 class BaseAudioContext; | 36 class BaseAudioContext; |
| 36 class ExceptionState; | 37 class ExceptionState; |
| 38 class WebAudioLatencyHint; |
| 37 | 39 |
| 38 class DefaultAudioDestinationHandler final : public AudioDestinationHandler { | 40 class DefaultAudioDestinationHandler final : public AudioDestinationHandler { |
| 39 public: | 41 public: |
| 40 static PassRefPtr<DefaultAudioDestinationHandler> create(AudioNode&); | 42 static PassRefPtr<DefaultAudioDestinationHandler> create( |
| 43 AudioNode&, |
| 44 const WebAudioLatencyHint&); |
| 41 ~DefaultAudioDestinationHandler() override; | 45 ~DefaultAudioDestinationHandler() override; |
| 42 | 46 |
| 43 // AudioHandler | 47 // AudioHandler |
| 44 void dispose() override; | 48 void dispose() override; |
| 45 void initialize() override; | 49 void initialize() override; |
| 46 void uninitialize() override; | 50 void uninitialize() override; |
| 47 void setChannelCount(unsigned long, ExceptionState&) override; | 51 void setChannelCount(unsigned long, ExceptionState&) override; |
| 48 | 52 |
| 49 // AudioDestinationHandler | 53 // AudioDestinationHandler |
| 50 void startRendering() override; | 54 void startRendering() override; |
| 51 void stopRendering() override; | 55 void stopRendering() override; |
| 52 unsigned long maxChannelCount() const override; | 56 unsigned long maxChannelCount() const override; |
| 53 // Returns the rendering callback buffer size. | 57 // Returns the rendering callback buffer size. |
| 54 size_t callbackBufferSize() const override; | 58 size_t callbackBufferSize() const override; |
| 59 double sampleRate() const override; |
| 60 int framesPerBuffer() const override; |
| 55 | 61 |
| 56 private: | 62 private: |
| 57 explicit DefaultAudioDestinationHandler(AudioNode&); | 63 explicit DefaultAudioDestinationHandler(AudioNode&, |
| 64 const WebAudioLatencyHint&); |
| 58 void createDestination(); | 65 void createDestination(); |
| 59 | 66 |
| 60 std::unique_ptr<AudioDestination> m_destination; | 67 std::unique_ptr<AudioDestination> m_destination; |
| 61 String m_inputDeviceId; | 68 String m_inputDeviceId; |
| 62 unsigned m_numberOfInputChannels; | 69 unsigned m_numberOfInputChannels; |
| 70 const WebAudioLatencyHint m_latencyHint; |
| 63 }; | 71 }; |
| 64 | 72 |
| 65 class DefaultAudioDestinationNode final : public AudioDestinationNode { | 73 class DefaultAudioDestinationNode final : public AudioDestinationNode { |
| 66 public: | 74 public: |
| 67 static DefaultAudioDestinationNode* create(BaseAudioContext*); | 75 static DefaultAudioDestinationNode* create(BaseAudioContext*, |
| 76 const WebAudioLatencyHint&); |
| 68 | 77 |
| 69 size_t callbackBufferSize() const { return handler().callbackBufferSize(); }; | 78 size_t callbackBufferSize() const { return handler().callbackBufferSize(); }; |
| 70 | 79 |
| 71 private: | 80 private: |
| 72 explicit DefaultAudioDestinationNode(BaseAudioContext&); | 81 explicit DefaultAudioDestinationNode(BaseAudioContext&, |
| 82 const WebAudioLatencyHint&); |
| 73 }; | 83 }; |
| 74 | 84 |
| 75 } // namespace blink | 85 } // namespace blink |
| 76 | 86 |
| 77 #endif // DefaultAudioDestinationNode_h | 87 #endif // DefaultAudioDestinationNode_h |
| OLD | NEW |