[Flac-dev] Using libFLAC++
David Bishop
tech at bishop.dhs.org
Sun Feb 16 23:05:03 PST 2003
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[meta: Thanks, Josh, for clearing that up]
Continuing my quest to make everyone think I'm an idiot, could someone
explain the following code to me? I.e., what the two for loops are
accomplishing, and what, *exactly*, is in s16buffer when it's done.
Assume I want to write a .wav file from this decoded flac*. Is it already in
approximately the right format, or do I have to do some sort of
conversion? This code is ripped almost directly from decode.c in flac/,
just heavily cut down to deal with only 1 type of file (i.e., I'm not
dealing with differing endianess right now).
[this code is in my write callback]
static FLAC__int8 s8buffer[FLAC__MAX_BLOCK_SIZE * FLAC__MAX_CHANNELS * sizeof(FLAC__int32)];
FLAC__int16 *s16buffer = (FLAC__int16 *)s8buffer;
if( wide_samples > 0 ) {
for(sample = wide_sample = 0; wide_sample < wide_samples; wide_sample++) {
for(channel = 0; channel < channels; channel++, sample++) {
s16buffer[sample] = (FLAC__int16)(buffer[channel][wide_sample]);
}
}
}
Sorry for the newbie-style questions, I'm afraid I'm not that good, and
it's showing through :-)
D.A.Bishop
*I don't, but assume I do :-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)
iD8DBQE+UIkMEHLN/FXAbC0RAvl2AKDBea/q+8T57qxR3nL+cd8jvyds9QCfUeK+
UALSFQcE9o0Ho1sprO5faEc=
=0HHl
-----END PGP SIGNATURE-----
More information about the Flac-dev
mailing list