34static JSBool
SoundSourceSetProperty(JSContext* context, JSObject*
this, jsid propID, JSBool strict, jsval* value);
38static JSBool
SoundSourcePlay(JSContext* context, uintN argc, jsval* vp);
39static JSBool
SoundSourceStop(JSContext* context, uintN argc, jsval* vp);
54 JSCLASS_NO_OPTIONAL_MEMBERS
120 if (
EXPECT_NOT(!JS_IsConstructing(context, vp))) {
121 OOJSReportError(context,
@"SoundSource() cannot be called as a function, it must be used as a constructor (as in new SoundSource()).");
134 if (!JSID_IS_INT(propID))
141 if (!JSSoundSourceGetSoundSource(context,
this, &soundSource))
144 switch (JSID_TO_INT(propID)) {
158 *value = INT_TO_JSVAL([soundSource repeatCount]);
169 return JS_NewNumberValue(context, [soundSource gain], value);
181 if (!JSID_IS_INT(propID))
192 if (!JSSoundSourceGetSoundSource(context,
this, &soundSource))
195 switch (JSID_TO_INT(propID)) {
197 [soundSource
setSound:SoundFromJSValue(context, *value)];
202 if (JS_ValueToBoolean(context, *value, &bValue)) {
209 if (JS_ValueToInt32(context, *value, &iValue)) {
227 if (JS_ValueToBoolean(context, *value, &bValue)) {
234 if (JS_ValueToNumber(context, *value, &fValue)) {
322@implementation OOSoundSource (OOJavaScriptExtentions)
324- (jsval)oo_jsValueInContext:(JSContext*)context
326 JSObject* jsSelf = NULL;
327 jsval result = JSVAL_NULL;
330 if (jsSelf != NULL) {
331 if (!JS_SetPrivate(context, jsSelf, [
self retain]))
335 result = OBJECT_TO_JSVAL(jsSelf);
342 return @"SoundSource";
OOINLINE double OOClamp_0_max_d(double value, double max) INLINE_CONST_FUNC
#define OOJS_END_FULL_NATIVE
#define OOJS_BEGIN_FULL_NATIVE(context)
#define OOJS_NATIVE_ENTER(cx)
void InitOOJSSoundSource(JSContext *context, JSObject *global)
static JSBool SoundSourceConstruct(JSContext *context, uintN argc, jsval *vp)
static JSBool SoundSourcePlay(JSContext *context, uintN argc, jsval *vp)
static JSClass sSoundSourceClass
static JSBool SoundSourcePlayOrRepeat(JSContext *context, uintN argc, jsval *vp)
static JSBool SoundSourceGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSBool SoundSourceSetProperty(JSContext *context, JSObject *this, jsid propID, JSBool strict, jsval *value)
static JSBool SoundSourceStop(JSContext *context, uintN argc, jsval *vp)
static JSFunctionSpec sSoundSourceMethods[]
static JSObject * sSoundSourcePrototype
@ kSoundSource_positional
@ kSoundSource_repeatCount
static JSPropertySpec sSoundSourceProperties[]
BOOL JSValueToVector(JSContext *context, jsval value, Vector *outVector) NONNULL_FUNC
BOOL VectorToJSValue(JSContext *context, Vector vector, jsval *outValue) NONNULL_FUNC
JSBool OOJSObjectWrapperToString(JSContext *context, uintN argc, jsval *vp)
#define OOJS_PROP_READWRITE_CB
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
#define DEFINE_JS_OBJECT_GETTER(NAME, JSCLASS, JSPROTO, OBJCCLASSNAME)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
#define OOJS_RETURN_OBJECT(o)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
void OOJSReportError(JSContext *context, NSString *format,...)
OOINLINE jsval OOJSValueFromBOOL(int b) INLINE_CONST_FUNC
void OOJSReportBadPropertyValue(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec, jsval value)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
#define OOJS_PROP_READONLY_CB
NSString * oo_jsClassName()
void setPositional:(BOOL inPositional)
void setLoop:(BOOL inLoop)
void setRepeatCount:(uint8_t inCount)
void setGain:(float gain)
void setPosition:(Vector inPosition)
void setSound:(OOSound *inSound)