]>
Dogcows Code - chaz/yoink/blob - src/moof/sound_bindings.cc
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
8 *****************************************************************************/
17 static int sound_new(script
& script
)
20 if (script
[2].get(str
))
24 for (int i
= 3; script
[i
]; ++i
)
26 if (script
[i
].get(str
)) sound
.queue(str
);
38 static int sound_sample(script
& script
)
41 script
[1].require_object
<moof::sound
>("sound").get(sound
);
44 script
[2].require_string("sound name").get(name
);
50 static int sound_queue(script
& script
)
53 script
[1].require_object
<moof::sound
>("sound").get(sound
);
56 for (int i
= 2; script
[i
]; ++i
)
58 if (script
[i
].get(name
)) sound
->queue(name
);
64 static int sound_play(script
& script
)
67 script
[1].require_object
<moof::sound
>("sound").get(sound
);
72 static int sound_stop(script
& script
)
75 script
[1].require_object
<moof::sound
>("sound").get(sound
);
80 static int sound_pause(script
& script
)
83 script
[1].require_object
<moof::sound
>("sound").get(sound
);
88 static int sound_toggle(script
& script
)
91 script
[1].require_object
<moof::sound
>("sound").get(sound
);
96 static int sound_is_playing(script
& script
)
99 script
[1].require_object
<moof::sound
>("sound").get(sound
);
100 script
.push(sound
->is_playing());
104 void sound::import(script
& script
, const std::string
& nspace
)
106 script
.check_stack(4);
108 script::slot parent
= script
.push_table(nspace
);
109 script::slot meta
= script
.push_class
<sound
>(sound_new
);
111 meta
.set_field("is_playing", sound_is_playing
);
112 meta
.set_field("pause", sound_pause
);
113 meta
.set_field("play", sound_play
);
114 meta
.set_field("queue", sound_queue
);
115 meta
.set_field("sample", sound_sample
);
116 meta
.set_field("stop", sound_stop
);
117 meta
.set_field("toggle", sound_toggle
);
119 parent
.set_field("sound");
This page took 0.039087 seconds and 4 git commands to generate.