Page 1 of 1

help with metronome

PostPosted: Sat Apr 02, 2011 6:49 pm
by schnellboot
Okay I'm currently working on a metronome.
I have two problems for now.
1.
Code: Select all
count++;
if(count>=real_fps*convBPM) //convBPM is bpm/60 for this example 80/60
{
    textNumber++;
    count=0;
}

I use this code in metronome->Draw Actor
this should be correct right?
But what I get is some irregular metronome beats. Just check my demo you'll see what I mean.

2.
if I do
Code: Select all
convBPM=bpmBox/60

but it does only give an error
how to fix that?

thanks!

Re: help with metronome

PostPosted: Sat Apr 02, 2011 6:52 pm
by Game A Gogo
You're better off creating a timer for this, with "CreateTimer("Event Actor","Tick",BPM/60);" everytime the timer is triggered, recreate it, don't make it a constant loop!

Re: help with metronome

PostPosted: Sat Apr 02, 2011 7:20 pm
by schnellboot
if I use CreateTimer("Event Actor","Tick",BPM/60);
I can't use the Timer Event..

Re: help with metronome

PostPosted: Sat Apr 02, 2011 8:29 pm
by sonicfire
why?

Re: help with metronome

PostPosted: Sat Apr 02, 2011 8:30 pm
by Game A Gogo
Ah, create the timer using the Function/Variable button, then change it into the script I showed you. Then it will register the timer inside the timer list... I know it's weird

Re: help with metronome

PostPosted: Sat Apr 02, 2011 8:58 pm
by schnellboot
Ok thank you very much, it almost works now.
Please try this updated ged and put in first 60 or 80 and then try 40 and 100
why does it only work with 60-80 bpm?

Re: help with metronome

PostPosted: Sun Apr 03, 2011 6:09 am
by sonicfire
here“s my take on the metronome with two toggling timers...of course its not that precise in terms of timing.