コード例 #1
0
int lua_AudioSource_getState(lua_State* state)
{
    // Get the number of parameters.
    int paramCount = lua_gettop(state);

    // Attempt to match the parameters to a valid binding.
    switch (paramCount)
    {
        case 1:
        {
            if ((lua_type(state, 1) == LUA_TUSERDATA))
            {
                AudioSource* instance = getInstance(state);
                AudioSource::State result = instance->getState();

                // Push the return value onto the stack.
                lua_pushnumber(state, (int)result);

                return 1;
            }

            lua_pushstring(state, "lua_AudioSource_getState - Failed to match the given parameters to a valid function signature.");
            lua_error(state);
            break;
        }
        default:
        {
            lua_pushstring(state, "Invalid number of parameters (expected 1).");
            lua_error(state);
            break;
        }
    }
    return 0;
}
コード例 #2
0
ファイル: AudioController.cpp プロジェクト: jsethi/GamePlay
void AudioController::pause()
{
    std::list<AudioSource*>::iterator itr = _playingSources.begin();

    // For each source that is playing, pause it.
    AudioSource* source = NULL;
    while (itr != _playingSources.end())
    {
        source = *itr;
        if (source->getState() == AudioSource::PLAYING)
        {
            source->pause();
        }
        itr++;
    }
}
コード例 #3
0
ファイル: AudioController.cpp プロジェクト: jsethi/GamePlay
void AudioController::resume()
{
#ifndef __ANDROID__    
    alcMakeContextCurrent(_alcContext);
#endif
    std::list<AudioSource*>::iterator itr = _playingSources.begin();

    // For each source that is playing, resume it.
    AudioSource* source = NULL;
    while (itr != _playingSources.end())
    {
        source = *itr;
        if (source->getState() == AudioSource::PAUSED)
        {
            source->play();
        }
        itr++;
    }
}