bug 1227411 add logging of AudioParam API use r=padenot

This commit is contained in:
Karl Tomlinson 2015-11-24 18:08:13 +13:00
parent 1af05d1e71
commit 0ac470696b

View File

@ -115,9 +115,48 @@ AudioParam::Stream()
return mStream;
}
static const char*
ToString(AudioTimelineEvent::Type aType)
{
switch (aType) {
case AudioTimelineEvent::SetValue:
return "SetValue";
case AudioTimelineEvent::SetValueAtTime:
return "SetValueAtTime";
case AudioTimelineEvent::LinearRamp:
return "LinearRamp";
case AudioTimelineEvent::ExponentialRamp:
return "ExponentialRamp";
case AudioTimelineEvent::SetTarget:
return "SetTarget";
case AudioTimelineEvent::SetValueCurve:
return "SetValueCurve";
case AudioTimelineEvent::Stream:
return "Stream";
case AudioTimelineEvent::Cancel:
return "Cancel";
default:
return "unknown AudioTimelineEvent";
}
}
void
AudioParam::SendEventToEngine(const AudioTimelineEvent& aEvent)
{
WEB_AUDIO_API_LOG("%f: %s for %u %s %s=%g time=%f %s=%g",
GetParentObject()->CurrentTime(),
mName, ParentNodeId(), ToString(aEvent.mType),
aEvent.mType == AudioTimelineEvent::SetValueCurve ?
"length" : "value",
aEvent.mType == AudioTimelineEvent::SetValueCurve ?
static_cast<double>(aEvent.mCurveLength) :
static_cast<double>(aEvent.mValue),
aEvent.Time<double>(),
aEvent.mType == AudioTimelineEvent::SetValueCurve ?
"duration" : "constant",
aEvent.mType == AudioTimelineEvent::SetValueCurve ?
aEvent.mDuration : aEvent.mTimeConstant);
AudioNodeStream* stream = mNode->GetStream();
if (stream) {
stream->SendTimelineEvent(mIndex, aEvent);