0
0

I’m new to FMOD and am uisng the C# version with FMOD version 4.12.03. I’m following the setup procedure given in the API Documentation (converting from C++ to C#), but am unable to get a sound to load. I can get FMOD initialized without any problems (EDIT actually the init() is where the ERR_INVALID_PARAM error is being thrown first), but when I try to load a sound FMOD gives an error of ERR_INVALID_PARAM. I can’t figure out what I’m doing wrong. I’m trying to play a .wav file, and it does exist in the specified location. Here is my code:
[code:1b86sbvb]
FMOD.System mcFMODSystem = new FMOD.System();
FMOD.Sound msBallBounceSound = new FMOD.Sound();
FMOD.RESULT sFMODResult;

// Setup FMOD
sFMODResult = mcFMODSystem.init(32, FMOD.INITFLAG.NORMAL, (IntPtr)(0));

// If FMOD was not initialized OK
if (sFMODResult != FMOD.RESULT.OK)
{
MessageBox.Show(FMOD.Error.String(sFMODResult), "FMOD Initialization Error");
}

// Pre-load sounds
sFMODResult = mcFMODSystem.createSound("../../Sounds/PongBallBounce.wav", FMOD.MODE.DEFAULT, ref msBallBounceSound);

if (sFMODResult != FMOD.RESULT.OK)
{
MessageBox.Show(FMOD.Error.String(sFMODResult), "FMOD Load Sound Error");
}[/code:1b86sbvb]
Can anybody see what I’m doing wrong here? Thanks.
Dan

  • You must to post comments
0
0

maybe use full path and backslashes?

  • You must to post comments
0
0

Good idea. I tried it though with no luck. I tried using just "PongBallBounce.wav" with the wav file in both my solution directory and the exe directory (bin\debug), as well as the full path, "D:\My Documents\School Assignments\CS 827 – Computer Audio\Project\CS 827 Project Source Code\bin\Debug\PongBallBounce.wav". Both of these still produced the same result though.
Any other suggestions? Thanks.
Dan

  • You must to post comments
0
0

I actually just re-organized my code (I didn’t have it setup exactly as shown in my previous post) and it looks like it’s actually the init() function which is throwing the Invalid Parameter Error message (the other functions do too, but the init is the first one to). The only parameter I think that could be causing it is the third one where I have (IntPtr)(0). Is there some other value I could try, as just "0" or "null" do not compile. Thanks.
Dan

  • You must to post comments
0
0

I think I see the problem. You aren’t setting up a system object to work with before calling init. Use System_Create and pass the fmod system object to it before calling init. It should work after doing this. Also set both the system and sound objects to null. Setting them to null seems to work best for me.

  • You must to post comments
0
0

[quote="trueamer3":7mxhovfu]I think I see the problem. You aren’t setting up a system object to work with before calling init. Use System_Create and pass the fmod system object to it before calling init. It should work after doing this. Also set both the system and sound objects to null. Setting them to null seems to work best for me.[/quote:7mxhovfu]
Actually I’m using C#, not C++, so there doesn’t seem to be a System_Create function; I believe this is done implicitly with "FMOD.System mcFMODSystem = new FMOD.System();". Correct me if I’m wrong.

Does anybody else see any problems or have any suggestions? Thanks.
Dan

  • You must to post comments
0
0

There is one but it’s listed under "Factory" FMOD.Factory.System_Create I believe. That was confusing for me at first when I was using c# too.

  • You must to post comments
0
0

[quote="trueamer3":1glsyzqb]There is one but it’s listed under "Factory" FMOD.Factory.System_Create I believe. That was confusing for me at first when I was using c# too.[/quote:1glsyzqb]
Nice, that got me up and running right away. Thanks!

P.S. It would be nice if that was mentioned in the API documentation Getting Started tutorial 😉

  • You must to post comments
Showing 7 results
Your Answer

Please first to submit.