Re: [seq24-users] storing tempo
Brought to you by:
rcbuse
|
From: Pete L. <pet...@gm...> - 2007-02-11 00:35:04
|
On 08/02/07, Malte Steiner <st...@bl...> wrote:
> Hello,
>
> isn't seq24 supposed to store the bpm of the song? I have 0.8.6 and
> 0.8.7 and neither version does it, always defaults to 120bpm when the
> file is reopend.
>
> Tested on 64 Studio in 64 bit mode.
In 64-bit mode, there might be a problem with the way seq24 stores
the bpm data. This was definitely a problem in a previous version, and
from your post, I guess it's not fixed. The code was (is?) assuming
sizeof(unsigned long) == 4 bytes, but in 64bit it's 8.
Here's a post I made (or tried to make) to this list some time ago, about
the issue. I haven't looked at the code for the current version, so I don't
know how the changes I mention would pan out there..
---quote old post---
Hi,
I just noticed bpm wasn't being restored when loading saved seq24
files. This was because I'm running it on a 64-bit platform. When saving
the (long) bpm value, seq24 explicitly writes 4 bytes. (This is fine,
I'm not likely to have bpm over 2^32 :-) However, when reading
back the value from the end of saved file, seq24 does the following
check:
if ((file_size - m_pos) > (int) sizeof (unsigned long))
/* Get ID + Length */
ID = read_long ();
if (ID == c_bpmtag)
{
....
(in midifile.cpp)
This won't work, because here unsigned long is 8 bytes, and there are
exactly 8 bytes left in the file (4 for the c_bpmtag, and 4 for the bpm
value itself.)
Therefore I changed this to "sizeof (unsigned int)", and now it
works. (I also modified read_long() and write_long() to explicitly
cast the read and written values from and to unsigned int, but I think
that was probably unnecessary - I was still looking for the problem
at that stage..)
If in the future a different long is stored at the end of the file, the
problem will resurface, I guess. But if read_ and write_long()
were changed to read_ and write_int32() or somesuch, things
would look safer for 64-bit use...
----End quote----
Cheers,
- Pete.
>
> Cheers,
>
> Malte
> --
> Malte Steiner
> media art + development
> -www.block4.com-
|