Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/fmod_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,12 @@ namespace godot {
template<FmodServer::EventIdentifierType parameter_type>
Ref<FmodEvent> FmodServer::_create_event_instance(const EventIdentifier& identifier) {
FMOD::Studio::EventInstance* eventInstance = nullptr;
ERROR_CHECK(fetch_event_description<parameter_type>(identifier)->get_wrapped()->createInstance(&eventInstance));
auto f = fetch_event_description<parameter_type>(identifier);
if (!f.is_valid()) {
// If not valid, we already throw a warning in the cache in debug builds
return {};
}
ERROR_CHECK(f->get_wrapped()->createInstance(&eventInstance));

Ref<FmodEvent> ref = FmodEvent::create_ref(eventInstance);
if (ref.is_null() || !ref->is_valid()) {
Expand All @@ -306,6 +311,9 @@ namespace godot {
template<FmodServer::EventIdentifierType parameter_type>
void FmodServer::_play_one_shot(const FmodServer::EventIdentifier& identifier, Node* game_obj, const Dictionary& parameters) {
Ref<FmodEventDescription> desc = fetch_event_description<parameter_type>(identifier);
if (!desc.is_valid()) {
return;
}
if (!desc->is_one_shot()){
GODOT_LOG_WARNING(desc->get_path() + " is not a OneShot event.")
return;
Expand Down
11 changes: 9 additions & 2 deletions src/helpers/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,16 @@ public: \
ref.instantiate(); \
ref->_wrapped = wrapped; \
char path[MAX_PATH_SIZE]; \
ERROR_CHECK(wrapped->getPath(path, MAX_PATH_SIZE, nullptr)); \
/* FMOD_ERR_EVENT_NOTFOUND is returned for any getPath: https://www.fmod.com/docs/2.03/api/core-api-common.html#fmod_err_event_notfound */ \
FMOD_RESULT res = wrapped->getPath(path, MAX_PATH_SIZE, nullptr);\
if (res == FMOD_ERR_EVENT_NOTFOUND) { \
ref->_path = String(); \
} else { \
/* Handle other error cases */ \
ERROR_CHECK(res); \
ref->_path = String(path); \
} \
ERROR_CHECK(wrapped->getID(&ref->_guid)); \
ref->_path = String(path); \
} \
return ref; \
} \
Expand Down
Loading