help with metronome

Non-platform specific questions.

help with metronome

Postby schnellboot » Sat Apr 02, 2011 6:49 pm

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!
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: help with metronome

Postby Game A Gogo » Sat Apr 02, 2011 6:52 pm

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!
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: help with metronome

Postby schnellboot » Sat Apr 02, 2011 7:20 pm

if I use CreateTimer("Event Actor","Tick",BPM/60);
I can't use the Timer Event..
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: help with metronome

Postby sonicfire » Sat Apr 02, 2011 8:29 pm

why?
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score

Re: help with metronome

Postby Game A Gogo » Sat Apr 02, 2011 8:30 pm

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
Programming games is an art,
    Respect it.
User avatar
Game A Gogo
 
Posts: 3466
Joined: Wed Jun 29, 2005 10:49 pm
Location: French Canada *laughs*
Score: 181 Give a positive score

Re: help with metronome

Postby schnellboot » Sat Apr 02, 2011 8:58 pm

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?
Attachments
metronome.ged
grab the data folder from the first post thanks
(2.18 KiB) Downloaded 57 times
schnellboot
 
Posts: 819
Joined: Sat Mar 31, 2007 1:35 pm
Location: Germany
Score: 102 Give a positive score

Re: help with metronome

Postby sonicfire » Sun Apr 03, 2011 6:09 am

here´s my take on the metronome with two toggling timers...of course its not that precise in terms of timing.
Attachments
metronome.ged
(1.98 KiB) Downloaded 70 times
sonicfire
 
Posts: 425
Joined: Wed Nov 01, 2006 9:34 pm
Location: berlin germany
Score: 16 Give a positive score


Return to General

Who is online

Users browsing this forum: No registered users and 1 guest