Files
Webcam/include/modules/script_squirrel/legacy/sound_binding.cpp

45 lines
1.3 KiB
C++

/* -----------------------------------------------------------------------------
GSFramework
Copyright 2001-2013 Emmanuel Julien. All Rights Reserved.
----------------------------------------------------------------------------- */
#include "squirrel.h"
#include "script_squirrel/legacy/binding_helpers.h"
#include "core/sound.h"
using namespace GS::Audio;
using namespace GS::Script;
//------------------------------------------------------------------------------
SQInteger SoundGetDuration(HSQUIRRELVM vm)
{
__SQ_GETSINGLESAFEPTR(s, Sound, typetag_Sound)
__SQ_RETURNINT(s->mixer_data.IsValid() ? s->mixer_data->Get()->duration.toMs() : -1)
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
void RegisterSoundBinding(HSQUIRRELVM vm)
{
/*#
Topic: Sound
Desc: A sound object stores audio data that can be played back by the sound mixer.
Type: Sound
Related: Mixer
#*/
/*#
Section: SoundGeneric
Desc: Generic functions
#*/
/*#
Func: SoundGetDuration
Proto: int:sound
Desc: Returns the sound duration in milliseconds.
#*/
sq_register(vm, SoundGetDuration, "SoundGetDuration", _SC(".x"));
}
//------------------------------------------------------------------------------