39static JSBool
SoundGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value);
42static JSBool
SoundStaticLoad(JSContext *context, uintN argc, jsval *vp);
56 JS_StrictPropertyStub,
61 JSCLASS_NO_OPTIONAL_MEMBERS
116 if ([
PLAYER status] != STATUS_START_GAME && JSVAL_IS_STRING(value))
132static JSBool
SoundGetProperty(JSContext *context, JSObject *
this, jsid propID, jsval *value)
134 if (!JSID_IS_INT(propID))
return YES;
140 if (
EXPECT_NOT(!JSSoundGetSound(context,
this, &sound)))
return NO;
142 switch (JSID_TO_INT(propID))
161 if ([name hasPrefix:
@"["] && [name hasSuffix:
@"]"])
181 NSString *name =
nil;
218 NSString *name =
nil;
220 double gain = OO_DEFAULT_SOUNDSOURCE_GAIN;
230 if (!JS_ValueToBoolean(context,
OOJS_ARGV[1], &loop))
261 NSString *name =
nil;
275 if (name ==
nil || [name isEqualToString:[controller playingMusic]])
287@implementation OOSound (OOJavaScriptExtentions)
289- (jsval) oo_jsValueInContext:(JSContext *)context
291 JSObject *jsSelf = NULL;
292 jsval result = JSVAL_NULL;
297 if (!JS_SetPrivate(context, jsSelf, [
self retain])) jsSelf = NULL;
299 if (jsSelf != NULL) result = OBJECT_TO_JSVAL(jsSelf);
307 return [NSString stringWithFormat:@"[Sound \"%@\"]", [
self name]];
#define OOJS_PROFILE_EXIT
#define OOJS_END_FULL_NATIVE
#define OOJS_BEGIN_FULL_NATIVE(context)
#define OOJS_NATIVE_ENTER(cx)
#define OOJS_PROFILE_ENTER
static JSBool SoundGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
static JSObject * sSoundPrototype
static JSPropertySpec sSoundProperties[]
static JSBool SoundStaticStopMusic(JSContext *context, uintN argc, jsval *vp)
static JSBool SoundStaticPlayMusic(JSContext *context, uintN argc, jsval *vp)
static JSBool SoundStaticLoad(JSContext *context, uintN argc, jsval *vp)
static JSFunctionSpec sSoundMethods[]
static JSFunctionSpec sSoundStaticMethods[]
OOSound * SoundFromJSValue(JSContext *context, jsval value)
static JSClass sSoundClass
static JSBool SoundStaticMusicSoundSource(JSContext *context, uintN argc, jsval *vp)
void InitOOJSSound(JSContext *context, JSObject *global)
static OOSound * GetNamedSound(NSString *name)
void OOJSPauseTimeLimiter(void)
BOOL OOJSArgumentListGetNumber(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, double *outNumber, uintN *outConsumed)
JSBool OOJSObjectWrapperToString(JSContext *context, uintN argc, jsval *vp)
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)
id OOJSNativeObjectOfClassFromJSValue(JSContext *context, jsval value, Class requiredClass)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
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
void OOJSResumeTimeLimiter(void)
NSString * oo_jsDescription()
NSString * oo_jsClassName()
OOMusicController * sharedController()
void playMusicNamed:loop:gain:(NSString *name,[loop] BOOL loop,[gain] float gain)
OOSoundSource * soundSource()
id soundWithCustomSoundKey:(NSString *key)
OOSound * ooSoundNamed:inFolder:(NSString *fileName,[inFolder] NSString *folderName)