/src/3rdparty/webkit/Source/WebCore/generated/JSRealtimeAnalyserNode.cpp

https://bitbucket.org/ultra_iter/qt-vtl · C++ · 317 lines · 236 code · 59 blank · 22 comment · 6 complexity · f492f6a60a381450ba018a3a584ac7a3 MD5 · raw file

  1. /*
  2. This file is part of the WebKit open source project.
  3. This file has been generated by generate-bindings.pl. DO NOT MODIFY!
  4. This library is free software; you can redistribute it and/or
  5. modify it under the terms of the GNU Library General Public
  6. License as published by the Free Software Foundation; either
  7. version 2 of the License, or (at your option) any later version.
  8. This library is distributed in the hope that it will be useful,
  9. but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. Library General Public License for more details.
  12. You should have received a copy of the GNU Library General Public License
  13. along with this library; see the file COPYING.LIB. If not, write to
  14. the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  15. Boston, MA 02110-1301, USA.
  16. */
  17. #include "config.h"
  18. #if ENABLE(WEB_AUDIO)
  19. #include "JSRealtimeAnalyserNode.h"
  20. #include "ExceptionCode.h"
  21. #include "JSDOMBinding.h"
  22. #include "JSFloat32Array.h"
  23. #include "JSUint8Array.h"
  24. #include "RealtimeAnalyserNode.h"
  25. #include <runtime/Error.h>
  26. #include <wtf/GetPtr.h>
  27. using namespace JSC;
  28. namespace WebCore {
  29. ASSERT_CLASS_FITS_IN_CELL(JSRealtimeAnalyserNode);
  30. /* Hash table */
  31. #if ENABLE(JIT)
  32. #define THUNK_GENERATOR(generator) , generator
  33. #else
  34. #define THUNK_GENERATOR(generator)
  35. #endif
  36. static const HashTableValue JSRealtimeAnalyserNodeTableValues[7] =
  37. {
  38. { "fftSize", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRealtimeAnalyserNodeFftSize), (intptr_t)setJSRealtimeAnalyserNodeFftSize THUNK_GENERATOR(0) },
  39. { "frequencyBinCount", DontDelete | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRealtimeAnalyserNodeFrequencyBinCount), (intptr_t)0 THUNK_GENERATOR(0) },
  40. { "minDecibels", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRealtimeAnalyserNodeMinDecibels), (intptr_t)setJSRealtimeAnalyserNodeMinDecibels THUNK_GENERATOR(0) },
  41. { "maxDecibels", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRealtimeAnalyserNodeMaxDecibels), (intptr_t)setJSRealtimeAnalyserNodeMaxDecibels THUNK_GENERATOR(0) },
  42. { "smoothingTimeConstant", DontDelete, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRealtimeAnalyserNodeSmoothingTimeConstant), (intptr_t)setJSRealtimeAnalyserNodeSmoothingTimeConstant THUNK_GENERATOR(0) },
  43. { "constructor", DontEnum | ReadOnly, (intptr_t)static_cast<PropertySlot::GetValueFunc>(jsRealtimeAnalyserNodeConstructor), (intptr_t)0 THUNK_GENERATOR(0) },
  44. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  45. };
  46. #undef THUNK_GENERATOR
  47. static JSC_CONST_HASHTABLE HashTable JSRealtimeAnalyserNodeTable = { 17, 15, JSRealtimeAnalyserNodeTableValues, 0 };
  48. /* Hash table for constructor */
  49. #if ENABLE(JIT)
  50. #define THUNK_GENERATOR(generator) , generator
  51. #else
  52. #define THUNK_GENERATOR(generator)
  53. #endif
  54. static const HashTableValue JSRealtimeAnalyserNodeConstructorTableValues[1] =
  55. {
  56. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  57. };
  58. #undef THUNK_GENERATOR
  59. static JSC_CONST_HASHTABLE HashTable JSRealtimeAnalyserNodeConstructorTable = { 1, 0, JSRealtimeAnalyserNodeConstructorTableValues, 0 };
  60. class JSRealtimeAnalyserNodeConstructor : public DOMConstructorObject {
  61. public:
  62. JSRealtimeAnalyserNodeConstructor(JSC::ExecState*, JSC::Structure*, JSDOMGlobalObject*);
  63. virtual bool getOwnPropertySlot(JSC::ExecState*, const JSC::Identifier&, JSC::PropertySlot&);
  64. virtual bool getOwnPropertyDescriptor(JSC::ExecState*, const JSC::Identifier&, JSC::PropertyDescriptor&);
  65. static const JSC::ClassInfo s_info;
  66. static JSC::Structure* createStructure(JSC::JSGlobalData& globalData, JSC::JSValue prototype)
  67. {
  68. return JSC::Structure::create(globalData, prototype, JSC::TypeInfo(JSC::ObjectType, StructureFlags), AnonymousSlotCount, &s_info);
  69. }
  70. protected:
  71. static const unsigned StructureFlags = JSC::OverridesGetOwnPropertySlot | JSC::ImplementsHasInstance | DOMConstructorObject::StructureFlags;
  72. };
  73. const ClassInfo JSRealtimeAnalyserNodeConstructor::s_info = { "RealtimeAnalyserNodeConstructor", &DOMConstructorObject::s_info, &JSRealtimeAnalyserNodeConstructorTable, 0 };
  74. JSRealtimeAnalyserNodeConstructor::JSRealtimeAnalyserNodeConstructor(ExecState* exec, Structure* structure, JSDOMGlobalObject* globalObject)
  75. : DOMConstructorObject(structure, globalObject)
  76. {
  77. ASSERT(inherits(&s_info));
  78. putDirect(exec->globalData(), exec->propertyNames().prototype, JSRealtimeAnalyserNodePrototype::self(exec, globalObject), DontDelete | ReadOnly);
  79. }
  80. bool JSRealtimeAnalyserNodeConstructor::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  81. {
  82. return getStaticValueSlot<JSRealtimeAnalyserNodeConstructor, JSDOMWrapper>(exec, &JSRealtimeAnalyserNodeConstructorTable, this, propertyName, slot);
  83. }
  84. bool JSRealtimeAnalyserNodeConstructor::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  85. {
  86. return getStaticValueDescriptor<JSRealtimeAnalyserNodeConstructor, JSDOMWrapper>(exec, &JSRealtimeAnalyserNodeConstructorTable, this, propertyName, descriptor);
  87. }
  88. /* Hash table for prototype */
  89. #if ENABLE(JIT)
  90. #define THUNK_GENERATOR(generator) , generator
  91. #else
  92. #define THUNK_GENERATOR(generator)
  93. #endif
  94. static const HashTableValue JSRealtimeAnalyserNodePrototypeTableValues[4] =
  95. {
  96. { "getFloatFrequencyData", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsRealtimeAnalyserNodePrototypeFunctionGetFloatFrequencyData), (intptr_t)1 THUNK_GENERATOR(0) },
  97. { "getByteFrequencyData", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsRealtimeAnalyserNodePrototypeFunctionGetByteFrequencyData), (intptr_t)1 THUNK_GENERATOR(0) },
  98. { "getByteTimeDomainData", DontDelete | Function, (intptr_t)static_cast<NativeFunction>(jsRealtimeAnalyserNodePrototypeFunctionGetByteTimeDomainData), (intptr_t)1 THUNK_GENERATOR(0) },
  99. { 0, 0, 0, 0 THUNK_GENERATOR(0) }
  100. };
  101. #undef THUNK_GENERATOR
  102. static JSC_CONST_HASHTABLE HashTable JSRealtimeAnalyserNodePrototypeTable = { 8, 7, JSRealtimeAnalyserNodePrototypeTableValues, 0 };
  103. const ClassInfo JSRealtimeAnalyserNodePrototype::s_info = { "RealtimeAnalyserNodePrototype", &JSC::JSObjectWithGlobalObject::s_info, &JSRealtimeAnalyserNodePrototypeTable, 0 };
  104. JSObject* JSRealtimeAnalyserNodePrototype::self(ExecState* exec, JSGlobalObject* globalObject)
  105. {
  106. return getDOMPrototype<JSRealtimeAnalyserNode>(exec, globalObject);
  107. }
  108. bool JSRealtimeAnalyserNodePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  109. {
  110. return getStaticFunctionSlot<JSObject>(exec, &JSRealtimeAnalyserNodePrototypeTable, this, propertyName, slot);
  111. }
  112. bool JSRealtimeAnalyserNodePrototype::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  113. {
  114. return getStaticFunctionDescriptor<JSObject>(exec, &JSRealtimeAnalyserNodePrototypeTable, this, propertyName, descriptor);
  115. }
  116. const ClassInfo JSRealtimeAnalyserNode::s_info = { "RealtimeAnalyserNode", &JSAudioNode::s_info, &JSRealtimeAnalyserNodeTable, 0 };
  117. JSRealtimeAnalyserNode::JSRealtimeAnalyserNode(Structure* structure, JSDOMGlobalObject* globalObject, PassRefPtr<RealtimeAnalyserNode> impl)
  118. : JSAudioNode(structure, globalObject, impl)
  119. {
  120. ASSERT(inherits(&s_info));
  121. }
  122. JSObject* JSRealtimeAnalyserNode::createPrototype(ExecState* exec, JSGlobalObject* globalObject)
  123. {
  124. return new (exec) JSRealtimeAnalyserNodePrototype(exec->globalData(), globalObject, JSRealtimeAnalyserNodePrototype::createStructure(exec->globalData(), JSAudioNodePrototype::self(exec, globalObject)));
  125. }
  126. bool JSRealtimeAnalyserNode::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
  127. {
  128. return getStaticValueSlot<JSRealtimeAnalyserNode, Base>(exec, &JSRealtimeAnalyserNodeTable, this, propertyName, slot);
  129. }
  130. bool JSRealtimeAnalyserNode::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
  131. {
  132. return getStaticValueDescriptor<JSRealtimeAnalyserNode, Base>(exec, &JSRealtimeAnalyserNodeTable, this, propertyName, descriptor);
  133. }
  134. JSValue jsRealtimeAnalyserNodeFftSize(ExecState* exec, JSValue slotBase, const Identifier&)
  135. {
  136. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(slotBase));
  137. UNUSED_PARAM(exec);
  138. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  139. JSValue result = jsNumber(imp->fftSize());
  140. return result;
  141. }
  142. JSValue jsRealtimeAnalyserNodeFrequencyBinCount(ExecState* exec, JSValue slotBase, const Identifier&)
  143. {
  144. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(slotBase));
  145. UNUSED_PARAM(exec);
  146. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  147. JSValue result = jsNumber(imp->frequencyBinCount());
  148. return result;
  149. }
  150. JSValue jsRealtimeAnalyserNodeMinDecibels(ExecState* exec, JSValue slotBase, const Identifier&)
  151. {
  152. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(slotBase));
  153. UNUSED_PARAM(exec);
  154. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  155. JSValue result = jsNumber(imp->minDecibels());
  156. return result;
  157. }
  158. JSValue jsRealtimeAnalyserNodeMaxDecibels(ExecState* exec, JSValue slotBase, const Identifier&)
  159. {
  160. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(slotBase));
  161. UNUSED_PARAM(exec);
  162. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  163. JSValue result = jsNumber(imp->maxDecibels());
  164. return result;
  165. }
  166. JSValue jsRealtimeAnalyserNodeSmoothingTimeConstant(ExecState* exec, JSValue slotBase, const Identifier&)
  167. {
  168. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(slotBase));
  169. UNUSED_PARAM(exec);
  170. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  171. JSValue result = jsNumber(imp->smoothingTimeConstant());
  172. return result;
  173. }
  174. JSValue jsRealtimeAnalyserNodeConstructor(ExecState* exec, JSValue slotBase, const Identifier&)
  175. {
  176. JSRealtimeAnalyserNode* domObject = static_cast<JSRealtimeAnalyserNode*>(asObject(slotBase));
  177. return JSRealtimeAnalyserNode::getConstructor(exec, domObject->globalObject());
  178. }
  179. void JSRealtimeAnalyserNode::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
  180. {
  181. lookupPut<JSRealtimeAnalyserNode, Base>(exec, propertyName, value, &JSRealtimeAnalyserNodeTable, this, slot);
  182. }
  183. void setJSRealtimeAnalyserNodeFftSize(ExecState* exec, JSObject* thisObject, JSValue value)
  184. {
  185. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(thisObject);
  186. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  187. imp->setFftSize(value.toUInt32(exec));
  188. }
  189. void setJSRealtimeAnalyserNodeMinDecibels(ExecState* exec, JSObject* thisObject, JSValue value)
  190. {
  191. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(thisObject);
  192. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  193. imp->setMinDecibels(value.toFloat(exec));
  194. }
  195. void setJSRealtimeAnalyserNodeMaxDecibels(ExecState* exec, JSObject* thisObject, JSValue value)
  196. {
  197. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(thisObject);
  198. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  199. imp->setMaxDecibels(value.toFloat(exec));
  200. }
  201. void setJSRealtimeAnalyserNodeSmoothingTimeConstant(ExecState* exec, JSObject* thisObject, JSValue value)
  202. {
  203. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(thisObject);
  204. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  205. imp->setSmoothingTimeConstant(value.toFloat(exec));
  206. }
  207. JSValue JSRealtimeAnalyserNode::getConstructor(ExecState* exec, JSGlobalObject* globalObject)
  208. {
  209. return getDOMConstructor<JSRealtimeAnalyserNodeConstructor>(exec, static_cast<JSDOMGlobalObject*>(globalObject));
  210. }
  211. EncodedJSValue JSC_HOST_CALL jsRealtimeAnalyserNodePrototypeFunctionGetFloatFrequencyData(ExecState* exec)
  212. {
  213. JSValue thisValue = exec->hostThisValue();
  214. if (!thisValue.inherits(&JSRealtimeAnalyserNode::s_info))
  215. return throwVMTypeError(exec);
  216. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(thisValue));
  217. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  218. Float32Array* array(toFloat32Array(exec->argument(0)));
  219. if (exec->hadException())
  220. return JSValue::encode(jsUndefined());
  221. imp->getFloatFrequencyData(array);
  222. return JSValue::encode(jsUndefined());
  223. }
  224. EncodedJSValue JSC_HOST_CALL jsRealtimeAnalyserNodePrototypeFunctionGetByteFrequencyData(ExecState* exec)
  225. {
  226. JSValue thisValue = exec->hostThisValue();
  227. if (!thisValue.inherits(&JSRealtimeAnalyserNode::s_info))
  228. return throwVMTypeError(exec);
  229. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(thisValue));
  230. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  231. Uint8Array* array(toUint8Array(exec->argument(0)));
  232. if (exec->hadException())
  233. return JSValue::encode(jsUndefined());
  234. imp->getByteFrequencyData(array);
  235. return JSValue::encode(jsUndefined());
  236. }
  237. EncodedJSValue JSC_HOST_CALL jsRealtimeAnalyserNodePrototypeFunctionGetByteTimeDomainData(ExecState* exec)
  238. {
  239. JSValue thisValue = exec->hostThisValue();
  240. if (!thisValue.inherits(&JSRealtimeAnalyserNode::s_info))
  241. return throwVMTypeError(exec);
  242. JSRealtimeAnalyserNode* castedThis = static_cast<JSRealtimeAnalyserNode*>(asObject(thisValue));
  243. RealtimeAnalyserNode* imp = static_cast<RealtimeAnalyserNode*>(castedThis->impl());
  244. Uint8Array* array(toUint8Array(exec->argument(0)));
  245. if (exec->hadException())
  246. return JSValue::encode(jsUndefined());
  247. imp->getByteTimeDomainData(array);
  248. return JSValue::encode(jsUndefined());
  249. }
  250. JSC::JSValue toJS(JSC::ExecState* exec, JSDOMGlobalObject* globalObject, RealtimeAnalyserNode* impl)
  251. {
  252. return wrap<JSRealtimeAnalyserNode>(exec, globalObject, impl);
  253. }
  254. }
  255. #endif // ENABLE(WEB_AUDIO)