#ifdefined(__cplusplus)extern"C"{#endif/* __cplusplus *//*************************************************************************
* Doxygen documentation
*************************************************************************//*---------------- GAudio library related system specific defines -----------------*/#if!defined(WIN32) && !defined(__linux__)#error"gaudio library don't support this os at present"#endif#ifdefined(_WIN32)#defineGAPIENTRY __cdecl#else#defineGAPIENTRY#endif#ifdefined(BUILDING)#ifdef _WIN32
# define GAPI __declspec(dllexport)#else# define GAPI#endif#else#ifdef _WIN32
# define GAPI __declspec(dllimport)#else# define GAPI#endif#endif#ifndef NULL#defineNULL 0#endif#ifndef FALSE#defineFALSE 0#endif#ifndef TRUE#defineTRUE 1#endif/*************************************************************************
* GAudio library API tokens
*************************************************************************/#defineAUDIO_DRIVER_NULL 0#defineAUDIO_DRIVER_WINMM 1#defineAUDIO_DRIVER_DSOUND 2#defineAUDIO_DRIVER_ALSA 3#defineAUDIO_DRIVER_OSS 4#defineAUDIO_DRIVER_PORTAUDIO 5#defineAUDIO_PLUGIN_DECODER 1#defineAUDIO_PLUGIN_EFFECT 2#defineAUDIO_PLUGIN_DRIVER 3#defineMAX_SOURCE 8#defineMAX_DECODER 32#defineMAX_EFFECT 8#defineAUDIO_ENUM_POSITION 1#defineAUDIO_ENUM_VELOCITY 2#defineAUDIO_ENUM_FORWARD 3#defineAUDIO_ENUM_UP 4#defineAUDIO_ENUM_SAMPLERATE 5#defineAUDIO_ENUM_CHANNEL 6#defineAUDIO_ENUM_FORMAT 7#defineAUDIO_ENUM_DURATION 8#defineAUDIO_ENUM_LOOP 9#defineAUDIO_ENUM_GAIN 10#defineAUDIO_ENUM_GAIN_LEFT 11#defineAUDIO_ENUM_GAIN_RIGHT 12#defineAUDIO_ENUM_SILENCE 13#defineAUDIO_ENUM_TITLE 14#defineAUDIO_ENUM_TRACK 15#defineAUDIO_ENUM_ALBUM 16#defineAUDIO_ENUM_ARTIST 17#defineAUDIO_ENUM_PUBLISHDATE 18#defineAUDIO_ENUM_GENRE 19#defineAUDIO_ENUM_COMMENT 20#defineAUDIO_ENUM_AUDIO 21#defineAUDIO_ENUM_BITERATE 22#defineAUDIO_ENUM_VERSION 23#defineAUDIO_ENUM_DRIVER 24#defineAUDIO_ENUM_BALANCE 25#defineAUDIO_ENUM_CROSSFEED 26#defineAUDIO_ENUM_SOUNDFONT 27#defineBALANCE_MIN -10#defineBALANCE_MAX 10#defineBALANCE_DEFAULT 0#defineAUDIO_CROSSEFED_NONE -1#defineAUDIO_CROSSFEED_MIN 0#defineAUDIO_CROSSFEED_MAX 2#defineAUDIO_CROSSFEED_DEFAULT 1typedef int32_t(GAPIENTRY*gread)(void*,int32_t,int32_t,void*);
typedef int32_t(GAPIENTRY*gseek)(void*,int32_t,int32_t);
typedef int32_t(GAPIENTRY*gtell)(void*);
typedef int32_t(GAPIENTRY*gclose)(void*);
typedefstructgsource gsource;
typedefstructgeffect geffect;
typedefstructgrecorder grecorder;/*************************************************************************
* GAudio API functions
*************************************************************************//*! @brief Initializes the GAudio library.
*
* This function initializes the GAudio library. Before any GAudio functions can
* be used, GAudio must be initialized, and before a program terminates GAudio
* should be terminated in order to free any resources allocated during or
* after initialization.
*
* If this function fails, it calls @ref gaudio_deinit before returning. If it
* succeeds, you should call @ref gaudio_deinit before the program exits.
*
* Additional calls to this function after successful initialization but before
* termination will succeed but will do nothing.
*
* @param[in] add-ons Where to search and load plug-ins which GAudio needed.
*
* @return `TRUE` if successful, or `FALSE` if an error occurred.
*
* @note This function may only be called from the main thread.
*
* @note This function may take several seconds to complete on some systems,
* while on other systems it may take only a fraction of a second to complete.
*
* @sa gaudio_deinit
*
* @ingroup init*/externGAPIvoidgaudio_init(constchar*addons);/*! @brief Terminates the GAudio library.
*
* This function frees any allocated resources and sets the library to an
* uninitialized state. Once this is called, you must again call @ref gaudio_init
* successfully before you will be able to use most GAudio functions.
*
* If GAudio has been successfully initialized, this function should be called
* before the program exits. If initialization fails, there is no need to call
* this function, as it is called by @ref gaudio_init before it returns failure.
*
* @remarks This function may be called before @ref gaudio_init.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_init
*
* @ingroup init*/externGAPIvoidgaudio_deinit();/*Audio format type*/#defineAUDIO_FORMAT_TYPE_NONE -1#defineAUDIO_FORMAT_TYPE_INT4 0#defineAUDIO_FORMAT_TYPE_INT8 1#defineAUDIO_FORMAT_TYPE_UINT8 2#defineAUDIO_FORMAT_TYPE_INT16 3#defineAUDIO_FORMAT_TYPE_UINT16 4#defineAUDIO_FORMAT_TYPE_INT24 5#defineAUDIO_FORMAT_TYPE_INT32 6#defineAUDIO_FORMAT_TYPE_UINT32 7#defineAUDIO_FORMAT_TYPE_INT64 8#defineAUDIO_FORMAT_TYPE_FLOAT 9#defineAUDIO_FORMAT_TYPE_DOUBLE 10#defineAUDIO_FORMAT_TYPE_ULAW 11#defineAUDIO_FORMAT_TYPE_ALAW 12#defineAUDIO_FORMAT_TYPE_VOX_ADPCM 13#defineAUDIO_FORMAT_TYPE_MS_ADPCM 14#defineAUDIO_FORMAT_TYPE_GSM610 15#defineAUDIO_FORMAT_TYPE_IMA_ADPCM 16#defineAUDIO_FORMAT_TYPE_DPCM8 17#defineAUDIO_FORMAT_TYPE_DPCM16 18#defineAUDIO_FORMAT_TYPE_G723_24 19#defineAUDIO_FORMAT_TYPE_G723_32 20#defineAUDIO_FORMAT_TYPE_G723_40 21#defineAUDIO_FORMAT_TYPE_DWVW_12 22#defineAUDIO_FORMAT_TYPE_DWVW_16 23#defineAUDIO_FORMAT_TYPE_DWVW_24 24#defineAUDIO_FORMAT_TYPE_DWVW_N 25#defineAUDIO_FORMAT_TYPE_VORBIS 26#defineAUDIO_FORMAT_TYPE_MPC 27#defineAUDIO_FORMAT_TYPE_MAX 100/*Channel type*/#defineDEVICE_CHANNEL_MONO 1#defineDEVICE_CHANNEL_STEREO (DEVICE_CHANNEL_MONO+1)#defineDEVICE_CHANNEL_QUAD (DEVICE_CHANNEL_STEREO+1)#defineDEVICE_CHANNEL_5POINT1 (DEVICE_CHANNEL_QUAD+1)#defineDEVICE_CHANNEL_6POINT1 (DEVICE_CHANNEL_5POINT1+1)#defineDEVICE_CHANNEL_7POINT1 (DEVICE_CHANNEL_6POINT1+1)#defineAUDIO_VERSON 0#defineAUDIO_PLAY_MODE 1#defineAUDIO_RECORD_MODE 2/*GAudio plugin type*/#defineAUDIO_PLUGIN_AUDIO 1#defineAUDIO_PLUGIN_EFFECT 2#defineAUDIO_PLUGIN_DRIVER 3#defineAUDIO_PLUGIN_RECORDER 4/*Audio file type*/#defineAUDIO_FORMAT_NONE -1#defineAUDIO_FORMAT_RAW 0#defineAUDIO_FORMAT_WAV 1#defineAUDIO_FORMAT_AU 2#defineAUDIO_FORMAT_AIFF 3#defineAUDIO_FORMAT_FLAC 4#defineAUDIO_FORMAT_MP2 5#defineAUDIO_FORMAT_MP3 6#defineAUDIO_FORMAT_APE 7#defineAUDIO_FORMAT_AAC 8#defineAUDIO_FORMAT_CAF 9#defineAUDIO_FORMAT_OGG 10#defineAUDIO_FORMAT_VOC 11#defineAUDIO_FORMAT_WV 12#defineAUDIO_FORMAT_MIDI 13#defineAUDIO_FORMAT_XM 14#defineAUDIO_FORMAT_S3M 15#defineAUDIO_FORMAT_MOD 16#defineAUDIO_FORMAT_IT 17#defineAUDIO_FORMAT_WMA 18#defineAUDIO_FORMAT_WMV 19#defineAUDIO_FORMAT_CD 20#defineAUDIO_FORMAT_VQF 21#defineAUDIO_FORMAT_MPC 22#defineAUDIO_FORMAT_TTA 23#defineAUDIO_FORMAT_AC3 24/*Audio effect type*/#defineAUDIO_EFFECT_NONE -1#defineAUDIO_EFFECT_PHASER 0#defineAUDIO_EFFECT_INVERT 1#defineAUDIO_EFFECT_SWAP_CHANNEL 2#defineAUDIO_EFFECT_MERGE_CHANNEL 3#defineAUDIO_EFFECT_SPEED_CHANGER 4#defineAUDIO_EFFECT_ECHO 5#defineAUDIO_EFFECT_REVERB 6#defineAUDIO_EFFECT_FFT 7#defineAUDIO_EFFECT_EQUALIZER 8#defineAUDIO_EFFECT_BASSBOOST 9#defineAUDIO_EFFECT_CHORUS 10#defineAUDIO_EFFECT_STEREO_ENHANCE 11#defineAUDIO_EFFECT_DISTORTION 12#defineAUDIO_EFFECT_FOLDBACK_DISTORTION 13#defineAUDIO_EFFECT_FLANGER 14#defineAUDIO_EFFECT_AUTOWAH 15#defineAUDIO_EFFECT_COMPRESSER 16#defineAUDIO_EFFECT_MODULATOR 17#defineAUDIO_EFFECT_FADE_IN 18#defineAUDIO_EFFECT_FADE_OUT 19#defineAUDIO_EFFECT_LEVELLER 20#defineAUDIO_EFFECT_ZIPPER 21externGAPI int32_t gaudio_is_support(int32_t,int32_t);externGAPIvoidgaudio_set_float(int32_t,float);externGAPIvoidgaudio_get_float(int32_t,float*);externGAPIvoidgaudio_set_int32(int32_t,int32_t);externGAPIvoidgaudio_get_int32(int32_t,int32_t*);externGAPIvoidgaudio_set_string(int32_t,constchar*);externGAPI int32_t gaudio_get_string(int32_t,char*);/*! @defgroup errors Error codes
* @ingroup error
* @{*//*! @brief GAudio has not been initialized.*/#defineAUDIO_NO_ERROR 0/*! @brief GAudio has not been initialized.*/#defineAUDIO_NOT_INIT 1#defineAUDIO_BAD_TAG 2#defineAUDIO_BAD_VALUE 3/*! @brief GAudio could not support for the requested client API on the
* system.*/#defineAUDIO_NOT_SUPPORT 4#defineAUDIO_BAD_OPERATION 5/*! @brief A memory allocation failed.*/#defineAUDIO_OUT_OF_MEMORY 6#defineAUDIO_OVER_COUNT 7#defineAUDIO_INNER_ERROR 8externGAPI int32_t gaudio_error_get();externGAPIvoidgaudio_source_set_float(gsource*,int32_t,float);externGAPIvoidgaudio_source_get_float(gsource*,int32_t,float*);externGAPIvoidgaudio_source_set_int32(gsource*,int32_t,int32_t);externGAPIvoidgaudio_source_get_int32(gsource*,int32_t,int32_t*);externGAPI int32_t gaudio_source_get_string(gsource*,int32_t,char*);externGAPIvoidgaudio_listener_set_float3(int32_t,float,float,float);externGAPIvoidgaudio_listener_get_float3(int32_t,float*,float*,float*);/*! @brief Create gsource from given audio file name.
*
* This function create gsource from given audio file name,
*
* @param[in] file The file that will be loaded.
* @param[in] flag A flag value which script the load mode
* @return An gsource instance pointer, or `NULL` if the error occur.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_source_create_from_buffer
* @sa gaudio_source_create_from_virtual_io
* @sa gaudio_source_create_from_buffer2
* @sa gaudio_source_destroy
*
* @ingroup gsource*/externGAPI gsource*gaudio_source_create_from_file(constchar*file,int32_t flag);/*! @brief Create gsource by given buffer
*
* This function create gsource from given buffer, the buffer length is pointed by user.
*
* @param[in] buffer The buffer that will be loaded.
* @param[in] length The length of buffer
* @return An gsource instance pointer, or `NULL` if the error occur.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_source_create_from_file
* @sa gaudio_source_create_from_virtual_io
* @sa gaudio_source_create_from_buffer2
* @sa gaudio_source_destroy
*
* @ingroup gsource*/externGAPI gsource*gaudio_source_create_from_buffer(int8_t*buffer,uint32_t length);/*! @brief Create gsource by user io
*
* This function create gsource from user io, the io operation is pointed by user.
*
* @param[in] read The read callback function.
* @param[in] seek The seek callback function.
* @param[in] tell The tell callback function.
* @param[in] close The close callback function.
* @param[in] user The user client data pointer.
* @return An gsource instance pointer, or `NULL` if the error occur.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_source_create_from_file
* @sa gaudio_source_create_from_buffer
* @sa gaudio_source_create_from_buffer2
* @sa gaudio_source_destroy
*
* @ingroup gsource*/externGAPI gsource*gaudio_source_create_from_virtual_io(gread read,gseek seek,gtell tell,gclose close,void*user);/*! @brief Create gsource by given pcm data
*
* This function create gsource from user io, the io operation is pointed by user.
*
* @param[in] samplerate The given source's samplerate.
* @param[in] channels The given source's chgannels.
* @param[in] format The given source's format.
* @param[in] pcm The given source's data buffer.
* @param[in] length The length of given source data.
* @return An gsource instance pointer, or `NULL` if the error occur.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_source_create_from_file
* @sa gaudio_source_create_from_buffer
* @sa gaudio_source_create_from_virtual_io
* @sa gaudio_source_destroy
*
* @ingroup gsource*/externGAPI gsource*gaudio_source_create_from_buffer2(uint32_t samplerate,uint32_t channels,uint32_t format,int8_t*pcm,uint32_t length);/*! @brief Destroy gsource instance.
*
* This function destroy given gsource instance,
*
* @param[in] source A gsource instance which will be destroyed.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_source_create_from_file
* @sa gaudio_source_create_from_buffer
* @sa gaudio_source_create_from_virtual_io
* @sa gaudio_source_create_from_buffer2
*
* @ingroup gsource*/externGAPIvoidGAPIENTRY gaudio_source_destroy(gsource*source);/*! @brief The function signature for source content finish callbacks.
*
* This is the function signature for source finish callback functions.
*
* @param[in] source The source whose content needs to be triggered.
*
* @sa gaudio_source_set_finish_callback
*
* @ingroup gsource*/typedefvoid(GAPIENTRY*gfinish)(gsource*source);/*! @brief Sets the gsource callback.
*
* This function sets the playing finished callback of the specified gsource, which is
* called when source playing finished.
*
* @param[in] source The source whose callback to set.
* @param[in] finish The new gfinish callback.
*
* @ingroup gsource*/externGAPIvoidgaudio_source_set_finish_callback(gsource*source,gfinish finish);/*! @brief The function signature for gsource error callbacks.
*
* This is the function signature for gsource error callback functions.
*
* @param[in] source The source whose content needs to be triggered.
*
* @sa gaudio_source_set_error_callback
*
* @ingroup gsource*/typedefvoid(GAPIENTRY*gerror)(gsource*,int32_t,int32_t);/*! @brief Sets the gsource error callback.
*
* This function sets the playing error callback of the specified gsource, which is
* called when error occur.
*
* @param[in] source The source whose callback to set.
* @param[in] error The error callback function.
*
* @ingroup gsource*/externGAPIvoidgaudio_source_set_error_callback(gsource*source,gerror error);externGAPIvoidgaudio_source_set(gsource*,int32_t,float,float,float);externGAPIvoidgaudio_source_get(gsource*,int32_t,float*,float*,float*);externGAPIvoidgaudio_source_start(gsource*source,int32_t flag);externGAPIvoidgaudio_source_start_3d(gsource*,int32_t);/*! @brief pause the specified audio source.
*
* This function pause the specified audio source, if it was previously
* playing.
*
* @param[in] source The audio source to pause.
*
* @sa gaudio_source_start
* @sa gaudio_source_stop
*
* @ingroup gsource*/externGAPIvoidgaudio_source_pause(gsource*source);/*! @brief stop the specified audio source.
*
* This function stop the specified audio source, if it was previously
* playing or pause.
*
* @param[in] source The audio source to stop.
*
* @sa gaudio_source_start
* @sa gaudio_source_pause
*
* @ingroup gsource*/externGAPIvoidgaudio_source_stop(gsource*source);/*! @brief seek the specified audio source to given position.
*
* This function seek the specified audio source, if it was previously
* playing or pause.
*
* @param[in] source The audio source to seek.
*
* @sa gaudio_source_start
* @sa gaudio_source_stop
* @sa gaudio_source_seek
*
* @ingroup gsource*/externGAPIvoidgaudio_source_seek(gsource*source,int32_t missecond);/*! @brief The function signature for gsource position callbacks.
*
* This is the function signature for gsource position callback functions.
*
* @param[in] source The source whose content needs to be triggered.
*
* @sa gaudio_source_set_position_callback
*
* @ingroup gsource*/typedefvoid(GAPIENTRY*gposition)(gsource*,int32_t);externGAPIvoidgaudio_source_set_position_callback(gsource*source,gposition);/*! @brief Create geffect instance.
*
* This function create given geffect instance,
*
* @param[in] effect A effect id which will be created.
* @param[out] A effect pointer instance, NULL for error occur.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_effect_create
*
* @ingroup geffect*/externGAPI geffect*gaudio_effect_create(int32_t effect,int32_t flag);/*! @brief Destroy geffect instance.
*
* This function destroy given geffect instance,
*
* @param[in] effect A effect instance which will be destroyed.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_effect_create
*
* @ingroup geffect*/externGAPIvoidgaudio_effect_destroy(geffect*effect);/*! @brief The function signature for geffect fft callbacks.
*
* This is the function signature for geffect fft calc callback functions.
*
* @param[in] source The source whose content needs to be triggered.
*
* @ingroup geffect*/typedefvoid(GAPIENTRY*gefxcb)(geffect*,float*,int32_t,int32_t,int32_t);externGAPIvoidgaudio_effect_set_callback(geffect*,gefxcb);externGAPIvoidgaudio_effect_bind(geffect*effect,int32_t flag);/*! @brief bind effect with given source.
*
* @param[in] effect An effect pointer which will be bind to source.
* @param[in] source A source pointer which will be bind to effect.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_effect_bind
* @sa gaudio_effect_unbind
* @sa gaudio_effect_unbind_from_source
*
* @ingroup geffect*/externGAPIvoidgaudio_effect_bind_to_source(geffect*effect,gsource*source);/*! @brief unbind effect from global context.
*
* @param[in] effect An effect pointer which will be unbind from global.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_effect_bind_to_source
* @sa gaudio_effect_unbind
* @sa gaudio_effect_unbind_from_source
*
* @ingroup geffect*/externGAPIvoidgaudio_effect_unbind(geffect*effect);/*! @brief unbind effect with given source.
*
* @param[in] effect An effect pointer which will be unbind to source.
* @param[in] source A source pointer which will be unbind to effect.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_effect_bind
* @sa gaudio_effect_unbind
* @sa gaudio_effect_bind_to_source
*
* @ingroup geffect*/externGAPIvoidgaudio_effect_unbind_from_source(geffect*effect,gsource*source);externGAPIvoidgaudio_effect_set_float(geffect*,int32_t,float);externGAPIvoidgaudio_effect_get_float(geffect*,int32_t,float*);#defineAUDIO_EFFECT_ENABLE 0externGAPIvoidgaudio_effect_set_int32(geffect*,int32_t,int32_t);externGAPIvoidgaudio_effect_get_int32(geffect*,int32_t,int32_t*);externGAPI grecorder*gaudio_recorder_create(constchar*,uint32_t,uint32_t,uint32_t,uint32_t);externGAPIvoidgaudio_recorder_start(grecorder*);externGAPIvoidgaudio_recorder_stop(grecorder*);/*! @brief Destroy grecorder instance.
*
* This function destroy given grecorder instance,
*
* @param[in] source A grecorder instance which will be destroyed.
*
* @note This function may only be called from the main thread.
*
* @sa gaudio_recorder_create
*
* @ingroup grecorder*/externGAPIvoidgaudio_recorder_destroy(grecorder*recorder);/*! @brief Returns the address of the specified function for the current
* context.
*
* This function returns the address of the specified
* [client API or extension function], if it is supported
* by the current context.
*
* @param[in] name The ASCII encoded name of the function.
* @return The address of the function, or `NULL` if the function is
* unavailable.
*
* @remarks This function may be called from secondary threads.
*
* @note The addresses of these functions are not guaranteed to be the same for
* all contexts, especially if they use different client APIs or even different
* context creation hints.
*
* @ingroup context*/externGAPIvoid*gaudio_address_get(constchar*name);#ifdefined(__cplusplus)}#endif/*************************************************************************
* Global definition cleanup
*************************************************************************/#endif/* _gaudio_h_ */