Example #1
0
gep::IResource* gep::FmodSoundLoader::loadResource(IResource* pInst)
{
    if(!m_isIdResolved)
    {
        FmodSoundSystem* pSystem = static_cast<FmodSoundSystem*>(g_globalManager.getSoundSystem());
        auto result = pSystem->getFmodHandle().lookupEventID(m_path.c_str(), &m_id);
        if(result != FMOD_OK)
        {
            std::ostringstream msg;
            msg << "Failed to find event '" << m_path << "' with error: " << FMOD_ErrorString(result);
            throw LoadingError(msg.str());
        }
        m_isIdResolved = true;
    }
    FmodSound* pInstance = nullptr;
    if(pInst != nullptr)
    {
        pInstance = dynamic_cast<FmodSound*>(pInst);
        GEP_ASSERT(pInstance != nullptr, "passed resource is not a FmodSound");
    }
    if(pInstance == nullptr)
    {
        pInstance = new FmodSound();
    }
    pInstance->unload();
    pInstance->load(m_id);
    return pInstance;
}
Example #2
0
void gep::FmodSound::load(const FMOD::Studio::ID& id)
{
    FmodSoundSystem* pSystem = static_cast<FmodSoundSystem*>(g_globalManager.getSoundSystem());
    auto result = pSystem->getFmodHandle().getEvent(&id, FMOD_STUDIO_LOAD_BEGIN_NOW, &m_eventDescription);
    if(result != FMOD_OK)
    {
        std::ostringstream msg;
        msg << "Error loading event: " << FMOD_ErrorString(result);
        throw LoadingError(msg.str());
    }
    m_bLoaded = true;
}
Example #3
0
gep::IResource* gep::FmodSoundInstanceLoader::loadResource(IResource* pInPlace)
{
    auto pResource = dynamic_cast<FmodSoundInstance*>(pInPlace);
    GEP_ASSERT(pInPlace == nullptr || pResource != nullptr);
    if(pResource == nullptr)
    {
        pResource = new FmodSoundInstance();
    }
    auto result = m_superResource->m_eventDescription.createInstance(&pResource->m_eventInstance);
    if(result != FMOD_OK)
    {
        std::ostringstream msg;
        msg << "Failed to create event instance of sound '"
            << m_superResource->getLoader()->getPath()
            << "' with error: " << FMOD_ErrorString(result);
        throw LoadingError(msg.str());
    }
    pResource->m_bLoaded = true;

    return pResource;
}
Example #4
0
void Stream::LoadError() {
	SetError(ERROR_LOADING_FAILED);
	if(style & STRM_THROW)
		throw LoadingError();
}