I've nearly got everything working for a car racing game.

My only problem now is I am trying to get a revving sound from the engine when it is accelerating - otherwise using the same sound as just a rumble.

As a test, I am using the LMB. But, when I run the below I get "Script Crash Main", I press OK, it finishes loading and then the sound plays but does not adjust frequency to mimic acceleration.

Any ideas?

#include <acknex.h>
#include <default.c>
#include <ackphysx.h>
#include <particles.c>

SOUND* engine_sound = "engine.ogg";

function mouse_leftsound()
{
snd_loop(engine_sound,100,0);
}

.............other code here


function main()
{

.............other code here

while (1)
{

.............other code here

if(mouse_left){
on_mouse_left = mouse_leftsound;
var freq = ++300;
snd_tune(mouse_leftsound,100,freq,0);
}

.............other code here

wait(1);
}
}