Document SFC_SET_SCALE_FLOAT_INT_READ.

This commit is contained in:
Erik de Castro Lopo 2004-09-30 16:01:03 +00:00
parent 9540d9deec
commit e446bf7440
2 changed files with 70 additions and 28 deletions

View File

@ -1,3 +1,11 @@
2004-10-01 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* src/sndfile.h.in src/sndfile.c tests/floating_point_test.tpl
Rename SFC_SET_FLOAT_INT_MULTIPLIER to SFC_SET_SCALE_FLOAT_INT_READ.
* doc/command.html
Document SFC_SET_SCALE_FLOAT_INT_READ.
2004-09-30 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
* tests/floating_point_test.(tpl|def)

View File

@ -20,18 +20,18 @@
int sf_command (SNDFILE *sndfile, int cmd, void *data, int datasize) ;
</PRE>
<P>
This function allows the caller to retrieve information from or change aspects of the
library behaviour.
Examples include retrieving a string containing the library version or changing the
This function allows the caller to retrieve information from or change aspects of the
library behaviour.
Examples include retrieving a string containing the library version or changing the
scaling applied to floating point sample data during read and write.
Most of these operations are performed on a per-file basis.
</P>
<P>
The cmd parameter is a integer identifier which is defined in &lt;sndfile.h&gt;.
All of the valid command identifiers have names beginning with "SFC_".
Data is passed to and returned from the library by use of a void pointer.
The library will not read or write more than datasize bytes from the void pointer.
For some calls no data is required in which case data should be NULL and datasize
Data is passed to and returned from the library by use of a void pointer.
The library will not read or write more than datasize bytes from the void pointer.
For some calls no data is required in which case data should be NULL and datasize
may be used for some other purpose.
</P>
<P>
@ -69,7 +69,7 @@
<TD><A HREF="#SFC_SET_NORM_FLOAT">SFC_SET_NORM_FLOAT</A></TD>
<TD>Modify the normalisation behaviour of the floating point reading and writing functions.</TD>
</TR>
<TR>
<TR>
<TD><A HREF="#SFC_SET_NORM_DOUBLE">SFC_SET_NORM_DOUBLE</A></TD>
<TD>Modify the normalisation behaviour of the double precision floating point reading and writing functions.</TD>
</TR>
@ -77,10 +77,15 @@
<TD><A HREF="#SFC_GET_NORM_FLOAT">SFC_GET_NORM_FLOAT</A></TD>
<TD>Retrieve the current normalisation behaviour of the floating point reading and writing functions.</TD>
</TR>
<TR>
<TR>
<TD><A HREF="#SFC_GET_NORM_DOUBLE">SFC_GET_NORM_DOUBLE</A></TD>
<TD>Retrieve the current normalisation behaviour of the double precision floating point reading and writing functions.</TD>
</TR>
<TR>
<TD><A HREF="#SFC_SET_SCALE_FLOAT_INT_READ">SFC_SET_SCALE_FLOAT_INT_READ</A></TD>
<TD>Set/clear the scale factor when integer (short/int) data is read from a file
containing floating point data.</TD>
</TR>
<TR>
<TD><A HREF="#SFC_GET_SIMPLE_FORMAT_COUNT">SFC_GET_SIMPLE_FORMAT_COUNT</A></TD>
<TD>Retrieve the number of simple formats supported by libsndfile.</TD>
@ -140,7 +145,7 @@
<TR>
<TD><A HREF="#SFC_SET_CLIPPING">SFC_SET_CLIPPING</A></TD>
<TD>Turn on/off automatic clipping when doing floating point to integer
<TD>Turn on/off automatic clipping when doing floating point to integer
conversion.</TD>
</TR>
@ -156,7 +161,7 @@
<TD>Add dither to output on write.</TD>
</TR>
-->
</TABLE>
</TABLE>
</CENTER>
<BR><BR>
@ -263,7 +268,7 @@ Example:
<A NAME="SFC_CALC_NORM_SIGNAL_MAX"></A>
<H2><BR><B>SFC_CALC_NORM_SIGNAL_MAX</B></H2>
<P>
Retrieve the measured normalised maximum signal value. This involves reading
Retrieve the measured normalised maximum signal value. This involves reading
through the whole file which can be slow on large files.
</P>
<P>
@ -369,7 +374,7 @@ Parameters:
datasize : SF_TRUE or SF_FALSE
</PRE>
<P>
For read operations setting normalisation to SF_TRUE means that the data from all
For read operations setting normalisation to SF_TRUE means that the data from all
subsequent reads will be be normalised to the range [-1.0, 1.0].
</P>
<P>
@ -397,7 +402,7 @@ Example:
<A NAME="SFC_SET_NORM_DOUBLE"></A>
<H2><BR><B>SFC_SET_NORM_DOUBLE</B></H2>
<P>
This command only affects data read from or written to using the double precision
This command only affects data read from or written to using the double precision
floating point functions:
</P>
<PRE>
@ -417,7 +422,7 @@ Parameters:
datasize : SF_TRUE or SF_FALSE
</PRE>
<P>
For read operations setting normalisation to SF_TRUE means that the data
For read operations setting normalisation to SF_TRUE means that the data
from all subsequent reads will be be normalised to the range [-1.0, 1.0].
</P>
<P>
@ -493,6 +498,35 @@ Example:
<DD>Returns TRUE if normalisation is on and FALSE otherwise.
</DL>
<!-- ========================================================================= -->
<A NAME="SFC_SET_SCALE_FLOAT_INT_READ"></A>
<H2><BR><B>SFC_SET_SCALE_FLOAT_INT_READ</B></H2>
<P>
Set/clear the scale factor when integer (short/int) data is read from a file
containing floating point data.
</P>
<P>
Parameters:
</P>
<PRE>
sndfile : A valid SNDFILE* pointer
cmd : SFC_SET_SCALE_FLOAT_INT_READ
data : NULL
datasize : TRUE or FALSE
</PRE>
<P>
Example:
</P>
<PRE>
sf_command (sndfile, SFC_SET_SCALE_FLOAT_INT_READ, NULL, SF_TRUE) ;
</PRE>
<DL>
<DT>Return value: </DT>
<DD>Returns the previous SFC_SET_SCALE_FLOAT_INT_READ setting for this file.
</DL>
<!-- ========================================================================= -->
<A NAME="SFC_GET_SIMPLE_FORMAT_COUNT"></A>
<H2><BR><B>SFC_GET_SIMPLE_FORMAT_COUNT</B></H2>
@ -546,7 +580,7 @@ The SF_FORMAT_INFO struct is defined in &lt;sndfile.h&gt; as:
} SF_FORMAT_INFO ;
</PRE>
<P>
When sf_command() is called with SF_GET_SIMPLE_FORMAT, the value of the format
When sf_command() is called with SF_GET_SIMPLE_FORMAT, the value of the format
field should be the format number (ie 0 &lt;= format &lt;= count value obtained using
SF_GET_SIMPLE_FORMAT_COUNT).
</P>
@ -568,8 +602,8 @@ Example:
<DL>
<DT>Return value: </DT>
<DD>0 on success and non-zero otherwise.
<DD>The value of the format field of the SF_FORMAT_INFO struct will be a value which
can be placed in the format field of an SF_INFO struct when a file is to be opened
<DD>The value of the format field of the SF_FORMAT_INFO struct will be a value which
can be placed in the format field of an SF_INFO struct when a file is to be opened
for write.
<DD>The name field will contain a char* pointer to the name of the string, eg. "WAV (Microsoft 16 bit PCM)".
<DD>The extension field will contain the most commonly used file extension for that file type.
@ -601,11 +635,11 @@ The SF_FORMAT_INFO struct is defined in &lt;sndfile.h&gt; as:
} SF_FORMAT_INFO ;
</PRE>
<P>
When sf_command() is called with SF_GET_FORMAT_INFO, the format field is
When sf_command() is called with SF_GET_FORMAT_INFO, the format field is
examined and if (format &amp; SF_FORMAT_TYPEMASK) is a valid format then the struct
is filled in with information about the given major type.
If (format &amp; SF_FORMAT_TYPEMASK) is FALSE and (format &amp; SF_FORMAT_SUBMASK) is a
valid subtype format then the struct is filled in with information about the given
valid subtype format then the struct is filled in with information about the given
subtype.
</P>
<P>
@ -763,9 +797,9 @@ directory of the libsndfile source code distribution.
<DL>
<DT>Return value: </DT>
<DD>0 on success and non-zero otherwise.
<DD>The value of the format field will be one of the major format identifiers such as
<DD>The value of the format field will be one of the major format identifiers such as
SF_FORMAT_WAV or SF_FORMAT_AIFF.
<DD>The name field will contain a char* pointer to the name of the string; for instance
<DD>The name field will contain a char* pointer to the name of the string; for instance
"WAV (Microsoft)" or "AIFF (Apple/SGI)".
<DD>The extension field will be a NULL pointer.
</DL>
@ -774,7 +808,7 @@ directory of the libsndfile source code distribution.
<A NAME="SFC_SET_ADD_PEAK_CHUNK"></A>
<H2><BR><B>SFC_SET_ADD_PEAK_CHUNK</B></H2>
<P>
By default, WAV and AIFF files which contain floating point data (subtype SF_FORMAT_FLOAT
By default, WAV and AIFF files which contain floating point data (subtype SF_FORMAT_FLOAT
or SF_FORMAT_DOUBLE) have a PEAK chunk.
By using this command, the addition of a PEAK chunk can be turned on or off.
</P>
@ -815,9 +849,9 @@ closed using <B>sf_close()</B>.
<P>
There are however situations where large files are being generated and it would
be nice to have valid data in the header before the file is complete.
Using this command will update the file header to reflect the amount of data written
Using this command will update the file header to reflect the amount of data written
to the file so far.
Other programs opening the file for read (before any more data is written) will
Other programs opening the file for read (before any more data is written) will
then read a valid sound file header.
</P>
<P>
@ -890,7 +924,7 @@ Truncate the file to the number of frames specified by the sf_count_t pointed
to by data.
After this command, both the read and the write pointer will be
at the new end of the file.
This command will fail (returning non-zero) if the requested truncate position
This command will fail (returning non-zero) if the requested truncate position
is beyond the end of the file.
</P>
<P>
@ -1001,7 +1035,7 @@ Example:
<HR>
<P>
The libsndfile home page is here :
The libsndfile home page is here :
<A HREF="http://www.mega-nerd.com/libsndfile/">
http://www.mega-nerd.com/libsndfile/</A>.
<BR>
@ -1013,8 +1047,8 @@ Version : 1.0.10
<!--
Do not edit or modify anything in this comment block.
The arch-tag line is a file identity tag for the GNU Arch
The arch-tag line is a file identity tag for the GNU Arch
revision control system.
arch-tag: 6ee72f74-0fb3-42b6-a85c-d3331d7145b5
-->