Bug 849713 - Part 2: Accept the loop parameters on AudioBufferSourceNodeEngine; r=roc

This commit is contained in:
Ehsan Akhgari 2013-03-10 13:59:41 -04:00
parent e39bc33233
commit dca28d002b

View File

@ -25,7 +25,16 @@ class AudioBufferSourceNodeEngine : public AudioNodeEngine
{
public:
AudioBufferSourceNodeEngine() :
mStart(0), mStop(TRACK_TICKS_MAX), mOffset(0), mDuration(0) {}
mStart(0), mStop(TRACK_TICKS_MAX),
mOffset(0), mDuration(0),
mLoop(NotLooping), mLoopStart(0), mLoopEnd(0)
{}
enum LoopState {
NotLooping, // Will never loop
WillLoop, // In loop mode, but has not started to loop yet
IsLooping // Is looping
};
// START, OFFSET and DURATION are always set by start() (along with setting
// mBuffer to something non-null).
@ -34,7 +43,10 @@ public:
START,
STOP,
OFFSET,
DURATION
DURATION,
LOOP,
LOOPSTART,
LOOPEND
};
virtual void SetStreamTimeParameter(uint32_t aIndex, TrackTicks aParam)
{
@ -50,6 +62,9 @@ public:
switch (aIndex) {
case OFFSET: mOffset = aParam; break;
case DURATION: mDuration = aParam; break;
case LOOP: mLoop = aParam ? WillLoop: NotLooping; break;
case LOOPSTART: mLoopStart = aParam; break;
case LOOPEND: mLoopEnd = aParam; break;
default:
NS_ERROR("Bad AudioBufferSourceNodeEngine Int32Parameter");
}
@ -123,6 +138,9 @@ public:
nsRefPtr<ThreadSharedFloatArrayBufferList> mBuffer;
int32_t mOffset;
int32_t mDuration;
LoopState mLoop;
int32_t mLoopStart;
int32_t mLoopEnd;
};
AudioBufferSourceNode::AudioBufferSourceNode(AudioContext* aContext)