0
0

Good morning to all.
I’m implementing a 3D graphic scene (using Coin3D) containing some graphic objects (for example a car, a man, a river etc, all in the same scene). Every 3D object in the scene has his own audio features. For example every object plays a different wav file. So I create an instance of audio obj for every 3D obj.
My doubt is the following: must I also create an instance of FMOD::System *system object for every 3D object? Or system must be unique in the 3D scene and every 3D obj must refer to the same system instance?
Is FMOD::System something as a singleton?
Thank in advance 😀
Franco

  • You must to post comments
0
0

There are a bunch of examples, and the occlusion one uses openGL to render a scene.

  • You must to post comments
0
0

Good Morning.

[quote="a1psx":3tk0ywld]There are a bunch of examples, and the occlusion one uses openGL to render a scene.[/quote:3tk0ywld]

Where can I find the occlusion example? I gave a look into examples folder but I can see it.
Regards
Franco

  • You must to post comments
0
0

Just one system object.

  • You must to post comments
0
0

C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Win32\examples\geometry

  • You must to post comments
0
0

Thank you very much for your fast reply Mr…(I can see Your name)

[quote="a1psx":1jrdqoyq]Just one system object.[/quote:1jrdqoyq]

So I have to pass FMOD::System * at the constructor of my audio class right? If you want I can send the interface to you.
But what must I do if in the same 3D scene 2 different 3D objects need different configurations? Sorry if the question is banal for you, but I’m a newbie.
Regards,
Franco

  • You must to post comments
0
0

Thanx.

[quote="a1psx":168ygshp]C:\Program Files (x86)\FMOD SoundSystem\FMOD Programmers API Win32\examples\geometry[/quote:168ygshp]

This sounds very strange because I have the stable version for Linux64 and in the examples there is not geometry. I only have this:

3d filecallbacks offlinedecoding realtimestitching
cdplayer generatetone pitchdetection recording
channelgroups loadfrommemory playlist ripnetstream
common media playsound submixing
dsp_custom multiplesoundcard playstream useplugins
dsp_effectperspeaker multispeakeroutput plugin_dev usercreatedsound
effects netstream readtags

May be the geometry can not run under Linux?
Regards,
Franco

  • You must to post comments
0
0

Call system->playSound, for each object, keep the channel passed in connected to the 3d object, that way you can update it via the channel-> interface (ie, for updating its 3d position).

If you have more than one camera view of the scene, for example split screen or whatnot, use the listener functions inside system.

This is off the top of my head, I mostly use the eventSystem, with just a few channel calls for some legacy things we have to handle.

  • You must to post comments
0
0

Maybe not, but it’s worth looking at the source

  • You must to post comments
0
0

Thank again.
So before of all, for example at startup of the application I have to:

Create the system with:
[code:19l4qhgj]FMOD::System_Create[/code:19l4qhgj]

Then initialize it with:
[code:19l4qhgj]system->init[/code:19l4qhgj]

and then pass the system object created to the constructor of my sound object where I will play sound with system->playSound right? Or I can keep it as a global variable?

[quote="a1psx":19l4qhgj]Call system->playSound, for each object, keep the channel passed in connected to the 3d object, that way you can update it via the channel-> interface (ie, for updating its 3d position).[/quote:19l4qhgj]
How? can you give me a little piece of code to understand?

[quote="a1psx":19l4qhgj]If you have more than one camera view of the scene, for example split screen or whatnot, use the listener functions inside system.[/quote:19l4qhgj]
For now this is too difficult for me… I hope to implement something so later

[quote="a1psx":19l4qhgj]This is off the top of my head, I mostly use the eventSystem, with just a few channel calls for some legacy things we have to handle.[/quote:19l4qhgj]
How? In the scene I only have to play 4 or 5 sounds. Every sound is a channel of the sound card right?

Thank in advance for your relpy.
Franco

  • You must to post comments
0
0

I received the file.

[quote="a1psx":1xr32ag5]Maybe not, but it’s worth looking at the source[/quote:1xr32ag5]

I’ll give a look immediately.
Franco

  • You must to post comments
0
0

You could have it as a global, and then build a sound from it, then build channels from that.

Pseudo code[code:10n1cpbk]

system->CreateSound (soundData, &soundCarNoise);
system->CreateSound (soundData, &soundAeroplaneNoise);

//We have 2 cars and 1 aeroplane, and our objects have a function called PlaySound, which takes a fmodsound

car1->Playsound(soundCarNoise);
car2->Playsound(soundCarNoise);
aeroplane->Playsound(soundAeroplaneNoise);

//our objects have a fmod channel

void Object::Playsound(FMOD_Sound *sound)
{
system->playSound(sound, &objFmodChannel);
}

void Object::Updatesound()
{
if (objFmodChannel)
objFmodChannel->set3dattributes(position, velocity);
}
[/code:10n1cpbk]

Take a look at some of the examples, especially the 3d occlusion one, thats fairly close to a game :)

  • You must to post comments
0
0

Hi.
I wrote to you a mail where I ask to you something. I have lots of doubts.

Regards,
Franco

  • You must to post comments
0
0

Oh, and the channels are virtual channels inside FMOD. It’ll organize the priority of them for you (if silent, will not use sound cards etc)

  • You must to post comments
0
0

Thank you very much. You saved my life. Now is all much clear for me.

[code:2rl8bz14]void Object::Updatesound()
{
if (objFmodChannel)
objFmodChannel->set3dattributes(position, velocity);
}[/code:2rl8bz14]
I have to call Updatesound() every time position and/or velocity changes right?

[quote="a1psx":2rl8bz14]Oh, and the channels are virtual channels inside FMOD. It’ll organize the priority of them for you (if silent, will not use sound cards etc)[/quote:2rl8bz14]

Very powerfull. So how many channel must I pass to the system->init routine? If initially I don’t know the number of objects that will be part of the scene? And for example if some 3D objects will be created dinamically? The documentation says that 32 is the upper limit.

Is there any opensource game that use fmod that I can see?
Regards,
Franco

  • You must to post comments
0
0

Yes, each time you move an object, update it’s position.

The system::init takes the max number of virtual channels, so just set it to a number you know you’ll not exceed (but not too high), perhaps 64 or 256. You can always add a check in later to see if it’s exceeded, although you’ll get an error back from playSound, FMOD_ERR_CHANNEL_STOLEN indicating that one of your active channels has been reused. You can handle that later, once you’re more comfortable with how everything works. For the moment, just set it higher than you’ll need.

  • You must to post comments
0
0

[quote="a1psx":2jk6h0ms]Yes, each time you move an object, update it’s position.

The system::init takes the max number of virtual channels, so just set it to a number you know you’ll not exceed (but not too high), perhaps 64 or 256. You can always add a check in later to see if it’s exceeded, although you’ll get an error back from playSound, FMOD_ERR_CHANNEL_STOLEN indicating that one of your active channels has been reused. You can handle that later, once you’re more comfortable with how everything works. For the moment, just set it higher than you’ll need.[/quote:2jk6h0ms]

So If I well understood the system->init must be called outside the sound object and only one time. Is there an opensource game or graphic project using fmod?

Regards,
Franco

  • You must to post comments
Showing 16 results
Your Answer

Please first to submit.