safety checks
This commit is contained in:
parent
2fd4e51cd0
commit
0890bd8d3f
|
@ -422,7 +422,12 @@ namespace SHADE
|
|||
if(auto it = eventMap.find(path); it != eventMap.end())
|
||||
{
|
||||
audioClipHandle = audioClipLibrary.Create();
|
||||
it->second->createInstance(&audioClipHandle->instance);
|
||||
result = it->second->createInstance(&audioClipHandle->instance);
|
||||
if(result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("Failed to create AudioClip with path {}", path)
|
||||
ErrorCheck();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -681,6 +686,7 @@ namespace SHADE
|
|||
result = fmodStudioSystem->getParameterByName(path, &value);
|
||||
if(result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("AudioSys_GetParam");
|
||||
ErrorCheck();
|
||||
}
|
||||
return value;
|
||||
|
@ -691,6 +697,7 @@ namespace SHADE
|
|||
result = fmodStudioSystem->setParameterByName(path, value);
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("AudioSys_SetParam");
|
||||
ErrorCheck();
|
||||
}
|
||||
}
|
||||
|
@ -700,6 +707,7 @@ namespace SHADE
|
|||
result = fmodStudioSystem->setParameterByNameWithLabel(path, label);
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("AudioSys_SetParamWithLabel");
|
||||
ErrorCheck();
|
||||
}
|
||||
}
|
||||
|
@ -708,9 +716,12 @@ namespace SHADE
|
|||
{
|
||||
if(!instance)
|
||||
return;
|
||||
if(!instance->isValid())
|
||||
return;
|
||||
FMOD_RESULT result = instance->start();
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("AudioClip_Play");
|
||||
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
|
||||
}
|
||||
}
|
||||
|
@ -746,9 +757,12 @@ namespace SHADE
|
|||
{
|
||||
if (!instance)
|
||||
return;
|
||||
if(!instance->isValid())
|
||||
return;
|
||||
FMOD_RESULT result = instance->stop(fadeOut ? FMOD_STUDIO_STOP_ALLOWFADEOUT : FMOD_STUDIO_STOP_IMMEDIATE);
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("AudioClip_Stop");
|
||||
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
|
||||
}
|
||||
}
|
||||
|
@ -778,7 +792,7 @@ namespace SHADE
|
|||
FMOD_RESULT result = instance->setParameterByName(paramName, value);
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
|
||||
SHLOG_ERROR("AudioClip::Play error: {}", FMOD_ErrorString(result))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -789,7 +803,7 @@ namespace SHADE
|
|||
FMOD_RESULT result = instance->setParameterByNameWithLabel(paramName, label);
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
|
||||
SHLOG_ERROR("AudioClip::SetParamWithLabel error: {}", FMOD_ErrorString(result))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -801,7 +815,7 @@ namespace SHADE
|
|||
auto result = instance->getParameterByName(paramName, &value);
|
||||
if (result != FMOD_OK)
|
||||
{
|
||||
SHLOG_ERROR("Audio system error: {}", FMOD_ErrorString(result))
|
||||
SHLOG_ERROR("AudioClip::GetParam error: {}", FMOD_ErrorString(result))
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue