[vorbis-dev] Encoding into MONO (delphi)

A.Shamray yahoo at lakeofsoft.com
Fri Feb 13 03:57:33 PST 2004



> vorbis_encode_init_vbr(vi, 1, 44100, 0.5);  //because of the mono
>
> the program stops at line:
> //* uninterleave samples */
> .
> .
> buffer[1][i] := smallInt((pArray(@readbuffer)[i shl 2 + 3] shl 8) or
pArray(@readbuffer)[i shl 2 + 2]) / 32768;
> .
> .

yes, that is because our example was hard-coded to handle stereo streams only
(same as original example included in oggvorbis-win32sdk).

More correct version of the above lines is the following:

    //* uninterleave samples */
    i := 0;
    while (i < nSamples) do begin
      //
      for j := 0 to vi.channels - 1 do
        buf[j][i] := smallInt((pArray(data)[i shl vi.channels + j shl 1 + 1] shl 8) or
                               pArray(data)[i shl vi.channels + j shl 1 + 0]) / 32768;
      //
      inc(i);
    end;

<p>Where vi is a record of vorbis_info type.

Please note, that some other changes may be needed for the whole example to work
well with non-stereo streams.

<p>With best regards,
Aleksandr Shamray

--- >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