Game Development Community

setup FMOD EX with TGEA

by Zachary Seldess · in Torque Game Engine Advanced · 03/06/2009 (1:55 pm) · 33 replies

Hi everyone,

I just upgraded from TGE to TGEA and also purchesed the FMOD Ex tool. Is there a simple tutorial on how to integrate FMOD into TGEA. From what I've read, it shouldn't be hard, but I see no specific guide on the Garage Games site.

best,
Zachary
Page«First 1 2 Next»
#21
07/10/2009 (7:21 am)
If the sound output hardware (soundcard) is multi channel does FMOD play 3D based sounds as surround?

If the sound output hardware (soundcard) is stereo does FMOD downmix then play 3D based sounds as stereo?
#22
07/10/2009 (7:31 am)

FMOD has a full multi-channel mixer and can mix to whatever output the underlying soundcard(s) can take, i.e. it mixes all active sounds (2D or 3D) into however many channels it targets (2, 5.1, 7.1, whatever).

So, yes to both questions.

If it comes to high-quality audio for your game, FMOD probably is as good as it gets.
#23
07/10/2009 (9:42 am)
OK so if I set a SFXDescription in TGEA to 3D do I get the same results ?
#24
07/10/2009 (9:54 am)
Yes, you get the proper result for the card/speaker configuration you are using.

If only stereo output is available, you'll still get a 3D effect--albeit without surround, of course. If output is 5.1 or 7.1 or something else, then you will have the same 3D sound but with full surround effect.

//BTW: this is not specific to FMOD; all SFX devices do this.

#25
07/12/2009 (4:29 am)
Rene, thanks so much for the help with that doppler problem (as posted in this thread: http://www.garagegames.com/community/forums/viewthread/96359).

I have some other issues more in line with this thread now. Sorry for the barrage, there are several.

1. When using OpenAL on Mac TGEA 1.8.1, the sound never attenuates to 0. amplitude, regardless of the maximum distance. Here's a video showing the behavior:

http://www.zacharyseldess.com/sampleVids/TGEA_OpenAL_rollofTest1.mov
------------------------------

2. when using FMod on Mac TGEA 1.8.1, when I set m3drolloffmode to FMOD_3D_LINEARROLLOFF, the amplitude doesn't really seem to attenuate in a linear fashion. It fades in almost to full volume really quickly at the max distance (as specified in the SFXdescription, or in the SFXEmitter parameters). Having compared several FMod configurations (Log and Linear rolloff), I actually like the OpenAL fade the best, to be honest - but I want to use FMod for the quality and mixer.

Here's a video showing the FMod Linear rolloff:
http://www.zacharyseldess.com/sampleVids/TGEA_FMod_LinearRolloffTest1.mov

Is there any way to modify the linear rolloff in FMod?
------------------------------

3. I've played around quite a bit with the Logarithmic rolloff mode in FMod, and it's quite nice, but you need to specify a REALLY small reference distance in script in order to get the sound to attenuate to near 0. amplitude. Changing the rolloff factor in the code helps, but not entirely.

What I'm looking for is a Log rolloff factor of 1 or less, but with a fade to silence at the sound's maximum distance.

Do I need to do this by setting m3drolloffmode to FMOD_3D_CUSTOMROLLOFF? And if so, how do I specify the rolloff shape? I've looked through the code and can't seem to find the set function that is mentioned in fmod.h.

One more question: Is it possible to specify a different rolloff model for each sound (i.e. exposed through script), or am I stuck using one model for everything in the game?

Thanks so much for the help.

best,
Zachary
#26
07/12/2009 (11:06 am)

1. Yep, that's what I found, too. The source parameters get passed down to OpenAL but I think this is being done incorrectly. I'll read through the specs and check the code. Will keep you updated on this.

2. None that I am aware of. You can specify a 3D rolloff callback to entirely do the rolloff computation on your own, but there's no parameters to linear falloff that I know.

Are you setting the reference distance correctly? Distance attenuation will work between these two, so if you have the reference distance way out there in your example, it would explain the short rolloff.

3. The rolloff curve is defined by handing set3DCustomRolloff a number of vectors. This can be done on a channel or a source with the latter then carrying through to the channels.

As is, there's no way to change the rolloff model for each sound. I will think about this, but what I don't like about it is that not all devices support this (OpenAL, for example, does not; there's only one global distance attenuation model) However, if you need this, it's not difficult to add it in. Just add a parameter to SFXDescription and use it when setting up the sound.

---

Personally, as much good as I've said here about FMOD, I have to say I still prefer DirectSound's mixing under Windows. Without using any of FMOD's advanced features, if the sounds don't really come out better, there's no reason not to go with OpenAL.

I will look into the min/max distance thing with OpenAL and see if that is being done correctly.
#27
07/12/2009 (11:46 am)
Okay, OpenAL is a little different here. It's AL_INVERSE_DISTANCE_CLAMPED model that's used in TGEA never clamps to zero. Instead, the gain on mMaxDistance is simply locked from there on out which means that if the volume there is 0.2 it will stay at that level regardless of how far out you walk.

I recommend changing the model to AL_LINEAR_DISTANCE_CLAMPED. That will give the desired behavior and losing some of the "reality factor" here probably isn't important.

Go into sfx/openal/sfxALDevice.cpp and change

mOpenAL.alDistanceModel( AL_INVERSE_DISTANCE_CLAMPED );

to

mOpenAL.alDistanceModel( AL_LINEAR_DISTANCE_CLAMPED );

The #define seems missing from the headers (probably copies of earlier version OpenAL headers) so simply add a

#define AL_LINEAR_DISTANCE_CLAMPED               0xD004


#28
07/12/2009 (11:54 am)
Great, I'll make those change right now for OpenAL.

2. I set the reference distance to 10 and the maximum distance to 300, and as the video shows (at least to my ears) the rolloff is not even close to linear. It should be a more gradual slope than what is exhibited.

3. I have no idea how to hand set3DCustomRolloff a number of vectors, being fairly unskilled in C++, so unless you or some other kind coding soul puts an example up, I'll just have to pretend it's not possible ;)

The same goes for adding a parameter to SFXDescription. I'm close to knowing enough to do it, but not quite.

Thanks Rene.

Zachary
#29
07/15/2009 (2:28 am)
Rene and others,

Do you know of an available resource for implementing FMod Ex in TGE 1.5.2? I've looked around, but can't seem to find anything.

best,
Zachary
#30
07/15/2009 (10:30 am)

Unfortunately, the only one I know of is so old (and also rudimentary) that it is entirely obsolete. AFAIK, there's no resource relating to current FMOD that could just be integrated as is.

If I may ask, what's your motivation for going back to TGE from TGEA?
#31
07/16/2009 (9:11 am)
Hi Rene,

Well, my motivation for going back to TGE is a looming premiere date, and familiarity. There were several engine Mods that I already had working well with TGE 1.5.2, and not quite perfectly with TGEA. I have so many other technical issues to work out before the piece goes up that I feel it's best to make certain sacrifices.

I'll be installing an interactive sound installation entitled "A Head of View" at ZKM in Karlsruhe Germany:
http://on1.zkm.de/zkm/stories/storyReader$6703

The piece will involve live video tracking of the user's body to move the avatar, while he/she holds a wireless miniature version of her own head to control avatar head rotation. It should be fun, and I've already got all that up and running with TGE, so now I can focus on in-game behavior and sound. I'll post a link to some video. I do hope to use TGEA or T3D for future projects. Thanks for all the help!

best,
Zachary
#32
07/16/2009 (9:25 am)
That looks interesting. Any chance you're doing this in Stuttgart, too? I'll come by then, I promise :)

Looking forward to the video.

BTW, good reason to stick with TGE indeed.

In case you are hopping over to Torque 3D in the future, you'll probably be very pleasantly surprised. With TGEA, I never really got the feeling it fully got to the same level as TGE 1.5.2. With Torque 3D, this is very different.
#33
07/16/2009 (9:46 am)
No plans for Stuttgart in the near future, but who knows. I'll definitely let you know if that ever happens. :)

Page«First 1 2 Next»