Hiya,
Basically, when you call audio.play, it returns 2 values, the channel and the sound source object stuff (my audio stuff is wrapped in my own framework so it would be useless to show you the code really) but audio.play returns the channel and the sound object (you’ll need to loop the sound forever if it was an engine sound for instance) :
local mySound = audio.loadSound(soundFileName);
local channel, sound\_object = audio.play(mySound, { loops = -1})
Then, to adjust the pitch of the sound, every frame I look at the calculated velocity of my physics object (or you may want to use a ‘revs’ value which would change the pitch according to engine revs - it all depends on how you wish to do it)
local m = 0.005;
local n = velocityOfObject \* m;
al.Source( sound\_object, al.PITCH, 1 + n);
Of course, it may not need to be called every frame, but it works for me. You’d need to experiment with the velocityOfObject and m to get the sound change you’re looking for.
I hope that helps!
[import]uid: 87794 topic_id: 30310 reply_id: 121425[/import]