35static JSBool
SoundGetProperty(JSContext* context, JSObject*
this, jsid propID, jsval* value);
38static JSBool
SoundStaticLoad(JSContext* context, uintN argc, jsval* vp);
50 JS_StrictPropertyStub,
55 JSCLASS_NO_OPTIONAL_MEMBERS
119 if ([
PLAYER status] != STATUS_START_GAME && JSVAL_IS_STRING(value)) {
131static JSBool
SoundGetProperty(JSContext* context, JSObject*
this, jsid propID, jsval* value)
133 if (!JSID_IS_INT(propID))
140 if (
EXPECT_NOT(!JSSoundGetSound(context,
this, &sound)))
143 switch (JSID_TO_INT(propID)) {
160 if ([name hasPrefix:
@"["] && [name hasSuffix:
@"]"]) {
176 NSString* name =
nil;
211 NSString* name =
nil;
213 double gain = OO_DEFAULT_SOUNDSOURCE_GAIN;
222 if (!JS_ValueToBoolean(context,
OOJS_ARGV[1], &loop)) {
249 NSString* name =
nil;
261 if (name ==
nil || [name isEqualToString:[controller playingMusic]]) {
271@implementation OOSound (OOJavaScriptExtentions)
273- (jsval)oo_jsValueInContext:(JSContext*)context
275 JSObject* jsSelf = NULL;
276 jsval result = JSVAL_NULL;
279 if (jsSelf != NULL) {
280 if (!JS_SetPrivate(context, jsSelf, [
self retain]))
284 result = OBJECT_TO_JSVAL(jsSelf);
291 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
void InitOOJSSound(JSContext *context, JSObject *global)
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)
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)