0
0

Hi,

I think this time I found an actual bug with fmod and not my code. It seems that fmod returns ERR_INVALID_PARAM when I try to load a module file (MID/XM/S3M/IT/MOD) while another song is playing. It works however if nothing else is playing. The module files I tested it with also play without error. I have tried to reproduce this using a mp3 and a ogg file but it works as normal. A couple of times, fmod didn’t throw an exception when the error occured – my program just exited with no error raised. I have all my fmod calls in one thread so that can’t be the problem. I’m also using the flags (FMOD.MODE.HARDWARE Or FMOD.MODE.ACCURATETIME) with createSound.

Plugins loaded:
"codec_midi.dll"
"codec_dls.dll"
"codec_it.dll"
"codec_mod.dll"
"codec_s3m.dll"
"codec_xm.dll"
"codec_cdda.dll"
"codec_mpeg.dll"
"codec_oggvorbis.dll"
"codec_wav.dll"
"output_dsound.dll"
"output_winmm.dll"

Thanks for reading!

Edit: Any solutions or what not? Also I updated my subject title as it may of sounded similar to my last issue.

  • You must to post comments
0
0

I’m still not sure what is going on with this. At times I can load a module file into my playlist and it works fine. Other times it doesn’t. I’ve checked the plugins I’m loading many times, even tried some new ones as well. I’ve also checked my code many times and I can’t find a problem with it. I’ve also tried loading the sound in software mode, without the accuratetime tag, streaming it instead of loading it into memory, and with the openonly tag. Another weird thing with this, other files can be played without error after the error occured.

Here’s the code where the error occurs.

In the following I’m using a custom class that when a new instance of the class is made this code graps the file info.
[code:rbbq3kaf]If FileName IsNot Nothing Then
If FileName.ToLower().Contains(".mp3") Then
EngineMFileSound = New Sound(FileFullPath, FMOD.MODE.SOFTWARE Or FMOD.MODE.ACCURATETIME Or FMOD.MODE.MPEGSEARCH Or FMOD.MODE.OPENONLY, True)
ElseIf FileName.ToLower().Contains(".mid") Or FileName.ToLower().Contains(".xm") Or FileName.ToLower().Contains(".s3m") Or _
FileName.ToLower().Contains(".it") Or FileName.ToLower().Contains(".mod") Then
EngineMFileSound = New Sound(FileFullPath, FMOD.MODE.SOFTWARE Or FMOD.MODE.ACCURATETIME Or FMOD.MODE.OPENONLY, False)
Else
EngineMFileSound = New Sound(FileFullPath, FMOD.MODE.SOFTWARE Or FMOD.MODE.ACCURATETIME Or FMOD.MODE.OPENONLY, True)
End If
End If[/code:rbbq3kaf]
As you can see, I’m using another class that handles the fmod porition. This class is in a dll I made. Also the Boolean parameter tells whether the sound should be streamed or not. True to stream the file. False to load it into memory.

Ok following is the code from the custom dll.

[code:rbbq3kaf]private void CreateEngineSound( string name, FMOD.MODE mode )
{
Thread.BeginCriticalRegion();
try {
result = EngineSource.fmodSystem.createSound(name, mode, ref fmodSound);
EngineSource.ERRCHECK(result);
}
catch (Exception ex) {
Console.WriteLine(ex.ToString());
throw new Exception("Diamondamp error.", ex);
}
Thread.EndCriticalRegion();
}[/code:rbbq3kaf]
EngineSource is a shared class where a shared, assembly-only variable of the fmod system resides. fmodSound is also a private variable in the Sound class which is where this code resides.

So am I doing something wrong here or is it really fmod’s fault? Thanks.

  • You must to post comments
0
0

Alright I think I know what is going on now. This may be a limitation of the module files and not anyone’s fault. :) Ok so I read the help file again hoping I would find something there and I found out that module files only have one voice at all times. So, I think what’s happening when I try to make a new sound with a module file while another sound is playing, it fails because it sees no open slot for it to load into. If this is indeed the case, is there anyway I can load a module file with FMOD while another Sound is playing or at least get it’s length? I believe I can get the midi info out of the file itself if I accessed it, but I’m not sure about the other module files. Thanks.

  • You must to post comments
0
0

Ok, I have figured this out. Sorry for blaming fmod so quickly as it wasn’t it’s fault, it was mine. I hope someone out there who was having the same problem as me can gain from this.

To read a module file’s info while you have another sound playing, you have to make a new System object and Initialize it. Just use that new System object to read the file’s info. Don’t use it for playing sounds or else you’ll end up with the same error as each System object can only have one Sound open for module files. This is useful if you have a Music Player that plays both module files and mp3/ogg/flac/ect file types in a game or as a standalone app.

Hats off to FMOD for making the best audio engine I have seen, FMOD EX! Without it, my program would of been much harder to code and I wouldn’t have learnt as much as I have programming my program. :)

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.