For anyone else stuck here. I give you the gift of working code.
m_system is a pointer to the FMOD system
m_sound is a pointer to the FMOD sound
void Sound::createSoundFromResource(std::string filePath)
{
// get the file based on the path
QFile resourceFile(QString::fromStdString(filePath));
Q_ASSERT_X(resourceFile.exists(), "createSoundFromResource", "the filepath does not exist");
// open the file and read all the data from it
if (resourceFile.open(QIODevice::ReadOnly)) {
auto data = resourceFile.readAll();
// set metadata about the file so FMOD can read it
FMOD_CREATESOUNDEXINFO* exinfo = new FMOD_CREATESOUNDEXINFO();
exinfo->length = static_cast<unsigned int>(data.length());
exinfo->cbsize = sizeof(FMOD_CREATESOUNDEXINFO); // the unmentioned line which was killing me
auto result = FMOD_System_CreateSound(m_system, data.data(), FMOD_OPENMEMORY, exinfo, &m_sound);
SoundWrapper::CheckError(result);
} else {
Q_ASSERT_X(false, "createSoundFromResource", "opening the files failed");
}
}