CheckSbparam(3x) MISC. REFERENCE MANUAL PAGES CheckSbparam(3x)
NAME
CheckSbparam, GetTransFormatLength, DoTransFormat, Init-
TransFormat, GetBaseLength - To handle sound data formats.
SYNTAX
#include <io/sound.h>
#include <soundlib.h>
result = CheckSbparam( sbparam )
int result;
struct sbparam *sbparam;
newLength = GetTransFormatLength( oldSB, newSB, oldLength )
struct sbparam *oldSB, *newSB;
int newLength, oldLength;
newLength = DoTransFormat( oldSB, newSB, oldSound, newSound, oldLength )
struct sbparam *oldSB, *newSB;
char oldSound[ oldLength ], newSound[ LONGENOUGH ];
int newLength, oldLength;
InitTransFormat()
baseLength = GetBaseLength( oldSB, newSB )
int baseLength;
struct sbparam *oldSB, newSB;
DESCRIPTION
CheckSbparam checks the sound data format being used.
sb_param returns 0 if the sound format is one of those
described in sb(7) and returns -1 otherwise. The fields
sb_compress and sb_format are only checked when either the
LOGPCM or ADPCM format has been selected.
GetTransFormatLength gets the data length after a format
conversion. It returns the new byte length for audio data
of original byte length oldLength in the original format
oldSB after that data has been converted to audio data of
the new format newSB. CheckSbparam is executed on both
oldSBandnewSB and returns -1 (error) if either are unde-
fined.
DoTransFormat performs the actual format conversion of sound
data files. Sound data stored in oldSound of the length
oldLength and of the format represented by oldSB is con-
verted to the format represented by newSB and stored in
newSound. The length of the sound data is returned if it was
converted successfully.
InitTransFormat initialized filters used internally by
DoTransFormat. InitTransFormat must be called once before
calling DoTransFormat. This routine must also be called any
1
CheckSbparam(3x) MISC. REFERENCE MANUAL PAGES CheckSbparam(3x)
time a data conversion differing from the previous one is
going to be made.
GetBaseLength gets the value of the maximum length of data
which can be passed to the format conversion routine. Due
to the fact that there are size restrictions on the internal
filters used, there are also restrictions on the length of
data that DoTransFormat can convert with one call. Actu-
ally, depending on the old and new data formats specified,
only data of a certain length, or integral multiple of that
length, can be converted at a time. GetBaseLength gets the
constant representing this length. Use the format before
conversion as the first argument and the format after
conversion as the second. The value of this constant can
get very large if ADPCM is specified as the format before or
after conversion when making a frequency conversion.
FILES
/usr/lib/libsound.a, /usr/include/io/sound.h,
/usr/include/soundlib.h
SEE ALSO
sb(7), sbconv(1)
2