mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-07 12:15:51 +00:00
81075674d3
Backed out changeset 80e8530f06ea (bug 804387) Backed out changeset 3de2271ad47f (bug 804387) Backed out changeset 00f86870931c (bug 804837) Backed out changeset 0e3f20927c50 (bug 804387) Backed out changeset e6ef90038007 (bug 804387) Backed out changeset 0ad6f67a95f9 (bug 804387) Backed out changeset d0772aba503c (bug 804387) Backed out changeset 5477b87ff03e (bug 804387) Backed out changeset 1d7ec5adc49f (bug 804387) Backed out changeset 11f4d740cd6c (bug 804387) Backed out changeset e6254d8997ab (bug 804387) Backed out changeset 372322f3264d (bug 804387) Backed out changeset 53d5ed687612 (bug 804387) Backed out changeset 000b88ac40a7 (bug 804387)
83 lines
2.3 KiB
C++
83 lines
2.3 KiB
C++
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#ifndef AudioNode_h_
|
|
#define AudioNode_h_
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
#include "mozilla/Attributes.h"
|
|
#include "EnableWebAudioCheck.h"
|
|
#include "nsAutoPtr.h"
|
|
#include "nsTArray.h"
|
|
#include "AudioContext.h"
|
|
|
|
struct JSContext;
|
|
|
|
namespace mozilla {
|
|
|
|
class ErrorResult;
|
|
|
|
namespace dom {
|
|
|
|
class AudioNode : public nsISupports,
|
|
public EnableWebAudioCheck
|
|
{
|
|
public:
|
|
explicit AudioNode(AudioContext* aContext);
|
|
virtual ~AudioNode();
|
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
NS_DECL_CYCLE_COLLECTION_CLASS(AudioNode)
|
|
|
|
AudioContext* GetParentObject() const
|
|
{
|
|
return mContext;
|
|
}
|
|
|
|
AudioContext* Context() const
|
|
{
|
|
return mContext;
|
|
}
|
|
|
|
void Connect(AudioNode& aDestination, uint32_t aOutput,
|
|
uint32_t aInput, ErrorResult& aRv);
|
|
|
|
void Disconnect(uint32_t aOutput, ErrorResult& aRv);
|
|
|
|
// The following two virtual methods must be implemented by each node type
|
|
// to provide their number of input and output ports. These numbers are
|
|
// constant for the lifetime of the node. Both default to 1.
|
|
virtual uint32_t NumberOfInputs() const { return 1; }
|
|
virtual uint32_t NumberOfOutputs() const { return 1; }
|
|
|
|
struct InputNode {
|
|
// Strong reference.
|
|
// May be null if the source node has gone away.
|
|
nsRefPtr<AudioNode> mInputNode;
|
|
// The index of the input port this node feeds into.
|
|
uint32_t mInputPort;
|
|
// The index of the output port this node comes out of.
|
|
uint32_t mOutputPort;
|
|
};
|
|
|
|
private:
|
|
nsRefPtr<AudioContext> mContext;
|
|
|
|
// For every InputNode, there is a corresponding entry in mOutputNodes of the
|
|
// InputNode's mInputNode.
|
|
nsTArray<InputNode> mInputNodes;
|
|
// For every mOutputNode entry, there is a corresponding entry in mInputNodes
|
|
// of the mOutputNode entry. We won't necessarily be able to identify the
|
|
// exact matching entry, since mOutputNodes doesn't include the port
|
|
// identifiers and the same node could be connected on multiple ports.
|
|
nsTArray<nsRefPtr<AudioNode> > mOutputNodes;
|
|
};
|
|
|
|
}
|
|
}
|
|
|
|
#endif
|