0
0

Hello, I have created this simply windows form (visual c++ .NET 2003) with last fmod version that just loads a wav file and when I do the line:

samp1 = FSOUND_Sample_Load(FSOUND_UNMANAGED, “chimes.wav”, FSOUND_NORMAL, 0, 0);

The application crashes…

I repeat that It can be executed (the application) but when I load the file It crashes.

Here is the simply example to download:

http://web.salleurl.edu/~tm08459/borrar.rar

thank you very much

  • You must to post comments
0
0

more of the code you are using might be helpfull…

  • You must to post comments
0
0

The code is in the rar file I’ve uploaded.
Anyway here is the class I use:

FSOUND_SAMPLE *samp1;

void sound::Init()
{

// Make sure we are using the correct DLL version
if (FSOUND_GetVersion() < FMOD_VERSION)
{
    exit(0);
}

if (!FSOUND_Init(44100, 32, FSOUND_INIT_GLOBALFOCUS))
{
    exit(0);
}


samp1 = FSOUND_Sample_Load(FSOUND_UNMANAGED, "chimes.wav", FSOUND_NORMAL, 0, 0);
if (!samp1 )
{
    exit(0);
}
//FSOUND_PlaySound(FSOUND_FREE, samp1);

}

void sound::DeInit()
{

// clean up
FSOUND_Sample_Free (samp1);
FSOUND_Close();

}

And If I comment the Load function it doesn’t crash, but if I leave it, it crashes.
In my main I just do the Init() function.

  • You must to post comments
0
0

Sorry, I don’t know what happened, here is a tested new version:

http://www.salleurl.edu/~tm08459/borrard.rar

  • You must to post comments
0
0

Any idea of what’s happening????

I just load an existing file and the application crashes qhen loading it.

:(

  • You must to post comments
0
0

Nobody knows it !???? :(

I suppose someone started an application like mine, right? Did it happen the same??

thanks!

  • You must to post comments
0
0

is an error message give when it crashes? (also note some of the fmod staff are away at the moment which is why responses are a bit slow)

  • You must to post comments
0
0

Ok, thanks birty…

The project is called borrard and this is the error I get when I call the Load function:

Could not load type FSOUND_SAMPLE from assembly borrar, Version=1.0.1857.36822, Culture=neutral, PublicKeyToken=null.

I even try to show the message of fmod error, but the aplication crashes before entering the “if”
samp1 = FSOUND_Sample_Load(FSOUND_UNMANAGED, “chimes.wav”, FSOUND_NORMAL, 0, 0);
if (!samp1 )
{
System::Windows::Forms::MessageBox::Show( FMOD_ErrorString(FSOUND_GetError()) );
}

thanks

  • You must to post comments
0
0

Hi,

You are getting problems because you are trying to use unmanaged code (fmod) with your managed c++ code. To be able to call fmod functions from managed code, you need to use the .NET P/Invoke mechanism to declare the fmod functions in your managed c++ code.

For example the function
FSOUND_Init

Needs to be declared in your managed code something like this:

[DllImport (“fmod.dll”)]
extern “C” _stdcall signed char FSOUND_Init(int mixrate,int maxsoftwarechannels, unsigned int flags);

There’s a thread about using fmod in managed code here:
[url:2y8pp7ne]http://www.fmod.org/forum/viewtopic.php?t=2585[/url:2y8pp7ne]

and you may find this article helpful too:

[url:2y8pp7ne]http://www.codeproject.com/managedcpp/pinvoke.asp[/url:2y8pp7ne]

  • You must to post comments
Showing 8 results
Your Answer

Please first to submit.