0
0

Hi,

how can I get the file name of an opened file in a user defined codec DLL?
I tried to use CREATESOUNDEX info strcuture but this seems not to get through fmod createSound.

thanks
Martin

  • You must to post comments
0
0

If you just want the base name of the file you could use Sound::getName, however if you require the full path you would need to pass it in via FMOD_CREATESOUNDEXINFO userdata member.

  • You must to post comments
0
0

well, this would be great. How can I access the Sound inside a codec?

The Open function looks like:
FMOD_RESULT F_CALLBACK open(FMOD_CODEC_STATE *codec, FMOD_MODE usermode, FMOD_CREATESOUNDEXINFO *userexinfo);

There is no FMOD::SOUND or FMOD_SOUND structure.

  • You must to post comments
0
0

Actually that’s my bad, no you can’t access the sound in the codec, you would need to pass the name in via createsoundexinfo.

Codecs should use the generic file interface, the codec really shouldn’t know about filenames since that implies the data is coming from the disk, where it could be a net stream or in memory data for instance. Why do you need the filename?

  • You must to post comments
0
0
  1. Well, as I said I tried the createsoundexinfo-version in the second place. This doesn’t work for some reason. craeteSound probably ignores this structure for normale file loads.

  2. Sure I use the "generic file interface". I just want to test the file name for validity.

Background info: I had a codec running at priority 9999. So my own codec is the very last in order. Ok, this worked until I found a file that is actually meant for my codec BUT it was loaded by fmods internal MP3 codec and crashed (Yes, the application crashes in FMOD) it. So, I had to go ahead and I changed the behaiour. First I changed the priority to 0. Now, my own codec is the very first one. Now I have exactly the same problem (vice versa) my Codec crashes on some MP3 files. I know I could check the file extension. This is the most exact check I can imagine. Therefore I really like to check the file name extension to prevent crashes.

  • You must to post comments
0
0
  1. Passing data via the ‘userdata’ member of ‘createsoundexinfo’ should work, are you saying the codec isn’t receiving the exinfo structure at all? or that userdata isn’t coming through? Can you double check you are passing the struct correct in createSound?

  2. I’m not familiar with your codec or your particular crashes but I’m guessing the format is very similar to MP3 if it’s fooling FMOD into thinking it has a valid MP3 file. If you send us the file causing the crash I may be able to fix it.

  • You must to post comments
0
0
  1. ok this works now. I missed passing cbSize 😉

  2. The file is on your FTP Server in defect_songs "crash_at_Traum…" It would be great if this could be fixed in FMOD as well.

  • You must to post comments
0
0

Okay I see the crash now, it happens when using FMOD_MPEGSEARCH.

I’ve made the error checking for the search a little bit stricter, the MP4 now correctly reports that it isn’t an MP3 :) The fix will be in our next release.

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.