Home | History | Annotate | Download | only in custom
      1 /*
      2  * Copyright (C) 2013, Google Inc. All rights reserved.
      3  *
      4  * Redistribution and use in source and binary forms, with or without
      5  * modification, are permitted provided that the following conditions
      6  * are met:
      7  * 1.  Redistributions of source code must retain the above copyright
      8  *    notice, this list of conditions and the following disclaimer.
      9  * 2.  Redistributions in binary form must reproduce the above copyright
     10  *    notice, this list of conditions and the following disclaimer in the
     11  *    documentation and/or other materials provided with the distribution.
     12  *
     13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND ANY
     14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
     15  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
     16  * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR ANY
     17  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     18  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
     19  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
     20  * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     21  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
     22  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     23  */
     24 
     25 #include "config.h"
     26 #if ENABLE(WEB_AUDIO)
     27 #include "bindings/modules/v8/V8AudioNode.h"
     28 
     29 #include "bindings/modules/v8/V8AnalyserNode.h"
     30 #include "bindings/modules/v8/V8AudioBufferSourceNode.h"
     31 #include "bindings/modules/v8/V8AudioDestinationNode.h"
     32 #include "bindings/modules/v8/V8BiquadFilterNode.h"
     33 #include "bindings/modules/v8/V8ChannelMergerNode.h"
     34 #include "bindings/modules/v8/V8ChannelSplitterNode.h"
     35 #include "bindings/modules/v8/V8ConvolverNode.h"
     36 #include "bindings/modules/v8/V8DelayNode.h"
     37 #include "bindings/modules/v8/V8DynamicsCompressorNode.h"
     38 #include "bindings/modules/v8/V8GainNode.h"
     39 #include "bindings/modules/v8/V8MediaElementAudioSourceNode.h"
     40 #include "bindings/modules/v8/V8MediaStreamAudioDestinationNode.h"
     41 #include "bindings/modules/v8/V8MediaStreamAudioSourceNode.h"
     42 #include "bindings/modules/v8/V8OscillatorNode.h"
     43 #include "bindings/modules/v8/V8PannerNode.h"
     44 #include "bindings/modules/v8/V8ScriptProcessorNode.h"
     45 #include "bindings/modules/v8/V8WaveShaperNode.h"
     46 #include "bindings/v8/V8Binding.h"
     47 #include "modules/webaudio/AnalyserNode.h"
     48 #include "modules/webaudio/AudioBufferSourceNode.h"
     49 #include "modules/webaudio/AudioDestinationNode.h"
     50 #include "modules/webaudio/AudioNode.h"
     51 #include "modules/webaudio/BiquadFilterNode.h"
     52 #include "modules/webaudio/ChannelMergerNode.h"
     53 #include "modules/webaudio/ChannelSplitterNode.h"
     54 #include "modules/webaudio/ConvolverNode.h"
     55 #include "modules/webaudio/DelayNode.h"
     56 #include "modules/webaudio/DynamicsCompressorNode.h"
     57 #include "modules/webaudio/GainNode.h"
     58 #include "modules/webaudio/MediaElementAudioSourceNode.h"
     59 #include "modules/webaudio/MediaStreamAudioDestinationNode.h"
     60 #include "modules/webaudio/MediaStreamAudioSourceNode.h"
     61 #include "modules/webaudio/OscillatorNode.h"
     62 #include "modules/webaudio/PannerNode.h"
     63 #include "modules/webaudio/ScriptProcessorNode.h"
     64 #include "modules/webaudio/WaveShaperNode.h"
     65 
     66 namespace WebCore {
     67 
     68 v8::Handle<v8::Object> wrap(AudioNode* impl, v8::Handle<v8::Object> creationContext, v8::Isolate* isolate)
     69 {
     70     ASSERT(impl);
     71     switch (impl->nodeType()) {
     72     case AudioNode::NodeTypeDestination:
     73         return wrap(static_cast<AudioDestinationNode*>(impl), creationContext, isolate);
     74     case AudioNode::NodeTypeOscillator:
     75         return wrap(static_cast<OscillatorNode*>(impl), creationContext, isolate);
     76     case AudioNode::NodeTypeAudioBufferSource:
     77         return wrap(static_cast<AudioBufferSourceNode*>(impl), creationContext, isolate);
     78     case AudioNode::NodeTypeMediaElementAudioSource:
     79         return wrap(static_cast<MediaElementAudioSourceNode*>(impl), creationContext, isolate);
     80     case AudioNode::NodeTypeMediaStreamAudioDestination:
     81         return wrap(static_cast<MediaStreamAudioDestinationNode*>(impl), creationContext, isolate);
     82     case AudioNode::NodeTypeMediaStreamAudioSource:
     83         return wrap(static_cast<MediaStreamAudioSourceNode*>(impl), creationContext, isolate);
     84     case AudioNode::NodeTypeJavaScript:
     85         return wrap(static_cast<ScriptProcessorNode*>(impl), creationContext, isolate);
     86     case AudioNode::NodeTypeBiquadFilter:
     87         return wrap(static_cast<BiquadFilterNode*>(impl), creationContext, isolate);
     88     case AudioNode::NodeTypePanner:
     89         return wrap(static_cast<PannerNode*>(impl), creationContext, isolate);
     90     case AudioNode::NodeTypeConvolver:
     91         return wrap(static_cast<ConvolverNode*>(impl), creationContext, isolate);
     92     case AudioNode::NodeTypeDelay:
     93         return wrap(static_cast<DelayNode*>(impl), creationContext, isolate);
     94     case AudioNode::NodeTypeGain:
     95         return wrap(static_cast<GainNode*>(impl), creationContext, isolate);
     96     case AudioNode::NodeTypeChannelSplitter:
     97         return wrap(static_cast<ChannelSplitterNode*>(impl), creationContext, isolate);
     98     case AudioNode::NodeTypeChannelMerger:
     99         return wrap(static_cast<ChannelMergerNode*>(impl), creationContext, isolate);
    100     case AudioNode::NodeTypeAnalyser:
    101         return wrap(static_cast<AnalyserNode*>(impl), creationContext, isolate);
    102     case AudioNode::NodeTypeDynamicsCompressor:
    103         return wrap(static_cast<DynamicsCompressorNode*>(impl), creationContext, isolate);
    104     case AudioNode::NodeTypeWaveShaper:
    105         return wrap(static_cast<WaveShaperNode*>(impl), creationContext, isolate);
    106     default:
    107         ASSERT_NOT_REACHED();
    108         break;
    109     }
    110 
    111     return V8AudioNode::createWrapper(impl, creationContext, isolate);
    112 }
    113 
    114 } // namespace WebCore
    115 
    116 #endif // ENABLE(WEB_AUDIO)
    117