Skip to Content

Hydogen not 64bit clean?

7 replies [Last post]
LaNcom
Offline
Joined: 04/17/2010

Hi.
I just compiled Hydrogen 0.8.2beta1 on my shiny Opteron, and it seemes to work fine - 'till I hit the play button. Everything clips, regardless of the sound driver (tried Jack and OSS), and there's a strange debug output:
[ERROR] Instrument [setPeak_L] Error: peak > 1 (peak = 3675250656748240896.000000)
[ERROR] Instrument [setPeak_R] Error: peak > 1 (peak = 3675250656748240896.000000)
This repeats a few hundred times, and the sound is completely garbled...

Any ideas?

LaNcom
Offline
Joined: 04/17/2010

I checked the AMD docs, and it seems a lot of coders use 'int' when they mean a 32bit word... - well, that wouldn't work on AMD64, where 'int' is 64bit. So AMD suggests to use 'u_int_32' instead of 'int' where 32bit is needed... (BTW, same goes for 'void', 'long' and 'long double').
The question is: where is that wrong declaration?!?

Comix
Offline
Joined: 04/17/2010

yes, I'm using int as 32bit word.. :(
I can try to change this declarations but I need your help, since I can't test it.

LaNcom
Offline
Joined: 04/17/2010

Yup, no problem!

BTW, check your inbox... ;-)

\Willie

Frank van de Pol
Offline
Joined: 04/17/2010

Hi,

I experienced a very similar problem; hydrogen does build correctly and run on my AMD64 bit machine (running x86_64 Gentoo Linux in native 64 bit). However, all the sounds generated sound like white-noise and I get the 'peak' error messages with insane figures.

Some digging in the code learned that Hydrogen is perfectly 64bit clean; and that the libaudiofile has to be blamed for the incorrect sample data. After reading the documentation of libaudiofile at http://www.68k.org/~michael/audiofile/ it is not clear to me that the requested format conversion of WAV (16 bit signed shorts) to float is supposed to work.

Would replacing the library by libsndfile be a good option?

hydrogen version: 0.8.1
libaudiofile version: 0.2.6

Comix
Offline
Joined: 04/17/2010

libsndfile support is in CVS ;)

for now I'm using libsndfile only for wave files loading, I'll replace all the old audiofile code this week.

Can you try the cvs version and tell me if is working correctly?

You can also try loading a FLAC file (v0.8.3cvs..)

Ciao

Frank van de Pol
Offline
Joined: 04/17/2010

I tested the cvs version (5/5/2004) on my 64 bit box, and the new libsndfile made a *huge* difference since I'm now perfectly able to use the hydrogen.

thanks a lot!

Frank

c0ff
Offline
Joined: 04/17/2010

Really strange, that new libsndfile fixed the problem. The bug is in Hydrogen itself. It uses #if defined(i386) || defined(alpha) to determine byte order instead of using and #if __BYTE_ORDER == __LITTLE_ENDIAN. I'll send a patch to developers.