Author Topic: Can not set3DPosition  (Read 512 times)

PedroSanchez

  • Guest
Can not set3DPosition
« on: 30 Mar '19 - 14:25 »
Hi, I have never used this before, but I am having to use it for a project. I am having issues setting the position. I have :

Code: [Select]

BASS_3DVECTOR* position = new BASS_3DVECTOR(500.0f, 500.0f, 500.0f);
BASS_Apply3D();
BASS_Set3DPosition(position, NULL, NULL, NULL);
if (!BASS_Set3DPosition(position, NULL, NULL, NULL))
cout << "Could not set the 3d position of the listener" << endl;

I can not figure out why it will not set position. I have read some documentation, but I can not get it to help with this issue.

I am also having audio only from one side of ear. I have change the flag, to many different things, but nothing changes. I would be happy with any help given. Thank you

saga

  • Posts: 2306
Re: Can not set3DPosition
« Reply #1 on: 31 Mar '19 - 17:28 »
As the documentation says, BASS_Apply3D() needs to be called after making the changes, not before.
Also, you shouldn't allocate the BASS_3DVECTOR on the heap. You don't delete it so if you keep calling this code, you will be wasting more and more memory. Just put it on the stack:
Code: [Select]
BASS_3DVECTOR position(500.0f, 500.0f, 500.0f);
BASS_Set3DPosition(position, NULL, NULL, NULL);
BASS_Apply3D();

kirsty

  • Guest
Re: Can not set3DPosition
« Reply #2 on: 9 Apr '19 - 17:05 »
I am having the same result. The position can not be set. On the line BASS_3DVECTOR position(500.0f, 500.0f, 500.0f); I get the debug error saying: uniformIndex identifier "uniformIndex" is undefined   

Ian @ un4seen

  • Administrator
  • Posts: 21991
Re: Can not set3DPosition
« Reply #3 on: 9 Apr '19 - 18:00 »
That doesn't look like it's related to BASS. Are you sure the error message is on that line and there's nothing else on that line?

PedroSanchez

  • Posts: 3
Re: Can not set3DPosition
« Reply #4 on: 9 Apr '19 - 18:35 »
OK, The uniform problem seems to have sorted itself.

When I am checking the debug it does appear that the position values are being passed. So, just to double check that I am actually doing this correctly. When I give different values for the position and then play it, it should produce different volumes based on location, right? Also is the way I am using this line of code correct?

Code: [Select]
if (!BASS_Set3DPosition(position, NULL, NULL, NULL))
cout << "Could not set the 3d position of the listener" << endl;

Ian @ un4seen

  • Administrator
  • Posts: 21991
Re: Can not set3DPosition
« Reply #5 on: 10 Apr '19 - 17:05 »
Yes, that call looks fine. Be sure to also call BASS_Apply3D afterwards to apply the change. If the sounds are still sounding like they're right in front of you, check that you have enabled 3D positioning on the sounds via the BASS_SAMPLE_3D flag.