/* libFLAC - Free Lossless Audio Codec library
- * Copyright (C) 2000,2001,2002,2003,2004,2005,2006 Josh Coalson
+ * Copyright (C) 2000,2001,2002,2003,2004,2005,2006,2007,2008,2009 Josh Coalson
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* \link flac_stream_encoder stream encoder \endlink module.
*/
-/** \defgroup flac_encoder FLAC/ *_encoder.h: encoder interfaces
+/** \defgroup flac_encoder FLAC/ \*_encoder.h: encoder interfaces
* \ingroup flac
*
* \brief
* - The program creates an instance of an encoder using
* FLAC__stream_encoder_new().
* - The program overrides the default settings using
- * FLAC__stream_encoder_set_*() functions.
+ * FLAC__stream_encoder_set_*() functions. At a minimum, the following
+ * functions should be called:
+ * - FLAC__stream_encoder_set_channels()
+ * - FLAC__stream_encoder_set_bits_per_sample()
+ * - FLAC__stream_encoder_set_sample_rate()
+ * - FLAC__stream_encoder_set_ogg_serial_number() (if encoding to Ogg FLAC)
+ * - FLAC__stream_encoder_set_total_samples_estimate() (if known)
+ * - If the application wants to control the compression level or set its own
+ * metadata, then the following should also be called:
+ * - FLAC__stream_encoder_set_compression_level()
+ * - FLAC__stream_encoder_set_verify()
+ * - FLAC__stream_encoder_set_metadata()
+ * - The rest of the set functions should only be called if the client needs
+ * exact control over how the audio is compressed; thorough understanding
+ * of the FLAC format is necessary to achieve good results.
* - The program initializes the instance to validate the settings and
- * prepare for encoding using FLAC__stream_encoder_init_stream() or
- * FLAC__stream_encoder_init_FILE() or FLAC__stream_encoder_init_file()
- * for native FLAC, or FLAC__stream_encoder_init_ogg_stream() or
- * FLAC__stream_encoder_init_ogg_FILE() or
- * FLAC__stream_encoder_init_ogg_file() for Ogg FLAC, depending on the
- * nature of the input.
+ * prepare for encoding using
+ * - FLAC__stream_encoder_init_stream() or FLAC__stream_encoder_init_FILE()
+ * or FLAC__stream_encoder_init_file() for native FLAC
+ * - FLAC__stream_encoder_init_ogg_stream() or FLAC__stream_encoder_init_ogg_FILE()
+ * or FLAC__stream_encoder_init_ogg_file() for Ogg FLAC
* - The program calls FLAC__stream_encoder_process() or
* FLAC__stream_encoder_process_interleaved() to encode data, which
* subsequently calls the callbacks when there is encoder data ready
* The call to FLAC__stream_encoder_init_*() currently will also immediately
* call the write callback several times, once with the \c fLaC signature,
* and once for each encoded metadata block. Note that for Ogg FLAC
- * encoding you will usually get twice the number of callbacks than with
- * native FLAC, one for the Ogg page header and one for the page body.
+ * encoding you will usually get at least twice the number of callbacks than
+ * with native FLAC, one for the Ogg page header and one for the page body.
*
* After initializing the instance, the client may feed audio data to the
* encoder in one of two ways:
* - Channel separate, through FLAC__stream_encoder_process() - The client
* will pass an array of pointers to buffers, one for each channel, to
* the encoder, each of the same length. The samples need not be
- * block-aligned.
+ * block-aligned, but each channel should have the same number of samples.
* - Channel interleaved, through
* FLAC__stream_encoder_process_interleaved() - The client will pass a single
* pointer to data that is channel-interleaved (i.e. channel0_sample0,
* sample-aligned, i.e. the first value should be channel0_sample0 and
* the last value channelN_sampleM.
*
+ * Note that for either process call, each sample in the buffers should be a
+ * signed integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the resolution
+ * is 16 bits per sample, the samples should all be in the range [-32768,32767].
+ *
* When the client is finished encoding data, it calls
* FLAC__stream_encoder_finish(), which causes the encoder to encode any
* data still in its input pipe, and call the metadata callback with the
FLAC__STREAM_ENCODER_INIT_STATUS_INVALID_QLP_COEFF_PRECISION,
/**< The encoder has an invalid setting for the precision of the quantized linear predictor coefficients. */
- FLAC__STREAM_ENCODER_INIT_STATUS_MID_SIDE_CHANNELS_MISMATCH,
- /**< Mid/side coding was specified but the number of channels is not equal to 2. */
-
- FLAC__STREAM_ENCODER_INIT_STATUS_ILLEGAL_MID_SIDE_FORCE,
- /**< Loose mid/side coding was specified but mid/side coding was not. */
-
FLAC__STREAM_ENCODER_INIT_STATUS_BLOCK_SIZE_TOO_SMALL_FOR_LPC_ORDER,
/**< The specified block size is less than the maximum LPC order. */
* overflow the buffer. The callback then returns a status code chosen from
* FLAC__StreamEncoderReadStatus.
*
+ * Here is an example of a read callback for stdio streams:
+ * \code
+ * FLAC__StreamEncoderReadStatus read_cb(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * if(*bytes > 0) {
+ * *bytes = fread(buffer, sizeof(FLAC__byte), *bytes, file);
+ * if(ferror(file))
+ * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
+ * else if(*bytes == 0)
+ * return FLAC__STREAM_ENCODER_READ_STATUS_END_OF_STREAM;
+ * else
+ * return FLAC__STREAM_ENCODER_READ_STATUS_CONTINUE;
+ * }
+ * else
+ * return FLAC__STREAM_ENCODER_READ_STATUS_ABORT;
+ * }
+ * \endcode
+ *
* \note In general, FLAC__StreamEncoder functions which change the
* state should not be called on the \a encoder while in the callback.
*
* \retval FLAC__StreamEncoderReadStatus
* The callee's return status.
*/
-typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], unsigned *bytes, void *client_data);
+typedef FLAC__StreamEncoderReadStatus (*FLAC__StreamEncoderReadCallback)(const FLAC__StreamEncoder *encoder, FLAC__byte buffer[], size_t *bytes, void *client_data);
/** Signature for the write callback.
*
* \retval FLAC__StreamEncoderWriteStatus
* The callee's return status.
*/
-typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], unsigned bytes, unsigned samples, unsigned current_frame, void *client_data);
+typedef FLAC__StreamEncoderWriteStatus (*FLAC__StreamEncoderWriteCallback)(const FLAC__StreamEncoder *encoder, const FLAC__byte buffer[], size_t bytes, unsigned samples, unsigned current_frame, void *client_data);
/** Signature for the seek callback.
*
* when the encoder needs to seek the output stream. The encoder will pass
* the absolute byte offset to seek to, 0 meaning the beginning of the stream.
*
+ * Here is an example of a seek callback for stdio streams:
+ * \code
+ * FLAC__StreamEncoderSeekStatus seek_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 absolute_byte_offset, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * if(file == stdin)
+ * return FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED;
+ * else if(fseeko(file, (off_t)absolute_byte_offset, SEEK_SET) < 0)
+ * return FLAC__STREAM_ENCODER_SEEK_STATUS_ERROR;
+ * else
+ * return FLAC__STREAM_ENCODER_SEEK_STATUS_OK;
+ * }
+ * \endcode
+ *
* \note In general, FLAC__StreamEncoder functions which change the
* state should not be called on the \a encoder while in the callback.
*
* can use lseek(fd, SEEK_CUR, 0). The encoder may later seek back to
* these points to rewrite metadata after encoding.
*
+ * Here is an example of a tell callback for stdio streams:
+ * \code
+ * FLAC__StreamEncoderTellStatus tell_cb(const FLAC__StreamEncoder *encoder, FLAC__uint64 *absolute_byte_offset, void *client_data)
+ * {
+ * FILE *file = ((MyClientData*)client_data)->file;
+ * off_t pos;
+ * if(file == stdin)
+ * return FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED;
+ * else if((pos = ftello(file)) < 0)
+ * return FLAC__STREAM_ENCODER_TELL_STATUS_ERROR;
+ * else {
+ * *absolute_byte_offset = (FLAC__uint64)pos;
+ * return FLAC__STREAM_ENCODER_TELL_STATUS_OK;
+ * }
+ * }
+ * \endcode
+ *
* \note In general, FLAC__StreamEncoder functions which change the
* state should not be called on the \a encoder while in the callback.
*
* \retval FLAC__StreamEncoder*
* \c NULL if there was an error allocating memory, else the new instance.
*/
-FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new();
+FLAC_API FLAC__StreamEncoder *FLAC__stream_encoder_new(void);
/** Free an encoder instance. Deletes the object pointed to by \a encoder.
*
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_streamable_subset(FLAC__StreamEncoder *encoder, FLAC__bool value);
-/** Set to \c true to enable mid-side encoding on stereo input. The
- * number of channels must be 2. Set to \c false to use only
- * independent channel coding.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
-FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
-/** Set to \c true to enable adaptive switching between mid-side and
- * left-right encoding on stereo input. The number of channels must
- * be 2. Set to \c false to use exhaustive searching. In either
- * case, the mid/side stereo setting must be \c true.
- *
- * \default \c false
- * \param encoder An encoder instance to set.
- * \param value Flag value (see above).
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * \c false if the encoder is already initialized, else \c true.
- */
-FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
-
/** Set the number of channels to be encoded.
*
* \default \c 2
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_sample_rate(FLAC__StreamEncoder *encoder, unsigned value);
+/** Set the compression level
+ *
+ * The compression level is roughly proportional to the amount of effort
+ * the encoder expends to compress the file. A higher level usually
+ * means more computation but higher compression. The default level is
+ * suitable for most applications.
+ *
+ * Currently the levels range from \c 0 (fastest, least compression) to
+ * \c 8 (slowest, most compression). A value larger than \c 8 will be
+ * treated as \c 8.
+ *
+ * This function automatically calls the following other \c _set_
+ * functions with appropriate values, so the client does not need to
+ * unless it specifically wants to override them:
+ * - FLAC__stream_encoder_set_do_mid_side_stereo()
+ * - FLAC__stream_encoder_set_loose_mid_side_stereo()
+ * - FLAC__stream_encoder_set_apodization()
+ * - FLAC__stream_encoder_set_max_lpc_order()
+ * - FLAC__stream_encoder_set_qlp_coeff_precision()
+ * - FLAC__stream_encoder_set_do_qlp_coeff_prec_search()
+ * - FLAC__stream_encoder_set_do_escape_coding()
+ * - FLAC__stream_encoder_set_do_exhaustive_model_search()
+ * - FLAC__stream_encoder_set_min_residual_partition_order()
+ * - FLAC__stream_encoder_set_max_residual_partition_order()
+ * - FLAC__stream_encoder_set_rice_parameter_search_dist()
+ *
+ * The actual values set for each level are:
+ * <table>
+ * <tr>
+ * <td><b>level</b><td>
+ * <td>do mid-side stereo<td>
+ * <td>loose mid-side stereo<td>
+ * <td>apodization<td>
+ * <td>max lpc order<td>
+ * <td>qlp coeff precision<td>
+ * <td>qlp coeff prec search<td>
+ * <td>escape coding<td>
+ * <td>exhaustive model search<td>
+ * <td>min residual partition order<td>
+ * <td>max residual partition order<td>
+ * <td>rice parameter search dist<td>
+ * </tr>
+ * <tr> <td><b>0</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
+ * <tr> <td><b>1</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
+ * <tr> <td><b>2</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>0<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>3<td> <td>0<td> </tr>
+ * <tr> <td><b>3</b><td> <td>false<td> <td>false<td> <td>tukey(0.5)<td> <td>6<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr>
+ * <tr> <td><b>4</b><td> <td>true<td> <td>true<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>4<td> <td>0<td> </tr>
+ * <tr> <td><b>5</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>5<td> <td>0<td> </tr>
+ * <tr> <td><b>6</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>false<td> <td>0<td> <td>6<td> <td>0<td> </tr>
+ * <tr> <td><b>7</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>8<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr>
+ * <tr> <td><b>8</b><td> <td>true<td> <td>false<td> <td>tukey(0.5)<td> <td>12<td> <td>0<td> <td>false<td> <td>false<td> <td>true<td> <td>0<td> <td>6<td> <td>0<td> </tr>
+ * </table>
+ *
+ * \default \c 5
+ * \param encoder An encoder instance to set.
+ * \param value See above.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_compression_level(FLAC__StreamEncoder *encoder, unsigned value);
+
/** Set the blocksize to use while encoding.
*
- * \default \c 1152
+ * The number of samples to use per frame. Use \c 0 to let the encoder
+ * estimate a blocksize; this is usually best.
+ *
+ * \default \c 0
* \param encoder An encoder instance to set.
* \param value See above.
* \assert
*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_blocksize(FLAC__StreamEncoder *encoder, unsigned value);
+/** Set to \c true to enable mid-side encoding on stereo input. The
+ * number of channels must be 2 for this to have any effect. Set to
+ * \c false to use only independent channel coding.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_do_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
+/** Set to \c true to enable adaptive switching between mid-side and
+ * left-right encoding on stereo input. Set to \c false to use
+ * exhaustive searching. Setting this to \c true requires
+ * FLAC__stream_encoder_set_do_mid_side_stereo() to also be set to
+ * \c true in order to have any effect.
+ *
+ * \default \c false
+ * \param encoder An encoder instance to set.
+ * \param value Flag value (see above).
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if the encoder is already initialized, else \c true.
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_set_loose_mid_side_stereo(FLAC__StreamEncoder *encoder, FLAC__bool value);
+
/** Sets the apodization function(s) the encoder will use when windowing
* audio data for LPC analysis.
*
* \retval FLAC__bool
* \c false if the encoder is already initialized, else \c true.
*/
-/* @@@@add to unit tests*/
FLAC_API FLAC__bool FLAC__stream_encoder_set_apodization(FLAC__StreamEncoder *encoder, const char *specification);
/** Set the maximum LPC order, or \c 0 to use only the fixed predictors.
* the encoder may need to change the \a is_last flag inside them, and
* in some cases update seek point offsets. Otherwise, the encoder will
* not modify or free the blocks. It is up to the caller to free the
- * metadata blocks after encoding.
+ * metadata blocks after encoding finishes.
*
* \note
- * The encoder stores only the \a metadata pointer; the passed-in array
- * must survive at least until after FLAC__stream_encoder_init_*() returns.
- * Do not modify the array or free the blocks until then.
+ * The encoder stores only copies of the pointers in the \a metadata array;
+ * the metadata blocks themselves must survive at least until after
+ * FLAC__stream_encoder_finish() returns. Do not free the blocks until then.
*
* \note
* The STREAMINFO block is always written and no STREAMINFO block may
*/
FLAC_API FLAC__bool FLAC__stream_encoder_get_streamable_subset(const FLAC__StreamEncoder *encoder);
-/** Get the "mid/side stereo coding" flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_get_do_mid_side_stereo().
- */
-FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
-
-/** Get the "adaptive mid/side switching" flag.
- *
- * \param encoder An encoder instance to query.
- * \assert
- * \code encoder != NULL \endcode
- * \retval FLAC__bool
- * See FLAC__stream_encoder_set_loose_mid_side_stereo().
- */
-FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
-
/** Get the number of input channels being processed.
*
* \param encoder An encoder instance to query.
*/
FLAC_API unsigned FLAC__stream_encoder_get_blocksize(const FLAC__StreamEncoder *encoder);
+/** Get the "mid/side stereo coding" flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_get_do_mid_side_stereo().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_do_mid_side_stereo(const FLAC__StreamEncoder *encoder);
+
+/** Get the "adaptive mid/side switching" flag.
+ *
+ * \param encoder An encoder instance to query.
+ * \assert
+ * \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * See FLAC__stream_encoder_set_loose_mid_side_stereo().
+ */
+FLAC_API FLAC__bool FLAC__stream_encoder_get_loose_mid_side_stereo(const FLAC__StreamEncoder *encoder);
+
/** Get the maximum LPC order setting.
*
* \param encoder An encoder instance to query.
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
- * The call to FLAC__stream_encoder_init_stream() currently will also immediately
- * call the write callback several times, once with the \c fLaC signature,
- * and once for each encoded metadata block.
+ * The call to FLAC__stream_encoder_init_stream() currently will also
+ * immediately call the write callback several times, once with the \c fLaC
+ * signature, and once for each encoded metadata block.
*
* \param encoder An uninitialized encoder instance.
* \param write_callback See FLAC__StreamEncoderWriteCallback. This
* Alternatively, a dummy seek callback that just
* returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
- * less efficient for the decoder.
+ * less efficient for the encoder.
* \param tell_callback See FLAC__StreamEncoderTellCallback. This
* pointer may be \c NULL if seeking is not
* supported. If \a seek_callback is \c NULL then
* Alternatively, a dummy tell callback that just
* returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
- * less efficient for the decoder.
+ * less efficient for the encoder.
* \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired. If the client provides a seek callback,
* or FLAC__stream_encoder_process_interleaved().
* initialization succeeded.
*
- * The call to FLAC__stream_encoder_init_ogg_stream() currently will
- * also immediately call the write callback several times, once with
- * the \c fLaC signature, and once for each encoded metadata block.@@@@@@
+ * The call to FLAC__stream_encoder_init_ogg_stream() currently will also
+ * immediately call the write callback several times to write the metadata
+ * packets.
*
* \param encoder An uninitialized encoder instance.
* \param read_callback See FLAC__StreamEncoderReadCallback. This
* Alternatively, a dummy seek callback that just
* returns \c FLAC__STREAM_ENCODER_SEEK_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
- * less efficient for the decoder.
+ * less efficient for the encoder.
* \param tell_callback See FLAC__StreamEncoderTellCallback. This
* pointer may be \c NULL if seeking is not
* supported. If \a seek_callback is \c NULL then
* Alternatively, a dummy tell callback that just
* returns \c FLAC__STREAM_ENCODER_TELL_STATUS_UNSUPPORTED
* may also be supplied, all though this is slightly
- * less efficient for the decoder.
+ * less efficient for the encoder.
* \param metadata_callback See FLAC__StreamEncoderMetadataCallback. This
* pointer may be \c NULL if the callback is not
* desired. If the client provides a seek callback,
* one or more write callbacks before returning, and will generate
* a metadata callback.
*
+ * Note that in the course of processing the last frame, errors can
+ * occur, so the caller should be sure to check the return value to
+ * ensure the file was encoded properly.
+ *
* In the event of a prematurely-terminated encode, it is not strictly
* necessary to call this immediately before FLAC__stream_encoder_delete()
* but it is good practice to match every FLAC__stream_encoder_init_*()
* \param encoder An uninitialized encoder instance.
* \assert
* \code encoder != NULL \endcode
+ * \retval FLAC__bool
+ * \c false if an error occurred processing the last frame; or if verify
+ * mode is set (see FLAC__stream_encoder_set_verify()), there was a
+ * verify mismatch; else \c true. If \c false, caller should check the
+ * state with FLAC__stream_encoder_get_state() for more information
+ * about the error.
*/
-FLAC_API void FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
+FLAC_API FLAC__bool FLAC__stream_encoder_finish(FLAC__StreamEncoder *encoder);
/** Submit data for encoding.
* This version allows you to supply the input data via an array of
* pointers, each pointer pointing to an array of \a samples samples
* representing one channel. The samples need not be block-aligned,
- * but each channel should have the same number of samples.
+ * but each channel should have the same number of samples. Each sample
+ * should be a signed integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
+ * resolution is 16 bits per sample, the samples should all be in the
+ * range [-32768,32767].
*
* For applications where channel order is important, channels must
* follow the order as described in the
* channel1_sample0, ... , channelN_sample0, channel0_sample1, ...).
* The samples need not be block-aligned but they must be
* sample-aligned, i.e. the first value should be channel0_sample0
- * and the last value channelN_sampleM.
+ * and the last value channelN_sampleM. Each sample should be a signed
+ * integer, right-justified to the resolution set by
+ * FLAC__stream_encoder_set_bits_per_sample(). For example, if the
+ * resolution is 16 bits per sample, the samples should all be in the
+ * range [-32768,32767].
*
* For applications where channel order is important, channels must
* follow the order as described in the