0
0

Hi everyone. As I’ve said I’m new at this but I’m pretty sure I did this right… or nearly correct.

Here is the code.

[code:37d4tbmd]
// 3D test try two ok.cpp : Defines the entry point for the console application.
//

include "stdafx.h"

include <fmod.hpp>

include <fmod_errors.h>

include <stdlib.h>

include <stdio.h>

include <conio.h>

include <windows.h>

FMOD_RESULT result;
FMOD::System *Test;

int main(int argc, _TCHAR* argv[])
{
printf("PLEASE PLAY DANG IT!");

FMOD::System_Create(&amp;Test);     // Create the main system object.




Test-&gt;init(100, FMOD_INIT_NORMAL, 0);    




FMOD::Sound *drums;
result = Test-&gt;createSound (&quot;dreamhats2.wav&quot;, FMOD_DEFAULT, 0, &amp;drums);
result = drums-&gt;setMode(FMOD_LOOP_NORMAL);

FMOD::Channel *source;
result = Test-&gt;playSound(FMOD_CHANNEL_FREE, drums, 0, 0);





while (!kbhit()) 
    Test -&gt; update();


return 0;

}

[/code:37d4tbmd]

I had to take out the ereror checks because they kept causing other problems. Do I need those for this to work.

I’m using Visual Studio 2008.

As you can see, I’ve included all the proper headers and put the fmodex.dll in the source file folder. The dreamhats2.wav sample is also in the Source file folder.

That didn’t work, so I moved the sound and dll to the debug folder… that didn’t work.

I’m not sure why the sound won’t play. The box appears, the text shows up, there are no errors saying that visual does not recignize something in the fmod sections of code, but it still will not play.

I will mess with some examples and try replacing the sound files in those.

On a side note, I changed the name of the system in the 3d example and I replaced some of the sounds and changed the text, but when I recompiled it, nothing changed and the box opened and closed really quickly. This may be a different problem. The main one is the problem mentioned above.

Any ideas? Thanks.[/code]

  • You must to post comments
0
0

FMOD is a multi-threaded library, so if you keep calling update without a sleep, the main thread will be spending a lot of time holding a lock on the critical sections, which could be preventing the other threads from operating properly. To remedy this you can try adding a sleep:
[code:11giwo64]
while (!kbhit())
{
Test -> update();
Sleep(30);
}
[/code:11giwo64]

[quote:11giwo64]As you can see, I’ve included all the proper headers and put the fmodex.dll in the source file folder. The dreamhats2.wav sample is also in the Source file folder. [/quote:11giwo64]
Are you linking to the FMOD library?
if not go to [b:11giwo64]Project Properties[/b:11giwo64] -> [b:11giwo64]linker[/b:11giwo64] -> [b:11giwo64]input[/b:11giwo64] -> [b:11giwo64]Additional Dependencies[/b:11giwo64]
Add the following:[i:11giwo64] fmodex_vc.lib[/i:11giwo64]

I would expect this to cause linker errors so that’s probably not the problem.

[quote:11giwo64]I changed the name of the system in the 3d example and I replaced some of the sounds and changed the text, but when I recompiled it, nothing changed and the box opened and closed really quickly[/quote:11giwo64]
The ERRCHECK function in the examples exits the program when there is an error. If you put a break point on this line it will break before it exits and you can see what error you’re getting. In this case it could be a file not found error.

-Pete

  • You must to post comments
0
0

Ok thanks. I’ll try this out.

The update was just added today but it didn’t work before either.

I don’t know if I linked the fmodex_vc.lib correctly as it shows up in bold so I’m not sure.

I’ll keep trying.

With the 3D example, I am not sure if I pointeid to the wrong file or place but I’m pretty sure I put the entire file path in quotes so there’s no way it could get it wrong. I made sure that when I changed the system name (to riblet because I was bored), but I made sure I changed the name of all the places where system-> and thigns like that shows up.

I’ll mess with it some more. But thank you for replying.

  • You must to post comments
0
0

[quote:hs3d8ycx]I am not sure if I pointeid to the wrong file or place but I’m pretty sure I put the entire file path in quotes so there’s no way it could get it wrong.[/quote:hs3d8ycx]
It can be identical to what is shown in explorer and still be wrong. If you’re using backslashes you need two in a row "\" otherwise it indicates a special character like "\n" is a new line.

C:\Users\User\Music

would be
"C:\Users\User\Music"

-Pete

  • You must to post comments
Showing 3 results
Your Answer

Please first to submit.