spAudio
Loading...
Searching...
No Matches
spOutputPlugin.h File Reference
#include <sp/spWave.h>
#include <sp/spPlugin.h>
Include dependency graph for spOutputPlugin.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

long spWritePlugin (spPlugin *plugin, void *data, long length)
 
long spWritePluginInByte (spPlugin *plugin, void *data, long data_size)
 
long spWritePluginDoubleWeighted (spPlugin *plugin, double *data, long length, double weight)
 
long spWritePluginDouble (spPlugin *plugin, double *data, long length)
 
char * xspFindRelatedPluginFile (const char *plugin_name)
 
char * xspFindSuitablePluginFileWithPriority (spPluginDeviceType device_type, const char *filename, const char *mode, int *current_priority)
 
char * xspFindSuitablePluginFile (spPluginDeviceType device_type, const char *filename, const char *mode)
 
spPluginspOpenFilePlugin (const char *plugin_name, const char *filename, const char *mode, spPluginDeviceType device_type, spWaveInfo *wave_info, spSongInfo *song_info, spPluginOpenCallback call_func, void *call_data, spPluginError *error)
 
spPluginspOpenFilePluginAuto (const char *plugin_name, const char *filename, const char *mode, spPluginDeviceType device_type, spWaveInfo *wave_info, spSongInfo *song_info, spPluginOpenCallback call_func, void *call_data, spPluginError *error)
 
spPluginspOpenFilePluginArg (const char *plugin_name, const char *filename, const char *mode, spPluginDeviceType device_type, spWaveInfo *wave_info, spSongInfo *song_info, int argc, char **argv, spPluginError *error)
 
spPluginspOpenFilePluginArgAuto (const char *plugin_name, const char *filename, const char *mode, spPluginDeviceType device_type, spWaveInfo *wave_info, spSongInfo *song_info, int argc, char **argv, spPluginError *error)
 
spBool spCloseFilePlugin (spPlugin *plugin)
 

Function Documentation

◆ spWritePlugin()

long spWritePlugin ( spPlugin * plugin,
void * data,
long length )
extern

Write data to a file by using a plugin. The difference from spWritePluginInByte() is how to specify the size of data.

Parameters
[in]pluginspPlugin pointer obtained by spOpenFilePlugin() .
[in]dataData to write. The type of data depends on bits/sample of data; short for 8/16 bits, long for 24/32 bits, and double for 64 bits.
[in]lengthThe length of data . Note that this length is not identical to duration in points. For example, length is twice of duration in points of data for stereo data.
Returns
Written length. This value is the same as length if successful.

◆ spWritePluginInByte()

long spWritePluginInByte ( spPlugin * plugin,
void * data,
long data_size )
extern

Write data to a file by using a plugin. The difference from spWritePlugin() is how to specify the size of data.

Parameters
[in]pluginspPlugin pointer obtained by spOpenFilePlugin() .
[in]dataData to write. The type of data depends on bits/sample of data; short for 8/16 bits, long for 24/32 bits, and double for 64 bits.
[in]data_sizeThe size of data in bytes.
Returns
Written size in bytes. This value is the same as data_size if successful.

◆ spWritePluginDoubleWeighted()

long spWritePluginDoubleWeighted ( spPlugin * plugin,
double * data,
long length,
double weight )
extern

Write data to a file by using a plugin. The value of the data must be basically from -1 to 1 inclusive.

Parameters
[in]pluginspPlugin pointer obtained by spOpenFilePlugin() .
[in]dataData to write.
[in]lengthThe length of data . Note that this length is not identical to duration in points. For example, length is twice of duration in points of data for stereo data.
[in]weightThis value is multiplied to the data before writing.
Returns
Written length. This value is the same as length if successful.

◆ spWritePluginDouble()

long spWritePluginDouble ( spPlugin * plugin,
double * data,
long length )
extern

Write data to a file by using a plugin. The value of the data must be basically from -1 to 1 inclusive.

Parameters
[in]pluginspPlugin pointer obtained by spOpenFilePlugin() .
[in]dataData to write.
[in]lengthThe length of data . Note that this length is not identical to duration in points. For example, length is twice of duration in points of data for stereo data.
Returns
Written length. This value is the same as length if successful.

◆ xspFindRelatedPluginFile()

char * xspFindRelatedPluginFile ( const char * plugin_name)
extern

Get the name of the related plugin. This function can be used to search an output plugin associated with an input plugin.

Parameters
[in]plugin_nameThe name of the plugin such as "input_wav" .
Returns
The name of the related plugin such as "output_wav" for "input_wav" as plugin_name . You have to free the memory by xspFree() .

◆ xspFindSuitablePluginFileWithPriority()

char * xspFindSuitablePluginFileWithPriority ( spPluginDeviceType device_type,
const char * filename,
const char * mode,
int * current_priority )
extern

Get the name of a plugin which is suitable for opening the file with the file name and the mode.

Parameters
[in]device_typeNormally, specify SP_PLUGIN_DEVICE_FILE.
[in]filenameThe name of the file.
[in]modeThe mode in opening the file such as "r" for reading mode and "w" for writing mode.
[in,out]current_priorityThe address of the variable to hold the priority value. This function searches the suitable plugin from this priority toward lower priority; ignores plugins which have higher priority than this value.
Returns
The name of the suitable plugin. If the suitable plugin cannot be found, NULL will be returned. You have to free the memory by xspFree() .

◆ xspFindSuitablePluginFile()

char * xspFindSuitablePluginFile ( spPluginDeviceType device_type,
const char * filename,
const char * mode )
extern

Get the name of a plugin which is suitable for opening the file with the file name and the mode.

Parameters
[in]device_typeNormally, specify SP_PLUGIN_DEVICE_FILE.
[in]filenameThe name of the file.
[in]modeThe mode in opening file such as "r" for reading mode and "w" for writing mode.
Returns
The name of the suitable plugin. If the suitable plugin cannot be found, NULL will be returned. You have to free the memory by xspFree() .

◆ spOpenFilePlugin()

spPlugin * spOpenFilePlugin ( const char * plugin_name,
const char * filename,
const char * mode,
spPluginDeviceType device_type,
spWaveInfo * wave_info,
spSongInfo * song_info,
spPluginOpenCallback call_func,
void * call_data,
spPluginError * error )
extern

Open the file by using a plugin.

Parameters
[in]plugin_nameThe name of the plugin. If you specify NULL, this funcion automatically detects the plugin name which is suitable for opening the file by the file information for reading mode or the file name for writing mode,
[in]filenameThe name of the file to open.
[in]modeThe mode in opening the file such as "r" for reading mode and "w" for writing mode.
[in]device_typeSpecify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O.
[in,out]wave_infoThe address of the variable of spWaveInfo type. For reading mode, the returned variable holds information of the file. For writing mode, the file information is updated by using the variable content.
[in,out]song_infoThe address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file.
[in]call_funcThe address of callback function. This function must have the following signature:
spBool func(spPlugin *plugin, spPluginCallbackReason reason, void *host_data, void *call_data);
int spBool
spPluginCallbackReason
[in]call_dataThe address of callback user data. This data can be received by the 4-th argument of the callback function.
[out]errorThe error code if the returned value is NULL .
Returns
The pointer to spPlugin type. This pointer will be used for function calls following after this function call.

◆ spOpenFilePluginAuto()

spPlugin * spOpenFilePluginAuto ( const char * plugin_name,
const char * filename,
const char * mode,
spPluginDeviceType device_type,
spWaveInfo * wave_info,
spSongInfo * song_info,
spPluginOpenCallback call_func,
void * call_data,
spPluginError * error )
extern

Open the file by using a plugin. This function firstly ignores plugin_name argument, then opens the file with the plugin having plugin_name only if this function cannot find the suitable plugin. This behavior is useful for reading a raw binary file only if all plugins cannot read the file.

Parameters
[in]plugin_nameThe name of the plugin. If you specify NULL, this funcion automatically detects the plugin name which is suitable for opening the file by the file information for reading mode or the file name for writing mode,
[in]filenameThe name of the file to open.
[in]modeThe mode in opening the file such as "r" for reading mode and "w" for writing mode.
[in]device_typeSpecify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O.
[in,out]wave_infoThe address of the variable of spWaveInfo type. For reading mode, the returned variable holds information of the file. For writing mode, the file information is updated by using the variable content.
[in,out]song_infoThe address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file.
[in]call_funcThe address of callback function. This function must have the following signature:
spBool func(spPlugin *plugin, spPluginCallbackReason reason, void *host_data, void *call_data);
[in]call_dataThe address of callback user data. This data can be received by the 4-th argument of the callback function.
[out]errorThe error code if the returned value is NULL .
Returns
The pointer to spPlugin type. This pointer will be used for function calls following after this function call.

◆ spOpenFilePluginArg()

spPlugin * spOpenFilePluginArg ( const char * plugin_name,
const char * filename,
const char * mode,
spPluginDeviceType device_type,
spWaveInfo * wave_info,
spSongInfo * song_info,
int argc,
char ** argv,
spPluginError * error )
extern

Open the file by using a plugin. This function firstly ignores plugin_name argument, then opens the file with the plugin having plugin_name only if this function cannot find the suitable plugin. This behavior is useful for reading a raw binary file only if all plugins cannot read the file.

Parameters
[in]plugin_nameThe name of the plugin. If you specify NULL, this funcion automatically detects the plugin name which is suitable for opening the file by the file information for reading mode or the file name for writing mode,
[in]filenameThe name of the file to open.
[in]modeThe mode in opening the file such as "r" for reading mode and "w" for writing mode.
[in]device_typeSpecify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O.
[in,out]wave_infoThe address of the variable of spWaveInfo type. For reading mode, the returned variable holds information of the file. For writing mode, the file information is updated by using the variable content.
[in,out]song_infoThe address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file.
[in]argcThe number of elements of the array associated with argv .
[in]argvAn array that each element is a string specified as a command-line argument.
[out]errorThe error code if the returned value is NULL .
Returns
The pointer to spPlugin type. This pointer will be used for function calls following after this function call.

◆ spOpenFilePluginArgAuto()

spPlugin * spOpenFilePluginArgAuto ( const char * plugin_name,
const char * filename,
const char * mode,
spPluginDeviceType device_type,
spWaveInfo * wave_info,
spSongInfo * song_info,
int argc,
char ** argv,
spPluginError * error )
extern

Open the file by using a plugin.

Parameters
[in]plugin_nameThe name of the plugin. If you specify NULL, this funcion automatically detects the plugin name which is suitable for opening the file by the file information for reading mode or the file name for writing mode,
[in]filenameThe name of the file to open.
[in]modeThe mode in opening the file such as "r" for reading mode and "w" for writing mode.
[in]device_typeSpecify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O.
[in,out]wave_infoThe address of the variable of spWaveInfo type. For reading mode, the returned variable holds information of the file. For writing mode, the file information is updated by using the variable content.
[in,out]song_infoThe address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file.
[in]argcThe number of elements of the array associated with argv .
[in]argvAn array that each element is a string specified as a command-line argument.
[out]errorThe error code if the returned value is NULL .
Returns
The pointer to spPlugin type. This pointer will be used for function calls following after this function call.

◆ spCloseFilePlugin()

spBool spCloseFilePlugin ( spPlugin * plugin)
extern

Close the file opened by using a plugin. Since this function also frees memory of the pointer of spPlugin , don't access the pointer of spPlugin after calling this function.

Parameters
[in]pluginspPlugin pointer obtained by spOpenFilePlugin() .
Return values
SP_TRUESuccess
SP_FALSEFailure