]>
Dogcows Code - chaz/yoink/blob - src/moof/sound_bindings.cc
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
10 **************************************************************************/
19 static int sound_new(script
& script
)
22 if (script
[2].get(str
))
26 for (int i
= 3; script
[i
]; ++i
)
28 if (script
[i
].get(str
)) sound
.queue(str
);
40 static int sound_sample(script
& script
)
43 script
[1].require_object
<moof::sound
>("sound").get(sound
);
46 script
[2].require_string("sound name").get(name
);
52 static int sound_queue(script
& script
)
55 script
[1].require_object
<moof::sound
>("sound").get(sound
);
58 for (int i
= 2; script
[i
]; ++i
)
60 if (script
[i
].get(name
)) sound
->queue(name
);
66 static int sound_play(script
& script
)
69 script
[1].require_object
<moof::sound
>("sound").get(sound
);
74 static int sound_stop(script
& script
)
77 script
[1].require_object
<moof::sound
>("sound").get(sound
);
82 static int sound_pause(script
& script
)
85 script
[1].require_object
<moof::sound
>("sound").get(sound
);
90 static int sound_toggle(script
& script
)
93 script
[1].require_object
<moof::sound
>("sound").get(sound
);
98 static int sound_is_playing(script
& script
)
101 script
[1].require_object
<moof::sound
>("sound").get(sound
);
102 script
.push(sound
->is_playing());
107 void sound::import(script
& script
, const std::string
& nspace
)
109 script
.check_stack(4);
111 script::slot parent
= script
.push_table(nspace
);
112 script::slot meta
= script
.push_class
<sound
>(sound_new
);
114 meta
.set_field("sample", sound_sample
);
115 meta
.set_field("queue", sound_queue
);
116 meta
.set_field("play", sound_play
);
117 meta
.set_field("stop", sound_stop
);
118 meta
.set_field("pause", sound_pause
);
119 meta
.set_field("toggle", sound_toggle
);
120 meta
.set_field("is_playing", sound_is_playing
);
122 parent
.set_field("sound");
This page took 0.039555 seconds and 5 git commands to generate.