A class to handle plugin-based output to an audio file.
More...
#include <sp/spOutputPlugin.h>
|
(Note that these are not member symbols.)
|
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) |
|
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) |
|
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) |
|
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) |
|
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) |
|
spBool | spCloseFilePlugin (spPlugin *plugin) |
|
A class to handle plugin-based output to an audio file.
Actually, spOutputPlugin is not a class. You can handle this by using spPlugin type typedefed by typedef struct _spPlugin spPlugin;
.
- See also
- I/O by Plugin , spInputPlugin
◆ spWritePlugin()
long spWritePlugin |
( |
spPlugin * | plugin, |
|
|
void * | data, |
|
|
long | length ) |
|
related |
Write data to a file by using a plugin. The difference from spWritePluginInByte() is how to specify the size of data.
- Parameters
-
[in] | plugin | spPlugin pointer obtained by spOpenFilePlugin() . |
[in] | data | Data 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] | length | The 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 ) |
|
related |
Write data to a file by using a plugin. The difference from spWritePlugin() is how to specify the size of data.
- Parameters
-
[in] | plugin | spPlugin pointer obtained by spOpenFilePlugin() . |
[in] | data | Data 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_size | The 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 ) |
|
related |
Write data to a file by using a plugin. The value of the data must be basically from -1 to 1 inclusive.
- Parameters
-
[in] | plugin | spPlugin pointer obtained by spOpenFilePlugin() . |
[in] | data | Data to write. |
[in] | length | The 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] | weight | This 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 ) |
|
related |
Write data to a file by using a plugin. The value of the data must be basically from -1 to 1 inclusive.
- Parameters
-
[in] | plugin | spPlugin pointer obtained by spOpenFilePlugin() . |
[in] | data | Data to write. |
[in] | length | The 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 | ) |
|
|
related |
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_name | The 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 ) |
|
related |
Get the name of a plugin which is suitable for opening the file with the file name and the mode.
- Parameters
-
[in] | device_type | Normally, specify SP_PLUGIN_DEVICE_FILE. |
[in] | filename | The name of the file. |
[in] | mode | The mode in opening the file such as "r" for reading mode and "w" for writing mode. |
[in,out] | current_priority | The 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 ) |
|
related |
Get the name of a plugin which is suitable for opening the file with the file name and the mode.
- Parameters
-
[in] | device_type | Normally, specify SP_PLUGIN_DEVICE_FILE. |
[in] | filename | The name of the file. |
[in] | mode | The 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()
Open the file by using a plugin.
- Parameters
-
[in] | plugin_name | The 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] | filename | The name of the file to open. |
[in] | mode | The mode in opening the file such as "r" for reading mode and "w" for writing mode. |
[in] | device_type | Specify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O. |
[in,out] | wave_info | The 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_info | The address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file. |
[in] | call_func | The address of callback function. This function must have the following signature: |
[in] | call_data | The address of callback user data. This data can be received by the 4-th argument of the callback function. |
[out] | error | The 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()
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_name | The 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] | filename | The name of the file to open. |
[in] | mode | The mode in opening the file such as "r" for reading mode and "w" for writing mode. |
[in] | device_type | Specify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O. |
[in,out] | wave_info | The 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_info | The address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file. |
[in] | call_func | The address of callback function. This function must have the following signature: |
[in] | call_data | The address of callback user data. This data can be received by the 4-th argument of the callback function. |
[out] | error | The 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()
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_name | The 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] | filename | The name of the file to open. |
[in] | mode | The mode in opening the file such as "r" for reading mode and "w" for writing mode. |
[in] | device_type | Specify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O. |
[in,out] | wave_info | The 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_info | The address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file. |
[in] | argc | The number of elements of the array associated with argv . |
[in] | argv | An array that each element is a string specified as a command-line argument. |
[out] | error | The 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()
Open the file by using a plugin.
- Parameters
-
[in] | plugin_name | The 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] | filename | The name of the file to open. |
[in] | mode | The mode in opening the file such as "r" for reading mode and "w" for writing mode. |
[in] | device_type | Specify SP_PLUGIN_DEVICE_FILE for file I/O, SP_PLUGIN_DEVICE_AUDIO for audio device I/O. |
[in,out] | wave_info | The 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_info | The address of the variable of spSongInfo type. For reading mode, the returned variable holds song information of the file. |
[in] | argc | The number of elements of the array associated with argv . |
[in] | argv | An array that each element is a string specified as a command-line argument. |
[out] | error | The 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()
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
-
- Return values
-
SP_TRUE | Success |
SP_FALSE | Failure |