0
0

If you just don’t do the set3dattr does a 3d sound come through as 2d? If not, is there a way to "unspatialize" a sound.

I have footsteps that for other players I want to spatialize, but for my own character, I’d prefer just to hear them at full volume or a controlled volume with no doppler.


– Ahigh

  • You must to post comments
0
0

Its not necessary to use set3DAttributes if your sound is head relative, as it will default to 0,0,0 and stay there all the time.

  • You must to post comments
0
0

alright, probably something else I’m not doing completely correctly but anyway it works :)

  • You must to post comments
0
0

If you don’t call set3dattributes the sound will play at the position of the listener, so you should be fine, but if you keep moving the sound will stay where it is, and may sound like it plays where you are than gets softer as you leave it behind each time.

There is a way to do exactly what you said though, use Channel::set3DPanLevel to morph the sound into a 2d sound (set it to 0.0) and it will be unaffected by 3d calculations.

You have to use FMOD_SOFTWARE to support that feature.
You can also just call Channel::setMode(FMOD_2D) in the playsound paused/unpause call.

  • You must to post comments
0
0

I have the similiar problem, when I want to play a sound, I want it to stay updated at the 3DListenerPos that I have in my FMOD::Update, for example here is some code when I play a sound:

[code:3a7dsmvi] if(!b3DSound)
{
m_VCachedSoundFiles[i]->GetFMOD_Channel()->setMode(FMOD_2D);
m_VCachedSoundFiles[i]->GetFMOD_Channel()->set3DPanLevel(0.0f);
}

            result = pSystem->playSound(FMOD_CHANNEL_FREE, m_VCachedSoundFiles[i]->GetFMOD_Sound(), TRUE, m_VCachedSoundFiles[i]->GetFMOD_pChannel());
            ErrorCheck(result);

            result = m_VCachedSoundFiles[i]->GetFMOD_Channel()->set3DAttributes(&posVector, &velocity);
            ErrorCheck(result);[/code:3a7dsmvi]

If I mark the sound to play like 3DSound or Not, it makes no difference, and if I even skip the ->set3DAttributes-function it makes also no difference, the sound is always played where the 3Dlistener is in the update, but only the first frame, in next update it stays there, like you described in your earlier post, brett, and yes the sound is loaded with FMOD_SOFTWARE.

I want the sound to every playing frame to be set to the 3DlistenerPosition that is used in FMOD::Update(), but I lack the knowledge of FMOD to do it, can anyone try to describe for me how I should do it?
Thanks in advance!

Greetings
Christer

  • You must to post comments
0
0

Use FMOD_3D_HEADRELATIVE

  • You must to post comments
0
0

thanks brett that solved some of my problems :)

another problem is that this is correct the first frame as before, but when I move my 3DListener, the position of the sound isn’t updated to that 3DListener position, isn’t there a mode to set to the channel/sound to always (every frame) be played at the 3DListener position, not only in the beginning of the sound but during the update-phase of the soundengine as well

One way I tried to do, was like this:

First I load it:
[code:60e8jkul] result = pSystem->createSound(tempLoad->GetFileName().c_str(),
FMOD_LOWMEM | FMOD_SOFTWARE | FMOD_3D, 0, tempLoad->GetFMOD_pSound());
ErrorCheck(result);[/code:60e8jkul]
Then I play the sound and while playing I set a new position on the sound like this: [code:60e8jkul] result = m_VCachedSoundFiles[i]->GetFMOD_Channel()->set3DAttributes(&pos, &vel);
ErrorCheck(result);[/code:60e8jkul]
But when I call for that function to set the new position (where the listener is every frame) the sounds gets updated but get very "hacky"/"laggy", something isn’t right anyway but it almost works the way I want it to work. Am I on the right track?

  • You must to post comments
0
0

If you play the sound head relative and give it a position and rotation of 0,0,0, then it’ll have the same transform as the listener that frame and every frame thereafter.

  • You must to post comments
0
0

That’s correct, headrelative means pos is head relative. You’re not using relative positions.

  • You must to post comments
0
0

Hmm, in 3DListener I set every frame the position of the camera (making a FPS-game with only one listener), but when I set a new position of the camera the sound should follow with me, but it only disappears
I will try to give you all code that is used:
[code:2nuy4zil] if(!b3DSound)
{
m_VCachedSoundFiles[i]->GetFMOD_Channel()->setMode(FMOD_3D_HEADRELATIVE);
}

            result = pSystem->playSound(FMOD_CHANNEL_FREE, m_VCachedSoundFiles[i]->GetFMOD_Sound(), TRUE, m_VCachedSoundFiles[i]->GetFMOD_pChannel());
            ErrorCheck(result);

            if(b3DSound)
            {
                result = m_VCachedSoundFiles[i]->GetFMOD_Channel()->set3DAttributes(&posVector, &velocity);
                ErrorCheck(result);
            }[/code:2nuy4zil]

That is when I start playing a sound with some parameters, this is the system update:
[code:2nuy4zil] FMOD_VECTOR vPlPos;
vPlPos.x = vPlayerPosition->x;
vPlPos.y = vPlayerPosition->y;
vPlPos.z = vPlayerPosition->z;

result = pSystem->set3DListenerAttributes(0, &vPlPos, &m_vDifLastFrame, &m_vForward, &m_vUp);
ErrorCheck(result);[/code:2nuy4zil]

vPlayerPosition is the position of the camera and it is that pos I move every frame, but the position of the source of the sound isn’t updated, is there something else I could have missed?

  • You must to post comments
0
0

You’re setting the head relative flag before you actually play the sound. Try moving the if(!b3DSound) section after the playSound call.

  • You must to post comments
0
0

hehe, this was little more complex to understand than I thought, but I solved my problem, the solution was that in my code I didn’t set "set3DAttributes" if I didn’t want to use 3D-sounds, but it was still necessary to do it, because I thought that when I use FMOD_3D_HEADRELATIVE it will take the Listener’s position, but I guess I was wrong in some kind of way :)

Thanks for all the patience and help guys!

  • You must to post comments
Showing 11 results
Your Answer

Please first to submit.