2012-08-31 13:59:37 -07:00
|
|
|
/* -*- 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/. */
|
|
|
|
|
2012-09-18 16:07:33 -07:00
|
|
|
#pragma once
|
|
|
|
|
2012-08-31 13:59:37 -07:00
|
|
|
#include "nsWrapperCache.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
|
|
|
#include "mozilla/Attributes.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2012-09-07 15:13:26 -07:00
|
|
|
#include "EnableWebAudioCheck.h"
|
2012-09-18 16:07:33 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2012-08-31 13:59:37 -07:00
|
|
|
|
|
|
|
class JSContext;
|
|
|
|
class nsIDOMWindow;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class ErrorResult;
|
|
|
|
|
2012-09-07 15:13:26 -07:00
|
|
|
namespace dom {
|
|
|
|
|
2012-09-18 16:07:33 -07:00
|
|
|
class AudioDestinationNode;
|
|
|
|
class AudioBufferSourceNode;
|
2012-09-21 15:42:14 -07:00
|
|
|
class AudioBuffer;
|
2012-09-18 16:07:33 -07:00
|
|
|
|
2012-10-09 11:50:26 -07:00
|
|
|
class AudioContext MOZ_FINAL : public nsWrapperCache,
|
2012-09-07 15:13:26 -07:00
|
|
|
public EnableWebAudioCheck
|
2012-08-31 13:59:37 -07:00
|
|
|
{
|
|
|
|
explicit AudioContext(nsIDOMWindow* aParentWindow);
|
|
|
|
|
|
|
|
public:
|
|
|
|
virtual ~AudioContext();
|
|
|
|
|
2012-10-09 11:50:26 -07:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AudioContext)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AudioContext)
|
2012-08-31 13:59:37 -07:00
|
|
|
|
|
|
|
nsIDOMWindow* GetParentObject() const
|
|
|
|
{
|
|
|
|
return mWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope,
|
|
|
|
bool* aTriedToWrap);
|
|
|
|
|
|
|
|
static already_AddRefed<AudioContext>
|
|
|
|
Constructor(nsISupports* aGlobal, ErrorResult& aRv);
|
|
|
|
|
2012-09-18 16:07:33 -07:00
|
|
|
AudioDestinationNode* Destination() const
|
|
|
|
{
|
|
|
|
return mDestination;
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<AudioBufferSourceNode> CreateBufferSource();
|
|
|
|
|
2012-09-21 15:42:14 -07:00
|
|
|
already_AddRefed<AudioBuffer>
|
|
|
|
CreateBuffer(JSContext* aJSContext, uint32_t aNumberOfChannels,
|
|
|
|
uint32_t aLength, float aSampleRate,
|
|
|
|
ErrorResult& aRv);
|
|
|
|
|
2012-08-31 13:59:37 -07:00
|
|
|
private:
|
|
|
|
nsCOMPtr<nsIDOMWindow> mWindow;
|
2012-09-18 16:07:33 -07:00
|
|
|
nsRefPtr<AudioDestinationNode> mDestination;
|
2012-08-31 13:59:37 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
2012-09-07 15:13:26 -07:00
|
|
|
}
|
2012-08-31 13:59:37 -07:00
|
|
|
|