Bug 807329 - fix AudioEventTimeline.h for compilers that don't support enum classes; r=ehsan
authorNathan Froyd <froydnj@mozilla.com>
Wed, 31 Oct 2012 11:58:42 -0400
changeset 116528 7a52ba9b15428708096c21d37d7eb1193c7edf83
parent 116527 3162d35c6ffd149abb4598645ece37c4c3964777
child 116529 c6ccd1d30c1541f4b855655aeb7f6c193bdb74b7
push idunknown
push userunknown
push dateunknown
reviewersehsan
bugs807329
milestone19.0a1
Bug 807329 - fix AudioEventTimeline.h for compilers that don't support enum classes; r=ehsan
content/media/webaudio/AudioEventTimeline.h
--- a/content/media/webaudio/AudioEventTimeline.h
+++ b/content/media/webaudio/AudioEventTimeline.h
@@ -122,73 +122,73 @@ public:
 
   float DefaultValue() const
   {
     return mDefaultValue;
   }
 
   void SetValueAtTime(float aValue, float aStartTime, ErrorResult& aRv)
   {
-    InsertEvent(Event(Event::Type::SetValue, aStartTime, aValue), aRv);
+    InsertEvent(Event(Event::SetValue, aStartTime, aValue), aRv);
   }
 
   void LinearRampToValueAtTime(float aValue, float aEndTime, ErrorResult& aRv)
   {
-    InsertEvent(Event(Event::Type::LinearRamp, aEndTime, aValue), aRv);
+    InsertEvent(Event(Event::LinearRamp, aEndTime, aValue), aRv);
   }
 
   void ExponentialRampToValueAtTime(float aValue, float aEndTime, ErrorResult& aRv)
   {
-    InsertEvent(Event(Event::Type::ExponentialRamp, aEndTime, aValue), aRv);
+    InsertEvent(Event(Event::ExponentialRamp, aEndTime, aValue), aRv);
   }
 
   void SetTargetAtTime(float aTarget, float aStartTime, float aTimeConstant, ErrorResult& aRv)
   {
-    InsertEvent(Event(Event::Type::SetTarget, aStartTime, aTarget, aTimeConstant), aRv);
+    InsertEvent(Event(Event::SetTarget, aStartTime, aTarget, aTimeConstant), aRv);
   }
 
   void SetValueCurveAtTime(const FloatArrayWrapper& aValues, float aStartTime, float aDuration, ErrorResult& aRv)
   {
     // TODO: implement
-    // InsertEvent(Event(Event::Type::SetValueCurve, aStartTime, 0.0f, 0.0f, aDuration, aValues), aRv);
+    // InsertEvent(Event(Event::SetValueCurve, aStartTime, 0.0f, 0.0f, aDuration, aValues), aRv);
   }
 
   void CancelScheduledValues(float aStartTime)
   {
     // TODO: implement
   }
 
   // This method computes the AudioParam value at a given time based on the event timeline
   float GetValueAtTime(float aTime) const
   {
     const Event* previous = nullptr;
     const Event* next = nullptr;
 
     bool bailOut = false;
     for (unsigned i = 0; !bailOut && i < mEvents.Length(); ++i) {
       switch (mEvents[i].mType) {
-      case Event::Type::SetValue:
-      case Event::Type::SetTarget:
-      case Event::Type::LinearRamp:
-      case Event::Type::ExponentialRamp:
+      case Event::SetValue:
+      case Event::SetTarget:
+      case Event::LinearRamp:
+      case Event::ExponentialRamp:
         if (aTime == mEvents[i].mTime) {
           // Find the last event with the same time
           do {
             ++i;
           } while (i < mEvents.Length() &&
                    aTime == mEvents[i].mTime);
           return mEvents[i - 1].mValue;
         }
         previous = next;
         next = &mEvents[i];
         if (aTime < mEvents[i].mTime) {
           bailOut = true;
         }
         break;
-      case Event::Type::SetValueCurve:
+      case Event::SetValueCurve:
         // TODO: implement
         break;
       default:
         MOZ_ASSERT(false, "unreached");
       }
     }
     // Handle the case where the time is past all of the events
     if (!bailOut) {
@@ -199,83 +199,83 @@ public:
     // Just return the default value if we did not find anything
     if (!previous && !next) {
       return mValue;
     }
 
     // If the requested time is before all of the existing events
     if (!previous) {
       switch (next->mType) {
-      case Event::Type::SetValue:
-      case Event::Type::SetTarget:
+      case Event::SetValue:
+      case Event::SetTarget:
         // The requested time is before the first event
         return mValue;
-      case Event::Type::LinearRamp:
+      case Event::LinearRamp:
         // Use t=0 as T0 and v=defaultValue as V0
         return LinearInterpolate(0.0f, mValue, next->mTime, next->mValue, aTime);
-      case Event::Type::ExponentialRamp:
+      case Event::ExponentialRamp:
         // Use t=0 as T0 and v=defaultValue as V0
         return ExponentialInterpolate(0.0f, mValue, next->mTime, next->mValue, aTime);
-      case Event::Type::SetValueCurve:
+      case Event::SetValueCurve:
         // TODO: implement
         return 0.0f;
       }
       MOZ_ASSERT(false, "unreached");
     }
 
     // SetTarget nodes can be handled no matter what their next node is (if they have one)
-    if (previous->mType == Event::Type::SetTarget) {
+    if (previous->mType == Event::SetTarget) {
       // Follow the curve, without regard to the next node
       return ExponentialApproach(previous->mTime, mValue, previous->mValue,
                                  previous->mTimeConstant, aTime);
     }
 
     // If the requested time is after all of the existing events
     if (!next) {
       switch (previous->mType) {
-      case Event::Type::SetValue:
-      case Event::Type::LinearRamp:
-      case Event::Type::ExponentialRamp:
+      case Event::SetValue:
+      case Event::LinearRamp:
+      case Event::ExponentialRamp:
         // The value will be constant after the last event
         return previous->mValue;
-      case Event::Type::SetValueCurve:
+      case Event::SetValueCurve:
         // TODO: implement
         return 0.0f;
-      case Event::Type::SetTarget:
+      case Event::SetTarget:
         MOZ_ASSERT(false, "unreached");
       }
       MOZ_ASSERT(false, "unreached");
     }
 
     // Finally, handle the case where we have both a previous and a next event
 
     // First, handle the case where our range ends up in a ramp event
     switch (next->mType) {
-    case Event::Type::LinearRamp:
+    case Event::LinearRamp:
       return LinearInterpolate(previous->mTime, previous->mValue, next->mTime, next->mValue, aTime);
-    case Event::Type::ExponentialRamp:
+    case Event::ExponentialRamp:
       return ExponentialInterpolate(previous->mTime, previous->mValue, next->mTime, next->mValue, aTime);
-    case Event::Type::SetValue:
-    case Event::Type::SetTarget:
-    case Event::Type::SetValueCurve:
+    case Event::SetValue:
+    case Event::SetTarget:
+    case Event::SetValueCurve:
       break;
     }
 
     // Now handle all other cases
     switch (previous->mType) {
-    case Event::Type::SetValue:
-    case Event::Type::LinearRamp:
-    case Event::Type::ExponentialRamp:
+    case Event::SetValue:
+    case Event::LinearRamp:
+    case Event::ExponentialRamp:
       // If the next event type is neither linear or exponential ramp, the
       // value is constant.
       return previous->mValue;
-    case Event::Type::SetValueCurve:
+    case Event::SetValueCurve:
       // TODO: implement
       return 0.0f;
-    case Event::Type::SetTarget:
+    case Event::SetTarget:
       MOZ_ASSERT(false, "unreached");
     }
 
     MOZ_ASSERT(false, "unreached");
     return 0.0f;
   }
 
   // Return the number of events scheduled
@@ -305,27 +305,27 @@ private:
     if (!aEvent.IsValid()) {
       aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
       return;
     }
 
     // Make sure that non-curve events don't fall within the duration of a
     // curve event.
     for (unsigned i = 0; i < mEvents.Length(); ++i) {
-      if (mEvents[i].mType == Event::Type::SetValueCurve &&
+      if (mEvents[i].mType == Event::SetValueCurve &&
           mEvents[i].mTime <= aEvent.mTime &&
           (mEvents[i].mTime + mEvents[i].mDuration) >= aEvent.mTime) {
         aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
         return;
       }
     }
 
     // Make sure that curve events don't fall in a range which includes other
     // events.
-    if (aEvent.mType == Event::Type::SetValueCurve) {
+    if (aEvent.mType == Event::SetValueCurve) {
       for (unsigned i = 0; i < mEvents.Length(); ++i) {
         if (mEvents[i].mTime >= aEvent.mTime &&
             mEvents[i].mTime <= (aEvent.mTime + aEvent.mDuration)) {
           aRv.Throw(NS_ERROR_DOM_SYNTAX_ERR);
           return;
         }
       }
     }