alessandrofama / wwise-godot-integration

Wwise Integration for the Godot Engine
Other
288 stars 14 forks source link

Add custom blocking I/O implementation #22

Closed alessandrofama closed 3 years ago

alessandrofama commented 3 years ago

This PR replaces the default blocking I/O implementation with a custom blocking I/O implementation.

Problem

Wwise’ default blocking I/O implementation expects banks that can be opened with platform fopen methods. This works fine while working in-editor, but in exported builds files are packaged in a virtual file system that is inaccessible to Wwise. Our current workaround for this problem is copying the banks to the user data folder at the start of the engine and reading the files from there. Location of the banks need to mapped for different platforms at initialization, which can be error-prone.

Solution

This custom blocking I/O implementation uses Godot’s File class to open and read .bnk and .wem files, bypassing the need for the workaround mentioned above. Setting the base path of the banks using Godot’s res:// path will now work as expected. .bnk and .wem files still need to be added to the non-resource files export list. But at least we don’t need to check the location of the banks for every platform anymore, as Godot's File class should take care of that.

Currently tested on Windows, macOS and Android.

jorgegarcia commented 3 years ago

Great improvement, thanks Alessandro!