зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1477704 - r=karlt
--HG-- extra : rebase_source : 165ea665512f8119efd4c9b34aa3efb38a8910d6
This commit is contained in:
Родитель
394ba9bb0b
Коммит
d097a302f8
|
@ -62,7 +62,7 @@ AudioListenerEngine::RightVector() const
|
|||
|
||||
AudioListener::AudioListener(AudioContext* aContext)
|
||||
: mContext(aContext)
|
||||
, mEngine(MakeUnique<AudioListenerEngine>())
|
||||
, mEngine(new AudioListenerEngine())
|
||||
, mPosition()
|
||||
, mFrontVector(0., 0., -1.)
|
||||
, mRightVector(1., 0., 0.)
|
||||
|
@ -142,19 +142,18 @@ AudioListener::SendListenerEngineEvent(
|
|||
, mEngine(aEngine)
|
||||
, mParameter(aParameter)
|
||||
, mValue(aValue)
|
||||
{
|
||||
}
|
||||
{ }
|
||||
void Run() override
|
||||
{
|
||||
mEngine->RecvListenerEngineEvent(mParameter, mValue);
|
||||
}
|
||||
AudioListenerEngine* mEngine;
|
||||
RefPtr<AudioListenerEngine> mEngine;
|
||||
AudioListenerEngine::AudioListenerParameter mParameter;
|
||||
ThreeDPoint mValue;
|
||||
};
|
||||
|
||||
mContext->DestinationStream()->GraphImpl()->AppendMessage(
|
||||
MakeUnique<Message>(mEngine.get(), aParameter, aValue));
|
||||
MakeUnique<Message>(Engine(), aParameter, aValue));
|
||||
}
|
||||
|
||||
size_t
|
||||
|
|
|
@ -24,13 +24,16 @@ namespace dom {
|
|||
class AudioListenerEngine final
|
||||
{
|
||||
public:
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(AudioListenerEngine)
|
||||
|
||||
AudioListenerEngine();
|
||||
|
||||
enum class AudioListenerParameter
|
||||
{
|
||||
POSITION,
|
||||
FRONT, // unit length
|
||||
RIGHT // unit length, orthogonal to FRONT
|
||||
};
|
||||
AudioListenerEngine();
|
||||
void RecvListenerEngineEvent(
|
||||
AudioListenerEngine::AudioListenerParameter aParameter,
|
||||
const ThreeDPoint& aValue);
|
||||
|
@ -39,6 +42,8 @@ public:
|
|||
const ThreeDPoint& RightVector() const;
|
||||
|
||||
private:
|
||||
~AudioListenerEngine() = default;
|
||||
|
||||
ThreeDPoint mPosition;
|
||||
ThreeDPoint mFrontVector;
|
||||
ThreeDPoint mRightVector;
|
||||
|
@ -65,7 +70,7 @@ public:
|
|||
void SetOrientation(double aX, double aY, double aZ,
|
||||
double aXUp, double aYUp, double aZUp);
|
||||
|
||||
const AudioListenerEngine* Engine() { return mEngine.get(); }
|
||||
AudioListenerEngine* Engine() { return mEngine.get(); }
|
||||
|
||||
private:
|
||||
void SendListenerEngineEvent(
|
||||
|
@ -77,7 +82,7 @@ private:
|
|||
void SendThreeDPointParameterToStream(uint32_t aIndex, const ThreeDPoint& aValue);
|
||||
private:
|
||||
RefPtr<AudioContext> mContext;
|
||||
const UniquePtr<AudioListenerEngine> mEngine;
|
||||
RefPtr<AudioListenerEngine> mEngine;
|
||||
ThreeDPoint mPosition;
|
||||
ThreeDPoint mFrontVector;
|
||||
ThreeDPoint mRightVector;
|
||||
|
|
|
@ -44,7 +44,7 @@ class PannerNodeEngine final : public AudioNodeEngine
|
|||
public:
|
||||
explicit PannerNodeEngine(AudioNode* aNode,
|
||||
AudioDestinationNode* aDestination,
|
||||
const AudioListenerEngine* aListenerEngine)
|
||||
AudioListenerEngine* aListenerEngine)
|
||||
: AudioNodeEngine(aNode)
|
||||
, mDestination(aDestination->Stream())
|
||||
, mListenerEngine(aListenerEngine)
|
||||
|
@ -256,9 +256,7 @@ public:
|
|||
// thread untile mPanningModelFunction has changed, and this happens strictly
|
||||
// later, via a MediaStreamGraph ControlMessage.
|
||||
nsAutoPtr<HRTFPanner> mHRTFPanner;
|
||||
// This is set in the ctor, and guaranteed to live longer than this engine:
|
||||
// its lifetime is the same as the AudioContext itself.
|
||||
const AudioListenerEngine* mListenerEngine;
|
||||
RefPtr<AudioListenerEngine> mListenerEngine;
|
||||
typedef void (PannerNodeEngine::*PanningModelFunction)(const AudioBlock& aInput, AudioBlock* aOutput, StreamTime tick);
|
||||
PanningModelFunction mPanningModelFunction;
|
||||
typedef float (PannerNodeEngine::*DistanceModelFunction)(double aDistance);
|
||||
|
|
Загрузка…
Ссылка в новой задаче