0
0

Hi. I’m working on my own BUILD game (Duke3D, Shadow Warrior et al) and use FMOD with some success for it’s sound. Now, I’m not much of a math wiz, so I’m rather stumped on the subject of 3D sound.

My sprites are defined as such:
[code:15qovhc6]typedef struct BPACK
{
long x, y, z; //<— important
short cstat, picnum;
//...
short lotag, hitag, extra;
short ang, owner, xvel, yvel, zvel; //<— irrelevant
} spritetype;[/code:15qovhc6]

Ignoring velocity for now, I just can’t work out how to properly use these three values in FMOD. I’ve already studied both the FMOD manual and the example program.

Anybody?

  • You must to post comments
0
0

Check out the 3d example again, particularly the calls to FSOUND_3D_SetAttributes. You need to use the x, y, z in your sprite structure in a call to FSOUND_3D_SetAttributes (cast them to float).

  • You must to post comments
0
0

That oughta work… I’ll try it but expect range problems.

  • You must to post comments
0
0

Well, I tried to reimplement the function I stubbed out before and all I get is either 2D sound or 3D utter silence. Here’s some relevant information…
[code:11nx7lpx]void UpdateSoundStuff()
{
float pos[3] = { float(Player.posx), (float)Player.posy, 0.0f };
FSOUND_3D_Listener_SetAttributes(pos, NULL, 0, 0, 1.0f, 0, 1.0f, 0);
FSOUND_Update();
}

//Looping is ignored for now, focussing on getting it to play at all.
//FSOUND_NORMAL makes it play just fine, but without 3D positioning.
void playsound3D(short dasound, char loopornot, long dafreq, long davol, long posx, long posy, long posz)
{
int mysound, mychan;
double newvol = davol – ((option[8]10)2.5);
float pos[3] = { (float)posx, (float)posy, 0.0f };

if(!option[1]) return;  //stop it now if sound is supposed to be disabled

mysound = FSOUND_Sample_Load(FSOUND_FREE, soundnames[dasound], FSOUND_HW3D, 0, 0);
mychan = FSOUND_PlaySound(FSOUND_FREE, mysound);
FSOUND_SetFrequency(mychan, dafreq);
FSOUND_SetVolume(mychan, (int)newvol);

OSD_Printf(&quot;P3D: origin: %d,%d,0. You're at %d,%d,0.\n&quot;, posx,posy, Player.posx,Player.posy);

FSOUND_3D_SetAttributes(mychan, pos, NULL);

}[/code:11nx7lpx]
Console output when PlaySound3D is called:
[b:11nx7lpx]P3D: origin: 41088,31360,0. You’re at 32067,33454,0.[/b:11nx7lpx]

  • You must to post comments
0
0

Nothing but respect for you guys by default but I can’t figure this out by myself. A little help here?

  • You must to post comments
0
0

Hello,
just for your information (Itried some years ago to prog my own Duke3D engine because I found that there was no good port). But now, do you know that one:
http://jonof.edgenetwork.org/index.php?p=jfduke3d
David

  • You must to post comments
0
0

Okay… so let me reiterate that, God…

I have looping by now. I fake a sense of distance by simple volume control.

If I were to disable this volume control for a bit I should hear the sound looping at full volume all the time.

If I enable 3D sound, it’s all silent. You’re saying it’s because of massive distance. I’ll shift it into smaller values and report back, k?

As for thedrummer, guess whose engine port I’m using?

Update: >> 8. It works now.

  • You must to post comments
Showing 6 results
Your Answer

Please first to submit.