зеркало из https://github.com/mozilla/gecko-dev.git
Bug 879014 - Part 2: Implement the alternate enum values for BiquadFilterNode; r=roc
This commit is contained in:
Родитель
61a50048f8
Коммит
b6cfec5d54
|
@ -63,6 +63,9 @@ void SetParamsOnBiquad(WebCore::Biquad& aBiquad,
|
|||
case BiquadFilterType::Allpass:
|
||||
aBiquad.setAllpassParams(normalizedFrequency, aQ);
|
||||
break;
|
||||
default:
|
||||
NS_NOTREACHED("We should never see the alternate names here");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -198,6 +201,21 @@ BiquadFilterNode::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aScope)
|
|||
void
|
||||
BiquadFilterNode::SetType(BiquadFilterType aType)
|
||||
{
|
||||
// Handle the alternate enum values
|
||||
switch (aType) {
|
||||
case BiquadFilterType::_0: aType = BiquadFilterType::Lowpass; break;
|
||||
case BiquadFilterType::_1: aType = BiquadFilterType::Highpass; break;
|
||||
case BiquadFilterType::_2: aType = BiquadFilterType::Bandpass; break;
|
||||
case BiquadFilterType::_3: aType = BiquadFilterType::Lowshelf; break;
|
||||
case BiquadFilterType::_4: aType = BiquadFilterType::Highshelf; break;
|
||||
case BiquadFilterType::_5: aType = BiquadFilterType::Peaking; break;
|
||||
case BiquadFilterType::_6: aType = BiquadFilterType::Notch; break;
|
||||
case BiquadFilterType::_7: aType = BiquadFilterType::Allpass; break;
|
||||
default:
|
||||
// Shut up the compiler warning
|
||||
break;
|
||||
}
|
||||
|
||||
mType = aType;
|
||||
SendInt32ParameterToStream(BiquadFilterNodeEngine::TYPE,
|
||||
static_cast<int32_t>(aType));
|
||||
|
|
|
@ -57,6 +57,8 @@ addLoadEvent(function() {
|
|||
"allpass",
|
||||
];
|
||||
for (var i = 0; i < types.length; ++i) {
|
||||
filter.type = filter[types[i].toUpperCase()];
|
||||
is(filter.type, types[i], "Correct alternname type enum value");
|
||||
filter.type = types[i];
|
||||
}
|
||||
|
||||
|
|
|
@ -11,6 +11,9 @@
|
|||
*/
|
||||
|
||||
enum BiquadFilterType {
|
||||
// Hack: Use numbers to support alternate enum values
|
||||
"0", "1", "2", "3", "4", "5", "6", "7",
|
||||
|
||||
"lowpass",
|
||||
"highpass",
|
||||
"bandpass",
|
||||
|
@ -36,3 +39,19 @@ interface BiquadFilterNode : AudioNode {
|
|||
|
||||
};
|
||||
|
||||
/*
|
||||
* The origin of this IDL file is
|
||||
* https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html#AlternateNames
|
||||
*/
|
||||
[PrefControlled]
|
||||
partial interface BiquadFilterNode {
|
||||
const unsigned short LOWPASS = 0;
|
||||
const unsigned short HIGHPASS = 1;
|
||||
const unsigned short BANDPASS = 2;
|
||||
const unsigned short LOWSHELF = 3;
|
||||
const unsigned short HIGHSHELF = 4;
|
||||
const unsigned short PEAKING = 5;
|
||||
const unsigned short NOTCH = 6;
|
||||
const unsigned short ALLPASS = 7;
|
||||
};
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче