0
0

Hi,

Im just starting to use fmod. dont really need anything spectacular, some simple sounds and background music. Ive been tryin to just get a simple background music goin but i cant find any tutorials really. Found one that was made back in 2004, so its prob out of date, hence my problems but can someone help me with the following?

Im using DirectX. So i have a method called play() that starts the music. should that be in the display loop or before it?

Also im getting a lot of errors. Here is the code.

[code:2to9q09e]

include "fmod.h"

include "fmod_errors.h"

include <conio.h>

include <stdio.h>

/* Global variables */
class gameSound
{

private:
IDirect3DDevice9* Device;
FMUSIC_MODULE* handle;

public:
gameSound() {};

void play();

};

void gameSound::play()
{
FSOUND_Init (44100, 32, 0);

// load song
handle=FMUSIC_LoadSong ("canyon.mid");

// play song only once
// when you want to play a midi file you have to disable looping
// BEFORE playing the song else this command has no effect!
FMUSIC_SetLooping (handle, false);

// play song
FMUSIC_PlaySong (handle);

}
[/code:2to9q09e]

errors i get are. MNostly that it cant find identifiers. I imagine theres something i havent set up properly. All the includes seem fine though.

1>c:\users\downey\college\game programming\pc and xbox\alienattack\gamesound.cpp(5) : error C3861: ‘FSOUND_Init’: identifier not found
1>c:\users\downey\college\game programming\pc and xbox\alienattack\gamesound.cpp(8) : error C2065: ‘handle’ : undeclared identifier
1>c:\users\downey\college\game programming\pc and xbox\alienattack\gamesound.cpp(8) : error C3861: ‘FMUSIC_LoadSong’: identifier not found
1>c:\users\downey\college\game programming\pc and xbox\alienattack\gamesound.cpp(13) : error C3861: ‘FMUSIC_SetLooping’: identifier not found
1>c:\users\downey\college\game programming\pc and xbox\alienattack\gamesound.cpp(16) : error C3861: ‘FMUSIC_PlaySong’: identifier not found

  • You must to post comments
0
0

Sorry when i say cue, i mean in the game when a ship explodes or something. Not within FMOD itself.

Basically im just trying to get sound effects to play over the background music.

I can get it to play the background music. Then when i hit S it will play another sound. But either that has to go on loop until i pause it, which wont work, or it will only play the once and i cant get it to happen again after.

So how do i get it to make the sound every time i press a button?

  • You must to post comments
0
0

By the syntax you are using, it appears you are writing FMOD 3 code, but I’m guessing you are using FMOD Ex (FMOD 4). We provide numerous examples with the API download, I suggest you take a look at some of them as a first point of reference.

Take a look at the "playstream" example to show the steps you need to follow to get music playing.

  • You must to post comments
0
0

[quote:1hxckx77]or it will only play the once and i cant get it to happen again after. [/quote:1hxckx77]
You have to call System::playSound() each time you press ‘s’. If you’re trying to hang onto one channel that wont work because it will get invalidated.

  • You must to post comments
0
0

Okay, ive got the code compiling now. But when i run it doesnt do anythign and im getting the folllowing errors:

testFmod.exe’: Loaded ‘C:\Users\Downey\College\Game Programming\PC and Xbox\AlienAttack\Sample\testFmod\Debug\testFmod.exe’, Symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\ntdll.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\kernel32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Users\Downey\College\Game Programming\PC and Xbox\AlienAttack\Sample\testFmod\Debug\fmodex.dll’, Binary was not built with debug information.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\advapi32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\rpcrt4.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\msacm32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\msvcrt.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\user32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\gdi32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\winmm.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\ole32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\oleaut32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\oleacc.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\wsock32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\ws2_32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\nsi.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\winsxs\x86_microsoft.vc80.debugcrt_1fc8b3b9a1e18e3b_8.0.50727.4053_none_e4a329d7006acfa0\msvcr80d.dll’, Symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\shimeng.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\apphelp.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\AppPatch\AcLayers.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\shell32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\shlwapi.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\userenv.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\secur32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\winspool.drv’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\mpr.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\imm32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\msctf.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\lpk.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\usp10.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\avgrsstx.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\winsxs\x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.6001.18000_none_5cdbaa5a083979cc\comctl32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\uxtheme.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\clbcatq.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\MMDevAPI.dll’, No symbols loaded.
‘testFmod.exe’: Unloaded ‘C:\Windows\System32\MMDevAPI.dll’
‘testFmod.exe’: Loaded ‘C:\Windows\System32\MMDevAPI.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\setupapi.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\wintrust.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\crypt32.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\msasn1.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\imagehlp.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\AudioSes.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\AudioEng.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\psapi.dll’, No symbols loaded.
‘testFmod.exe’: Loaded ‘C:\Windows\System32\avrt.dll’, No symbols loaded.
The thread ‘Win32 Thread’ (0x41a0) has exited with code -1 (0xffffffff).
The thread ‘Win32 Thread’ (0x42c0) has exited with code -1 (0xffffffff).
The thread ‘Win32 Thread’ (0x43c0) has exited with code -1 (0xffffffff).
The program ‘[12456] testFmod.exe: Native’ has exited with code -1 (0xffffffff).

Anyone know what is cauing these?

  • You must to post comments
0
0

None of those are errors, or even warnings. They are all informational messages.

When you run your program in the debugger, and it loads a DLL, the debugger attempts to load the debug symbols for that DLL. Most of those messages are just telling you that the debugger can’t find the symbol information for the system DLLs that its loading. Generally this is not a problem at all.

The other messages about Win32 threads exiting is, again, informational only, and is not necessarily indicative of any sort of error.

If your program is still not working, then I suggest that you add some logging or tracing to see what’s going on. Make sure to check the return values of all of your FMOD functions. Use the debugger to set breakpoints and see if you’re going down a path that you’re not expecting. If you are getting a return value from FMOD that you’re not expecting, you can try linking against fmodexL.lib and turn on some logging, which will write out some extra information.

Good luck!

  • You must to post comments
0
0

[code:3pgwzylh]The program ‘[12456] testFmod.exe: Native’ has exited with code -1 (0xffffffff). [/code:3pgwzylh]

The non-zero exit code generally indicates that there is an error in the program. For all our examples the ERRCHECK function is implemented as follows:

[code:3pgwzylh]void ERRCHECK(FMOD_RESULT result)
{
if (result != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", result, FMOD_ErrorString(result));
exit(-1);
}
}
[/code:3pgwzylh]

As you can see it will exit with code (-1). Put a break point in the ERRCHECK function of your code and see what is causing the error. I would suspect it’s probably something like ‘file not found’.

-Pete

  • You must to post comments
0
0

Yeah that was it, just stupidly left the file out of the folder i was working in. Cheers lads.

  • You must to post comments
0
0

Back again.
I got the example working fine. Now im tryin to incorporate it into my own game. I have a method called play where the song will play from. But im getting:

error LNK2019: unresolved external symbol _FMOD_System_Create@4 referenced in function "enum FMOD_RESULT __cdecl FMOD::System_Create(class FMOD::System * *)" (?System_Create@FMOD@@YA?AW4FMOD_RESULT@@PAPAVSystem@1@@Z)

I got similar problems with the example but fixed it by goin to Properties->Linker->Additional Library Directories and adding in the ..\fmod\api\lib
But that isnt working here.

Here is my Header and class files:

[code:1hvaccur]

include "d3dUtility.h"

include <windows.h>

include <stdio.h>

include <conio.h>

include "fmod.hpp"

include "fmod_errors.h"

/* Global variables */
class gameSound
{

private:
IDirect3DDevice9* Device;
FMOD::System *system;
FMOD::Sound *sound;
FMOD::Channel *channel;
FMOD_RESULT result;
int key;
unsigned int version;

public:
gameSound() {};

int play();
void ERRCHECK(FMOD_RESULT res);

};

include "gameSound.h"

void gameSound::ERRCHECK(FMOD_RESULT res)
{
if (res != FMOD_OK)
{
printf("FMOD error! (%d) %s\n", res, FMOD_ErrorString(res));
exit(-1);
}
}

int gameSound::play()
{

result = FMOD::System_Create(&amp;system);
ERRCHECK(result);

return 0;

}
[/code:1hvaccur]

  • You must to post comments
0
0

Have you set the fmodex_vc.lib as a dependency in Linker->Input->Additional Dependencies ?

  • You must to post comments
0
0

No forgot that. cheers.

  • You must to post comments
0
0

Okay i have my background music working now.
So now im trying to do effects, such as explosions, etc. when certain cues occur. The channel gorups example is similar in that multiple sounds are played at once. Is adding a sound to a channel group when a cue happens the only way to do this?

  • You must to post comments
0
0

I’m not sure what you mean, there is no concept of ‘cues’ in FMOD Ex (there is in the FMOD Designer Music System but I don’t think that is what you’re talking about). If you’re using FMOD Ex calling System::playSound will create a Channel handle which you can then put into a channel group. By default all channels are in the ‘master’ channel group.

  • You must to post comments
Showing 12 results
Your Answer

Please first to submit.