Using the ‘tutorial’ for loading and playing 3D sounds from the help file, I came up with this code. But it’s not working, the sound plays, but not in 3D mode. Why and how do I fix it?? Please help.
[code:1liwik86]
FSOUND_SAMPLE *sound;
BOOL load_sound(char *pszPath)
{
FSOUND_SetMinHardwareChannels(1000); // For some reason, the value 16 or 8 was put here, the sound wouldn’t even play.
FSOUND_Init(32000, 64, 0);
float fNewPos[3] = { 0.0, 0.0, 0.0 }, mag = 1.0;
FSOUND_3D_Listener_SetAttributes(fNewPos, NULL, mag, mag, mag, mag, mag, mag);
sound = FSOUND_Sample_Load(nID, pszPath, FSOUND_LOOP_NORMAL | FSOUND_HW3D, 0, 0);
if(!sound) return FALSE;
return TRUE;
}
float x = 0.0;
BOOL game_loop()
{
x += 1.0;
int chan = FSOUND_PlaySound(FSOUND_FREE, sound);
float fPos[3] = { x, 0.0, 0.0 };
FSOUND_3D_SetAttributes(chan, fPos, NULL);
FSOUND_Update();
}
[/code:1liwik86]
- Yarin asked 10 years ago
- You must login to post comments
That’s not it, the game_loop is only called every five seconds.
- Yarin answered 10 years ago
- You must login to post comments
Ok i just realized your listener orientation is 1,1,1 for forward 1,1,1 for ‘up’. That is a bit weird, do you know what forward and up vectors are supposed to represent? They should be at right angles to each other, like 0,0,1 for forward and 0,1,0 for up.
- Brett Paterson answered 10 years ago
- You must login to post comments
You appear to be playing a new sound every time your game loop updates?
- Brett Paterson answered 10 years ago
- You must login to post comments
Please login first to submit.