Thanks for the speedy feedback Reconnoiter.
I have progressed to the script below - which almost works.
It is already inside the main while loop - so should be ok.
Yes - I didn't need the "on_mouse_left = mouse_leftsound;" to trigger the snd
Yes, I needed a handle - now that is 'rev'.
What happens now is the sound starts on load - good - the LMB triggers a change in pitch - good - but on release of LMB the pitch stays the same - it should go back to the original!
Because I am using 'speed' to also drive the wheels of the car I don't really want to change that although I think I need an 'else' to set 'speed' back to zero...
SOUND* engine_sound = "engine.ogg";
var rev;
var freq;
function mouse_leftsound()
{
rev = snd_loop(engine_sound,100,0);
}
.............other code here
function main()
{
.............other code here
mouse_leftsound();
while (1)
{
var speed=0;
if(mouse_left)
{
speed+=1; //forward speed
}
.............other code here
freq = 200*speed;
snd_tune(rev,100,freq,0);
.............other code here
wait(1);
}
}