Hello!
I've recently made a little modification for the game GTA IV, which allows the user to add custom sounds to the world which use 3D positioning.
It all works great! The only thing that isn't that great at the moment tho, is the fact that the sound is jittering...
I also have a video of that, so you can hear it for youself:
https://streamable.com/6iku95At the beginning of the video i was in the "Brief" tab of the main menu where the sound was fine, then i unpaused and it began jittering. I paused again and landed in the "Map" tab of the main menu where it still was jittering but after i switched to the "Brief" tab it was fine again.
Here's something that might be interesting: The script tick loop stops running when you switch to the "Brief" tab. And the script tick loop is where i update the listener position of Bass. Maybe afterall the problem is related to GTA IV? Not sure!
I'm using Bass version 2.4.17.0 (x86) and the ManagedBass wrapper for .NET. But it don't think it's related to the ManagedBass wrapper.
OS is Windows 10 x64.
This is how i initialize the Bass library (Also tried without RAGE.GetHWND()):
isBassInitialized = Bass.Init(-1, 44100, DeviceInitFlags.Mono | DeviceInitFlags.Device3D, RAGE.GetHWND());
The 3D Factors get set to those values (Turning off the doppler effect):
Bass.Set3DFactors(1.0f, 1.0f, 0.0f);
Bass.Apply3D();
This code is in the script tick loop which updates the listerner position
// - Get camera stuff -
CCam mainCam = CCamera.GetFinalCam();
GTAMatrix matrix = mainCam.Matrix;
Bass.Set3DPosition(matrix.pos.ToLeftHandedVector3D(), null, matrix.at.ToLeftHandedVector3DNegativeZ(), matrix.up.ToLeftHandedVector3D());
Bass.Apply3D();
And this is how i create streams and set the audio position
int handle = Bass.CreateStream(file, 0, 0, BassFlags.Bass3D);
Bass.ChannelSet3DPosition(handle, m.pos.ToLeftHandedVector3D(), Vector3.One.ToLeftHandedVector3DNegativeZ(), null);
Bass.Apply3D();
If anyone has some ideas, i would be more then happy to hear them!
If you need additional infos, please let me know!