CREATESOUNDFILE(3X) — NEWS-OS Programmer’s Manual
NAME
CreateSoundFile, OpenSoundFile, ReadSoundFile, WriteSoundFile, SeekSoundFile, CloseSoundFile − handle sound files
SYNOPSIS
#include <newsiodev/sound.h>
#include <soundlib.h>
SFILE∗CreateSoundFile( f_name, sbparam )
charf_name[];
struct sbparam∗sbparam;
SFILE∗OpenSoundFile( f_name )
charf_name[];
intReadSoundFile( ptr, size, nitems, sfile )
char∗ptr;
intsize, nitems;
SFILE∗sfile;
intWriteSoundFile( ptr, size, nitems, sfile )
char∗ptr;
intsize, nitems;
SFILE∗sfile;
intSeekSoundFile( sfile, second, offset )
SFILE∗sfile;
intsecond, offset;
intCloseSoundFile( sfile )
SFILE∗sfile;
DESCRIPTION
CreateSoundFile creates new sound files. The function opens a file, sets the proper header information, and prepares the file so that sound data can be written in. f_name specifies the name of the file to be created. sbparam represents the sound format. CreateSoundFile returns the pointer to a structure containing information about the sound file if the file is successfully created. It returns a null pointer if the file cannot be created. If the file cannot be opened, the variable errno is set to the same error number as used by the system call open(2).
OpenSoundFile opens already existing sound files. This function opens the sound file, reads its header information, and prepares the file for reading and writing. f_name specifies the name of the file to be opened. OpenSoundFile returns a pointer to a structure storing information concerning the sound file if the file is successfully opened. If the file cannot be opened, the function returns a null pointer and sets the variable errno to the same error number as used by the system call open(2).
ReadSoundFile reads sound data out of sound files. This function reads nitems of data in blocks of length size from the sound file sfile into the buffer ptr. The number of blocks successfully read is returned.
This function returns 0 when the data cannot be read or when an attempt is made to read past the end of the sound data. If the file cannot be read, errno is set to the same error number as used by the system call read(2).
WriteSoundFile writes sound data to sound files. This function writes nitems of data in blocks of length size stored in the buffer ptr into the file, sfile.
The function returns the number of blocks succesfully written. If the file cannot be written, it returns 0 and sets the variable errno to the same error number as used by the system call write(2).
SeekSoundFile moves sound data to the specified location. This function moves sound data in the sound file specified by sfile to the desired location. The location is obtained by adding the number of seconds specified in second and the number of bytes specified in offset.
The data movement ends at the start of the closest data block. Accordingly, the actual position may differ slightly from that specified with formats such as ADPCM which use large data block sizes.
The location of the sound data is returned as a number of bytes, if the data is moved successfully. If the data cannot be moved, −1 is returned.
CloseSoundFile closes sound files opened using CreateSoundfile or OpenSoundFile. This function also updates header information for the file in accordance with any changes made in the sound data. This function must be called whenever closing sound files.
FILES
/usr/sony/lib/libsound.a
/sys/newsiodev/sound.h
/usr/sony/include/soundlib.h
SEE ALSO
sb(4), sbrec(1), sbplay(1), sbchk(1), sbconv(1)
NEWS-OSRelease 4.2.1R