[vorbis-dev] encoding from 22050Hz source
illiminable
ogg at illiminable.com
Mon Apr 19 20:56:19 PDT 2004
>----- Original Message -----
>From: Crock Real
>To: vorbis-dev at xiph.org
>Sent: Tuesday, April 20, 2004 1:32 AM
>Subject: [vorbis-dev] encoding from 22050Hz source
>
>
>Hi!
>
>I'd like to encode from a 22050 Hz source wav file (only in that case),
>but i get the following error message: "Invalid floating point operation"
>
>I use delphi:
>
>vorbis_encode_init_vbr(vi,2,22050,0.5)
>.
>.
>.
>While (i < readCount div 4) Do
> Begin
> buffer[0][i] := smallInt((pArray(@readbuffer)[i shl 2 + 1] shl 8)
or pArray(@readbuffer)[i shl 2 + 0]) / 32768;
> buffer[1][i] := smallInt((pArray(@readbuffer)[i shl 2 + 3] shl 8)
or pArray(@readbuffer)[i shl 2 + 2]) / 32768;
> inc(i);
>End
>
>What could be wrong???
My guess is that your floating point exception is a division by zero...
though from memory pascal at least doesn't allow integers to wrap around,
but i don't know about delphi.
But without seeing your types for your variables it's a bit hard to know
what's what... but if small int is a 16 bit signed integer and delphi wraps
integers then 32768 is out of range (-32768 <= 16bitint <= 32767)
I'm guessing 32768 becomes 0 and it's a division by zero. It should really
be 32767.
Though that presents the problem that -32768/32767 will give you a float
< -1.0... you should just clip this to -1.0, that's the easiest way.
Zen.
<p><p>>
>Thank you!
>
>crc
<p><p><p>--- >8 ----
List archives: http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-dev-request at xiph.org'
containing only the word 'unsubscribe' in the body. No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.
More information about the Vorbis-dev
mailing list