Topic: My metronome test doesn't work, why?

Hi there,

I've tried to make a little metronome in bgt but it doesn't play the klick sound. Though the loop seems to bee entered so I can't understand what's wrong here, hope anyone can help me!

The code-Snippet is under the message.

Thanks in atvance!

Greetings
Gamefighter

timer klick;
sound klick_sound;
void main()
{
double bpm;
string bpm_string;
double klicktime;
klick_sound.load("klick.wav");
show_game_window("Metronom Test");
bpm_string = input_box("bpm", "Bitte bpm eingeben:");
bpm = string_to_number(bpm_string);
klicktime = round((60/bpm*1000), 2);
//alert("Klicktime", klicktime);
while(!key_pressed(KEY_ESCAPE))
{
//alert("", "In Schleife");
klick.restart();
if(klick.elapsed>=klicktime)
{
klick_sound.play();
klick.restart();
}
}
klick_sound.stop();
klick_sound.close();
exit();
}