mirror of
https://github.com/scp-fs2open/fs2open.github.com.git
synced 2026-11-10 04:31:34 -10:00
Trunk Sync - r6556.
This commit is contained in:
1 parent
a2cafff9ee
commit
2edf65dfe0
8 files changed
+69
-15
No files matched your search
+18
-3
@@ -8302,18 +8302,33 @@ public:
|
||||
|
||||
ade_obj<track_h> l_Track("track", "Music track");
|
||||
*/
|
||||
ADE_FUNC(playMusic, l_Audio, "string Filename", "Plays a music file using FS2Open's builtin music system", NULL, NULL)
|
||||
ADE_FUNC(playMusic, l_Audio, "string Filename", "Plays a music file using FS2Open's builtin music system", "number", "Audiohandle of the created audiostream, or -1 on failure")
|
||||
{
|
||||
char *s;
|
||||
if(!ade_get_args(L, "s", &s))
|
||||
return ade_set_error(L, "b", false);
|
||||
return ade_set_error(L, "i", -1);
|
||||
|
||||
int ah = audiostream_open(s, ASF_MENUMUSIC);
|
||||
if(ah < 0)
|
||||
return ade_set_error(L, "b", false);
|
||||
return ade_set_error(L, "i", -1);
|
||||
|
||||
audiostream_play(ah);
|
||||
return ade_set_args(L, "i", ah);
|
||||
}
|
||||
|
||||
ADE_FUNC(stopMusic, l_Audio, "int audiohandle, [bool fade = false]", "Stops a playing music file, provided audiohandle is valid", NULL, NULL)
|
||||
{
|
||||
int ah;
|
||||
bool fade = false;
|
||||
if(!ade_get_args(L, "i|b", &ah, &fade))
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
if (ah >= MAX_AUDIO_STREAMS || ah < 0 )
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
audiostream_close_file(ah, fade);
|
||||
return ADE_RETURN_NIL;
|
||||
|
||||
}
|
||||
|
||||
//**********LIBRARY: Base
|
||||
|
||||
Reference in new issue
Block a user