Sorry I didn't realize that procedure existed because I am using 5.11, I have been using PureBasic for years now and am saving money as we speak to buy it as I wish to go commercial with my project, I'm sorry Fred! But the fact full versions are out there was my (I believe) main motivation to even use this language (and Fasm). But now I love it and hope to support the community as an apology for not buying it sooner, anyway:
Please take a look here, this is the current documentation (or close enough?)
http://www.purebasic.com/documentation/ ... index.html
Now all basic elements are there, but as mentioned in this article
http://www.purebasic.fr/english/viewtop ... =3&t=51369 a crucial procedure is missing: SoundListenerDirection or Orientation, as currently it would only work if the user never rotates the camera, PureBasic doesn't inform OpenAL what the listener orientation is, even the example doesn't work correctly.
I currently (pseudo) use this as orientation:
Code: Select all
; location
Sound_SetListenerLocation(CameraX(), CameraY(), CameraZ())
; rotation
Sound_SetListenerDirection(-Sin(Radian(180 - CameraYaw())),
0.0,
Cos(Radian(180 - CameraYaw())),
0.0,
1.0,
0.0)
; fixme: although this works, there should be a way to add pitch for more realism.
Those Sound_ procedures are literally:
Code: Select all
Procedure Sound_SetListenerLocation(X.f, Y.f, Z.f)
alListener3f(#AL_POSITION, X, Y, Z)
EndProcedure
Procedure Sound_SetListenerDirection(X1.f, Y1.f, Z1.f, X2.f, Y2.f, Z2.f)
Protected Dim Values.f(5)
Values(0) = X1
Values(1) = Y1
Values(2) = Z1
Values(3) = X2
Values(4) = Y2
Values(5) = Z2
alListenerfv(#AL_ORIENTATION, @Values())
FreeArray(Values())
EndProcedure
It's a procedure "UpdateListener" for my camera object, so I can use any camera I want as orientation for the sound.
Sound3D is also missing the whole reason why one would want to use OpenAL such as EFX, pitch, velocity, doppler effects...
I also recommend libsndfile, a great library to load many sound formats that is compatible with cdecl and cares about license issues (not supporting mp3 because of it). SFML uses this as well.