0
0

Hi.

I want to move a sound which position gets updated in a loop depending on an input.

Before the loop I’m calling
[code:2q1ibz2m]
// initialize ...

result = fmodSystem->createSound("sample.wav", FMOD_3D, 0, &sound1);
ERRCHECK(result);
result = sound1->set3DMinMaxDistance(0.5f * DISTANCEFACTOR, 5000.0f * DISTANCEFACTOR);
ERRCHECK(result);
result = sound1->setMode(FMOD_LOOP_NORMAL);
ERRCHECK(result);

{
FMOD_VECTOR pos = { 0.0f, 0.0f, 0.0f };
FMOD_VECTOR vel = { 0.0f, 0.0f, 0.0f };

result = fmodSystem->playSound(FMOD_CHANNEL_FREE, sound1, true, &channel1);
ERRCHECK(result);
result = channel1->set3DAttributes(&pos, &vel);
ERRCHECK(result);
result = channel1->setPaused(false);
ERRCHECK(result);
}
[/code:2q1ibz2m]

and within the loop
[code:2q1ibz2m]
pos = { newPos.x,newPos.y, 0.0f };
vel = { 0.0f, 0.0f, 0.0f };

result = channel1->set3DAttributes(&pos, &vel);
ERRCHECK(result);
result = channel1->setPaused(false);
ERRCHECK(result);
[/code:2q1ibz2m]

But on start I get thousands of samples. What am I doing wrong? I modified this snippets out of the 3d an virtual voices sample.
By the way: is it possible to move a dsp with a white noise? I didn’t find out how to handle this as a 3D sound.

Thanks for your help!

clash

  • You must to post comments
0
0

I don’t know why you’re hearing multiple copies, but why are you calling SetPaused(false) inside your loop? You haven’t paused the channel elsewhere…

   - Rick
  • You must to post comments
0
0

That must be a leftover from my different trials… But that doesn’t cause the error. Anyone else an idea?

edit: got it – forgot to call
[code:126nmdgx]system->update();[/code:126nmdgx]

  • You must to post comments
Showing 2 results
Your Answer

Please first to submit.