0
0

Hello

I’m working on a simpel FMOD wrapper class for a small game project and i have a little problem with a specific function in fmod.

[code:ngqv9vxy]FMOD_RESULT F_API getName (char *name, int namelen);
[/code:ngqv9vxy]

I try to use this function to get the name of a sound in a std::vector<FMOD::Sound*> like this:

[code:ngqv9vxy]char* myFileName = 0;
mySounds.at(index)->getName(myFileName, 0);
[/code:ngqv9vxy]

I wonder why i don’t get the name of the sound file and what the second argument in getName "int namelen" is.

Please help =)

  • You must to post comments
0
0

getName() copies the name of the Sound into a buffer that you provide. You can’t just give it a pointer to a char, you have to give it the head of a char array. But because it’s an array of characters, you have to tell FMOD how many characters you have.

The proper usage is something like:
[code:2fq9cvik]const int FILENAME_LENGTH = 32; // Or some other number, pick whatever seems appropriate.
char myFilename[FILENAME_LENGTH];
mySounds.at(index)->getName(myFileName, FILENAME_LENGTH);
[/code:2fq9cvik]
Hope that helps!

  • You must to post comments
0
0

Yes it did :)

Thank you!

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.