2012-12-14 15:38:01 -08:00
|
|
|
#ifndef ECORE_AUDIO_H
|
|
|
|
#define ECORE_AUDIO_H
|
|
|
|
|
|
|
|
#include <Eina.h>
|
2013-04-11 10:21:37 -07:00
|
|
|
#include <Eo.h>
|
2012-12-14 15:38:01 -08:00
|
|
|
|
|
|
|
#ifdef EAPI
|
|
|
|
#undef EAPI
|
|
|
|
#endif
|
|
|
|
|
2017-12-13 10:04:49 -08:00
|
|
|
#ifdef _WIN32
|
2018-01-18 01:04:03 -08:00
|
|
|
# ifdef EFL_BUILD
|
2017-12-13 10:04:49 -08:00
|
|
|
# ifdef DLL_EXPORT
|
|
|
|
# define EAPI __declspec(dllexport)
|
|
|
|
# else
|
|
|
|
# define EAPI
|
2018-01-18 01:04:03 -08:00
|
|
|
# endif
|
2017-12-13 10:04:49 -08:00
|
|
|
# else
|
|
|
|
# define EAPI __declspec(dllimport)
|
2018-01-18 01:04:03 -08:00
|
|
|
# endif
|
2012-12-14 15:38:01 -08:00
|
|
|
#else
|
2017-12-13 10:04:49 -08:00
|
|
|
# ifdef __GNUC__
|
|
|
|
# if __GNUC__ >= 4
|
|
|
|
# define EAPI __attribute__ ((visibility("default")))
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
|
|
|
# else
|
|
|
|
# define EAPI
|
|
|
|
# endif
|
2018-01-18 01:04:03 -08:00
|
|
|
#endif
|
2012-12-14 15:38:01 -08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @file Ecore_Audio.h
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Audio utility functions.
|
2012-12-14 15:38:01 -08:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C"
|
|
|
|
{
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @defgroup Ecore_Audio_Group Ecore_Audio - Convenience audio API
|
2012-12-18 10:38:44 -08:00
|
|
|
* @ingroup Ecore
|
2013-05-01 08:26:49 -07:00
|
|
|
|
2012-12-18 07:51:47 -08:00
|
|
|
* @since 1.8
|
2012-12-14 15:38:01 -08:00
|
|
|
*
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
2013-05-03 13:44:01 -07:00
|
|
|
/** @since 1.8
|
|
|
|
*/
|
|
|
|
enum _Ecore_Audio_Type {
|
|
|
|
ECORE_AUDIO_TYPE_PULSE, /**< Use Pulseaudio module */
|
|
|
|
ECORE_AUDIO_TYPE_ALSA, /**< Use ALSA module*/
|
|
|
|
ECORE_AUDIO_TYPE_SNDFILE, /**< Use libsndfile module */
|
|
|
|
ECORE_AUDIO_TYPE_TONE, /**< Use tone module */
|
2016-10-30 15:49:54 -07:00
|
|
|
ECORE_AUDIO_TYPE_CORE_AUDIO, /**< Use Core Audio module (Apple) - DEPRECATED */
|
2013-05-03 13:44:01 -07:00
|
|
|
ECORE_AUDIO_TYPE_CUSTOM, /**< Use custom module */
|
2017-12-13 10:04:49 -08:00
|
|
|
ECORE_AUDIO_TYPE_WASAPI, /**< Use Wasapi module @since 1.21*/
|
2013-05-03 13:44:01 -07:00
|
|
|
ECORE_AUDIO_MODULE_LAST, /**< Sentinel */
|
|
|
|
};
|
|
|
|
|
2013-05-01 08:26:49 -07:00
|
|
|
/**
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
|
|
|
typedef enum _Ecore_Audio_Type Ecore_Audio_Type;
|
|
|
|
|
2013-05-03 13:44:01 -07:00
|
|
|
/** @since 1.8
|
|
|
|
*/
|
|
|
|
typedef struct _Ecore_Audio_Module Ecore_Audio_Module;
|
|
|
|
/**< The audio module */
|
|
|
|
|
|
|
|
/** @since 1.8
|
|
|
|
*/
|
|
|
|
typedef struct _Ecore_Audio_Object Ecore_Audio_Object; /**< The audio object */
|
|
|
|
|
2013-05-01 08:26:49 -07:00
|
|
|
/*
|
2014-10-13 08:24:27 -07:00
|
|
|
* @brief Structure to hold the callbacks needed to implement virtual file IO
|
2013-05-01 08:26:49 -07:00
|
|
|
* @since 1.8
|
|
|
|
*/
|
2012-12-14 15:38:01 -08:00
|
|
|
struct _Ecore_Audio_Vio {
|
2013-05-01 08:26:49 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Gets the length of the file.
|
2013-05-01 08:26:49 -07:00
|
|
|
*
|
|
|
|
* @param data User data from the ecore_audio_obj_set_vio call
|
|
|
|
* @param eo_obj The Ecore_Audio object this operates on
|
|
|
|
*
|
|
|
|
* @return The length of the virtual file in bytes
|
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
2013-04-17 11:06:21 -07:00
|
|
|
int (*get_length)(void *data, Eo *eo_obj);
|
2013-05-01 08:26:49 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Seeks to a position within the file.
|
2013-05-01 08:26:49 -07:00
|
|
|
*
|
|
|
|
* @param data User data from the ecore_audio_obj_set_vio call
|
|
|
|
* @param eo_obj The Ecore_Audio object this operates on
|
|
|
|
* @param offset The number of bytes to move (can be negative)
|
|
|
|
* @param whence Accepts the same values as fseek(), which are:
|
|
|
|
* SEEK_SET: offset is absolute
|
|
|
|
* SEEK_CUR: offset is relative to the current position
|
|
|
|
* SEEK_END: offset is relative to the end
|
|
|
|
*
|
|
|
|
* @return The resulting position from the start of the file (in bytes)
|
2015-03-18 18:37:47 -07:00
|
|
|
* or -1 if an error occurred (i.e. out of bounds)
|
2013-05-01 08:26:49 -07:00
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
2013-04-17 11:06:21 -07:00
|
|
|
int (*seek)(void *data, Eo *eo_obj, int offset, int whence);
|
2013-05-01 08:26:49 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Gets the current position within the file.
|
2013-05-01 08:26:49 -07:00
|
|
|
*
|
|
|
|
* @param data User data from the ecore_audio_obj_set_vio call
|
|
|
|
* @param eo_obj The Ecore_Audio object this operates on
|
|
|
|
*
|
|
|
|
* @return The resulting position from the start of the file (in bytes)
|
|
|
|
*
|
|
|
|
* This is equivalent to calling seek() with offset 0 and whence SEEK_CUR.
|
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
2013-04-17 11:06:21 -07:00
|
|
|
int (*tell)(void *data, Eo *eo_obj);
|
2013-05-01 08:26:49 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Reads some data from the file.
|
2013-05-01 08:26:49 -07:00
|
|
|
*
|
|
|
|
* @param data User data from the ecore_audio_obj_set_vio call
|
|
|
|
* @param eo_obj The Ecore_Audio object this operates on
|
|
|
|
* @param[out] buffer the buffer to write the data to
|
|
|
|
* @param length The number of bytes to read
|
|
|
|
*
|
|
|
|
* @return The number of bytes read from the file. May be less than length
|
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
2013-04-17 11:06:21 -07:00
|
|
|
int (*read)(void *data, Eo *eo_obj, void *buffer, int length);
|
2013-05-01 08:26:49 -07:00
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Writes some data to the file.
|
2013-05-01 08:26:49 -07:00
|
|
|
*
|
|
|
|
* @param data User data from the ecore_audio_obj_set_vio call
|
|
|
|
* @param eo_obj The Ecore_Audio object this operates on
|
|
|
|
* @param buffer Write data from here to the file
|
|
|
|
* @param length The number of bytes to write
|
|
|
|
*
|
|
|
|
* @return The number of bytes written to the file. May be less than length
|
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
2013-04-17 11:06:21 -07:00
|
|
|
int (*write)(void *data, Eo *eo_obj, const void *buffer, int length);
|
2012-12-14 15:38:01 -08:00
|
|
|
};
|
|
|
|
|
2013-05-01 08:26:49 -07:00
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Holds the callback functions to implement virtual file IO.
|
2013-05-01 08:26:49 -07:00
|
|
|
* @since 1.8
|
|
|
|
*/
|
|
|
|
typedef struct _Ecore_Audio_Vio Ecore_Audio_Vio;
|
2012-12-14 15:38:01 -08:00
|
|
|
|
|
|
|
/* Audio operations */
|
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Initializes the Ecore_Audio library.
|
2012-12-14 15:38:01 -08:00
|
|
|
*
|
2017-02-12 22:29:11 -08:00
|
|
|
* @return @c 1 or greater on success, @c 0 on error.
|
2012-12-14 15:38:01 -08:00
|
|
|
*
|
2012-12-18 07:51:47 -08:00
|
|
|
* @since 1.8
|
|
|
|
*
|
2012-12-14 15:38:01 -08:00
|
|
|
* This function sets up Ecore_Audio and initializes the modules that
|
|
|
|
* provide the in- and outputs to use. It returns 0 on failure, otherwise
|
|
|
|
* it returns the number of times it has already been called.
|
|
|
|
*
|
|
|
|
* When Ecore_Audio is not used anymore, call ecore_audio_shutdown()
|
|
|
|
* to shut down the Ecore_Audio library.
|
|
|
|
*/
|
|
|
|
EAPI int ecore_audio_init(void);
|
|
|
|
|
|
|
|
/**
|
2017-02-12 22:29:11 -08:00
|
|
|
* @brief Shuts down the Ecore_Audio library.
|
2012-12-14 15:38:01 -08:00
|
|
|
*
|
2017-02-12 22:29:11 -08:00
|
|
|
* @return @c 0 when the library is completely shut down, @c 1 or
|
2012-12-14 15:38:01 -08:00
|
|
|
* greater otherwise.
|
|
|
|
*
|
2012-12-18 07:51:47 -08:00
|
|
|
* @since 1.8
|
|
|
|
*
|
2012-12-14 15:38:01 -08:00
|
|
|
* This function shuts down the Ecore_Audio library. It returns 0 when it has
|
|
|
|
* been called the same number of times than ecore_audio_init(). In that case
|
|
|
|
* it shuts down all the services it uses.
|
|
|
|
*/
|
|
|
|
EAPI int ecore_audio_shutdown(void);
|
|
|
|
|
2018-06-19 06:44:35 -07:00
|
|
|
//Legacy compatibility code
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the name of the object
|
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*
|
|
|
|
*/
|
2018-06-19 09:31:32 -07:00
|
|
|
EAPI const char* ecore_audio_obj_name_get(const Efl_Object* obj);
|
2018-06-19 06:44:35 -07:00
|
|
|
/**
|
|
|
|
* @brief Name of the object
|
|
|
|
*
|
|
|
|
* @since 1.8
|
|
|
|
*
|
|
|
|
*/
|
2018-06-19 09:31:32 -07:00
|
|
|
EAPI void ecore_audio_obj_name_set(Efl_Object* obj, const char *name);
|
2018-06-19 06:44:35 -07:00
|
|
|
|
2013-04-12 09:25:27 -07:00
|
|
|
#include <ecore_audio_obj.h>
|
|
|
|
#include <ecore_audio_obj_in.h>
|
|
|
|
#include <ecore_audio_obj_out.h>
|
|
|
|
|
|
|
|
#include <ecore_audio_obj_in_sndfile.h>
|
|
|
|
#include <ecore_audio_obj_out_sndfile.h>
|
|
|
|
|
2013-04-12 11:11:15 -07:00
|
|
|
#include <ecore_audio_obj_in_tone.h>
|
|
|
|
|
2017-12-13 10:05:26 -08:00
|
|
|
#include <ecore_audio_obj_out_pulse.h>
|
2017-12-13 10:04:49 -08:00
|
|
|
|
2017-12-13 10:05:26 -08:00
|
|
|
#include <ecore_audio_obj_out_wasapi.h>
|
2013-04-17 10:31:38 -07:00
|
|
|
|
2013-05-01 08:26:49 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2017-12-13 10:04:49 -08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2015-04-28 05:24:48 -07:00
|
|
|
#undef EAPI
|
|
|
|
#define EAPI
|
|
|
|
|
2012-12-14 15:38:01 -08:00
|
|
|
#endif
|