0

I'm using FMOD in my c++ project. There are no errors or warning when building, however when debugging; I get the following runtime error from the FMOD_System_CreateSound function:

Unhandled exception at 0x008e3f56 in Audio_Demo.exe: 0xC0000005: Access violation reading location 0xfdfdfdfd.

Here is the function call:

FMOD_System_CreateSound(system, filename.c_str(), FMOD_DEFAULT, NULL, &sample->sample);

Where, system is a pointer to an FMOD_SYSTEM object, sample is a helper class and sample->sample is a pointer to an FMOD_SOUND object.

If it's any help; in the project I have each of the arguments on a separate line and the error seems to occur at the final argument (sample->sample).

Thanks in advance for any help.

\,,/[>.<]\,,/

Ryuu
  • 596
  • 1
  • 5
  • 26

1 Answers1

0

Spent the whole day scratching my head about this and only just decided to post on here for help. As luck would have, a bit more digging around and I realised my mistake.

I hadn't properly initialised my helper class containing the FMOD_SOUND object pointer, so it was null and thus threw an error. Just switching around a couple of lines of code in my initialiser function sorted this (i.e. my helper class was intialised before FMOD_System_CreateSound was called)

Figured I'd post the solution I found as I can't stand it when a poster asks a question; figures it out and says "Ah, it's alright. I solved it!" without sharing the answer with the rest of the world.

Hopefully, this will help someone having a similar problem. If not, then please comment and I'll try to clarify further.

\,,/[>.<]\,,/

Ryuu
  • 596
  • 1
  • 5
  • 26