Go to the source code of this file.
|
static OOSound * | GetNamedSound (NSString *name) |
|
static JSBool | SoundGetProperty (JSContext *context, JSObject *this, jsid propID, jsval *value) |
|
static JSBool | SoundStaticLoad (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | SoundStaticMusicSoundSource (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | SoundStaticPlayMusic (JSContext *context, uintN argc, jsval *vp) |
|
static JSBool | SoundStaticStopMusic (JSContext *context, uintN argc, jsval *vp) |
|
void | InitOOJSSound (JSContext *context, JSObject *global) |
|
OOSound * | SoundFromJSValue (JSContext *context, jsval value) |
|
◆ anonymous enum
◆ GetNamedSound()
static OOSound * GetNamedSound |
( |
NSString * | name | ) |
|
|
static |
◆ InitOOJSSound()
void InitOOJSSound |
( |
JSContext * | context, |
|
|
JSObject * | global ) |
Definition at line 104 of file OOJSSound.m.
105{
108}
static JSObject * sSoundPrototype
static JSPropertySpec sSoundProperties[]
static JSFunctionSpec sSoundMethods[]
static JSFunctionSpec sSoundStaticMethods[]
static JSClass sSoundClass
void OOJSRegisterObjectConverter(JSClass *theClass, OOJSClassConverterCallback converter)
JSBool OOJSUnconstructableConstruct(JSContext *context, uintN argc, jsval *vp)
id OOJSBasicPrivateObjectConverter(JSContext *context, JSObject *object)
References OOJSBasicPrivateObjectConverter(), OOJSRegisterObjectConverter(), OOJSUnconstructableConstruct(), sSoundClass, sSoundMethods, sSoundProperties, sSoundPrototype, and sSoundStaticMethods.
◆ SoundFromJSValue()
OOSound * SoundFromJSValue |
( |
JSContext * | context, |
|
|
jsval | value ) |
Definition at line 111 of file OOJSSound.m.
112{
114
116 if ([
PLAYER status] != STATUS_START_GAME && JSVAL_IS_STRING(value))
117 {
119 }
120 else
121 {
123 }
125
127}
#define OOJS_PROFILE_EXIT
#define OOJS_PROFILE_ENTER
static OOSound * GetNamedSound(NSString *name)
void OOJSPauseTimeLimiter(void)
id OOJSNativeObjectOfClassFromJSValue(JSContext *context, jsval value, Class requiredClass)
NSString * OOStringFromJSValue(JSContext *context, jsval value)
void OOJSResumeTimeLimiter(void)
References GetNamedSound(), OOJS_PROFILE_ENTER, OOJS_PROFILE_EXIT, OOJSNativeObjectOfClassFromJSValue(), OOJSPauseTimeLimiter(), OOJSResumeTimeLimiter(), OOStringFromJSValue(), and PLAYER.
◆ SoundGetProperty()
static JSBool SoundGetProperty |
( |
JSContext * | context, |
|
|
JSObject * | this, |
|
|
jsid | propID, |
|
|
jsval * | value ) |
|
static |
Definition at line 132 of file OOJSSound.m.
133{
134 if (!JSID_IS_INT(propID)) return YES;
135
137
139
140 if (
EXPECT_NOT(!JSSoundGetSound(context,
this, &sound)))
return NO;
141
142 switch (JSID_TO_INT(propID))
143 {
146 return YES;
147
148 default:
150 return NO;
151 }
152
154}
#define OOJS_NATIVE_ENTER(cx)
OOINLINE jsval OOJSValueFromNativeObject(JSContext *context, id object)
void OOJSReportBadPropertySelector(JSContext *context, JSObject *thisObj, jsid propID, JSPropertySpec *propertySpec)
References EXPECT_NOT, kSound_name, nil, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJSReportBadPropertySelector(), OOJSValueFromNativeObject(), and sSoundProperties.
◆ SoundStaticLoad()
static JSBool SoundStaticLoad |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
Definition at line 177 of file OOJSSound.m.
178{
180
181 NSString *name =
nil;
183
186 {
188 return NO;
189 }
190
194
196
198}
#define OOJS_END_FULL_NATIVE
#define OOJS_BEGIN_FULL_NATIVE(context)
#define OOJS_RETURN_OBJECT(o)
void OOJSReportBadArguments(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, NSString *message, NSString *expectedArgsDescription)
References GetNamedSound(), MIN, nil, OOJS_ARGV, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_OBJECT, OOJSReportBadArguments(), and OOStringFromJSValue().
◆ SoundStaticMusicSoundSource()
static JSBool SoundStaticMusicSoundSource |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
◆ SoundStaticPlayMusic()
static JSBool SoundStaticPlayMusic |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
Definition at line 214 of file OOJSSound.m.
215{
217
218 NSString *name =
nil;
219 JSBool loop = NO;
220 double gain = OO_DEFAULT_SOUNDSOURCE_GAIN;
221
224 {
226 return NO;
227 }
228 if (argc > 1)
229 {
230 if (!JS_ValueToBoolean(context,
OOJS_ARGV[1], &loop))
231 {
233 return NO;
234 }
235 }
236
237 if (argc > 2)
238 {
240 {
242 return NO;
243 }
244 }
245
249
251
253}
BOOL OOJSArgumentListGetNumber(JSContext *context, NSString *scriptClass, NSString *function, uintN argc, jsval *argv, double *outNumber, uintN *outConsumed)
void playMusicNamed:loop:gain:(NSString *name,[loop] BOOL loop,[gain] float gain)
References MIN, nil, OOJS_ARGV, OOJS_BEGIN_FULL_NATIVE, OOJS_END_FULL_NATIVE, OOJS_NATIVE_ENTER, OOJS_NATIVE_EXIT, OOJS_RETURN_VOID, OOJSArgumentListGetNumber(), OOJSReportBadArguments(), OOStringFromJSValue(), OOMusicController::playMusicNamed:loop:gain:, and OOMusicController::sharedController.
◆ SoundStaticStopMusic()
static JSBool SoundStaticStopMusic |
( |
JSContext * | context, |
|
|
uintN | argc, |
|
|
jsval * | vp ) |
|
static |
Definition at line 257 of file OOJSSound.m.
258{
260
261 NSString *name =
nil;
262
263 if (argc > 0)
264 {
267 {
269 return NO;
270 }
271 }
272
275 if (name ==
nil || [name isEqualToString:[controller playingMusic]])
276 {
278 }
280
282
284}
◆ sSoundClass
Initial value:=
{
"Sound",
JSCLASS_HAS_PRIVATE,
JS_PropertyStub,
JS_PropertyStub,
JS_StrictPropertyStub,
JS_EnumerateStub,
JS_ResolveStub,
JS_ConvertStub,
JSCLASS_NO_OPTIONAL_MEMBERS
}
static JSBool SoundGetProperty(JSContext *context, JSObject *this, jsid propID, jsval *value)
void OOJSObjectWrapperFinalize(JSContext *context, JSObject *this)
Definition at line 48 of file OOJSSound.m.
49{
50 "Sound",
51 JSCLASS_HAS_PRIVATE,
52
53 JS_PropertyStub,
54 JS_PropertyStub,
56 JS_StrictPropertyStub,
57 JS_EnumerateStub,
58 JS_ResolveStub,
59 JS_ConvertStub,
61 JSCLASS_NO_OPTIONAL_MEMBERS
62};
Referenced by InitOOJSSound().
◆ sSoundMethods
JSFunctionSpec sSoundMethods[] |
|
static |
Initial value:=
{
{ 0 }
}
JSBool OOJSObjectWrapperToString(JSContext *context, uintN argc, jsval *vp)
Definition at line 80 of file OOJSSound.m.
Referenced by InitOOJSSound().
◆ sSoundProperties
JSPropertySpec sSoundProperties[] |
|
static |
◆ sSoundPrototype
JSObject* sSoundPrototype |
|
static |
◆ sSoundStaticMethods
JSFunctionSpec sSoundStaticMethods[] |
|
static |
Initial value:=
{
{ 0 }
}
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 JSBool SoundStaticMusicSoundSource(JSContext *context, uintN argc, jsval *vp)
Definition at line 88 of file OOJSSound.m.
Referenced by InitOOJSSound().