15c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)/*
2926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles) * Copyright (C) 2012, Google Inc. All rights reserved.
35c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
45c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * Redistribution and use in source and binary forms, with or without
55c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * modification, are permitted provided that the following conditions
65c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * are met:
75c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 1.  Redistributions of source code must retain the above copyright
85c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *    notice, this list of conditions and the following disclaimer.
95c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * 2.  Redistributions in binary form must reproduce the above copyright
105c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *    notice, this list of conditions and the following disclaimer in the
115c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *    documentation and/or other materials provided with the distribution.
125c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) *
135c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
145c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
155c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
165c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
175c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
185c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
195c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
205c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
215c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
225c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
235c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles) */
245c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
25926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#ifndef MediaStreamAudioDestinationNode_h
26926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#define MediaStreamAudioDestinationNode_h
275c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
2853e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#if ENABLE(WEB_AUDIO)
295c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
301e202183a5dc46166763171984b285173f8585e5Torne (Richard Coles)#include "platform/audio/AudioBus.h"
3153e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/mediastream/MediaStream.h"
3253e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "modules/webaudio/AudioBasicInspectorNode.h"
3353e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/OwnPtr.h"
3453e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#include "wtf/PassRefPtr.h"
355c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
36c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)namespace blink {
375c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
38926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)class AudioContext;
395c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
4009380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)class MediaStreamAudioDestinationNode FINAL : public AudioBasicInspectorNode {
417242dc3dbeb210b5e876a3c42d1ec1a667fc621aPrimiano Tucci    DEFINE_WRAPPERTYPEINFO();
42926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)public:
439e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    static MediaStreamAudioDestinationNode* create(AudioContext*, size_t numberOfChannels);
44926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual ~MediaStreamAudioDestinationNode();
45197021e6b966cfb06891637935ef33fff06433d1Ben Murdoch    virtual void trace(Visitor*) OVERRIDE;
46926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
47926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    MediaStream* stream() { return m_stream.get(); }
48926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
49926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // AudioNode.
50c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)    virtual void dispose() OVERRIDE;
5109380295ba73501a205346becac22c6978e4671dTorne (Richard Coles)    virtual void process(size_t framesToProcess) OVERRIDE;
525c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
53926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)private:
54926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    MediaStreamAudioDestinationNode(AudioContext*, size_t numberOfChannels);
55926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
56926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual double tailTime() const OVERRIDE { return 0; }
57926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual double latencyTime() const OVERRIDE { return 0; }
58926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
59926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    // As an audio source, we will never propagate silence.
60926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    virtual bool propagatesSilence() const OVERRIDE { return false; }
61926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
629e12abdf8c3a23d52091ea54ebb6a04d327f9300Torne (Richard Coles)    Member<MediaStream> m_stream;
63926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)    RefPtr<MediaStreamSource> m_source;
6481a5157921f1d2a7ff6aae115bfe3c139b38a5c8Torne (Richard Coles)    RefPtr<AudioBus> m_mixBus;
65926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)};
665c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
67c1847b1379d12d0e05df27436bf19a9b1bf12deaTorne (Richard Coles)} // namespace blink
685c87bf8b86a7c82ef50fb7a89697d8e02e2553beTorne (Richard Coles)
6953e740f4a82e17f3ae59772501622dc354e42336Torne (Richard Coles)#endif // ENABLE(WEB_AUDIO)
70926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)
71926b001d589ce2f10facb93dd4b87578ea35a855Torne (Richard Coles)#endif // MediaStreamAudioDestinationNode_h
72