--e89a8f3bafe5b896f304b85505a9
Content-Type: text/plain; charset=ISO-8859-1Luppp's internals use a single(!) floating point, which mixes a bar number,
and a "percent" of that bar.
Found it quite nice to work with, to get the bar you just:
int bar = (int) floatBeatPercent;
while to get the percent you:
float percent = floatBeatPercent - ((int)floatBeatPercent);In C you mention "bar" as int, and "beat" as float, I presume you want to
use the decimal part of the float to show "progress" trough that beat?
Thinking about very slow BPM's.. that could become important.-Harry
On Tue, Feb 7, 2012 at 12:28 AM, David Robillard wrote:
> Hi all, seeking opinions:
--e89a8f3bafe5b896f304b85505a9
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Luppp's internals use a single(!) floating point, which mixes a bar num=
ber, and a "percent" of that bar.Found it quite nice to work =
with, to get the bar you just:int bar =3D (int) floatBeatPercent;wh=
ile to get the percent you:
float percent =3D floatBeatPercent - ((int)floatBeatPercent);In C y=
ou mention "bar" as int, and "beat" as float, I presume=
you want to use the decimal part of the float to show "progress"=
trough that beat? Thinking about very slow BPM's.. that could become i=
mportant.
-HarryOn Tue, Feb 7, 2012 at 12:28 A=
M, David Robillard <=
d@drobilla.net> wrote:
Hi all, seeking opinions:
I have to choose a way to represent beat-based tempo time in 64 bits.
Uses are many, but the main one is event time stamps for plugins.
Requirements:
=A0* No odd data sizes (for performance / programmer ease)
=A0* High precision (ideally close to sample accurate for most tempos)
=A0* Fits in the same space as two uint32_t's
Questions:
=A0* Is "bar" needed?
=A0* Use floating point? =A0Rounding errors an issue?
Options:
/* A (moderate range, ultra precise) */
struct {
=A0 =A0uint16_t bar;
=A0 =A0uint16_t beat;
=A0 =A0uint32_t tick;
};
/* B (high range, moderate precision) */
struct {
=A0 =A0uint32_t bar;
=A0 =A0uint16_t beat;
=A0 =A0uint16_t tick;
};
/* C (high range, good precision?) */
struct {
=A0 =A0uint32_t bar
=A0 =A0float =A0 =A0beat;
};
/* D (high range/precision, but no bar) */
double beat;
I havn't run the math on precision yet, but I am leaning towards C. =A0=
I
actually hadn't considered mixing int and float before writing this
email, but it seems the best trade-off, and working with float is
certainly more pleasant than fixed point.
Thoughts?
-dr
_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@lis=
ts.linuxaudio.org
http://lists.linuxaudio.org/listinfo/linux-audio-dev
--e89a8f3bafe5b896f304b85505a9--
LINUX® is a registered trademark of Linus Torvalds in the USA and other countries.
Linuxaudio.org logo copyright Thorsten Wilms © 2006.
Hosting provided by the Virginia Tech Department of Music and DISIS.