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
|
|
|
|
|
|
|
|
#ifdef __GNUC__
|
|
|
|
#if __GNUC__ >= 4
|
|
|
|
#define EAPI __attribute__ ((visibility("default")))
|
|
|
|
#else
|
|
|
|
#define EAPI
|
|
|
|
#endif
|
|
|
|
#else
|
|
|
|
#define EAPI
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @file Ecore_Audio.h
|
|
|
|
* @brief Audio utility functions
|
|
|
|
*/
|
|
|
|
|
|
|
|
#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 */
|
ecore_audio: drop support for CoreAudio on macOS
CoreAudio support was initially introduced by commit
62e29b39f4df40fd3c0a6b17f7a16f0f8fc1d0c9 as an experimental feature.
It played basic sounds, but suffered from drawbacks: it was controlling
the master channel, and therefore any sound played by ecore_audio would
shut down a previous sound (e.g. background music) for the time of the
sound being played. So that wasn't exactly great... Also, after some
time, some hangs have been reported when playing a sound on input. Most
of the time, it translated as a pause in the main loop (see T3797).
More recently (several months ago), ecore_audio with CoreAudio stopped
working during 1.19 development...
So... CoreAudio support on macOS has never been great. And now it's fully
broken. Instead of trying to revive the thing, let just use PulseAudio.
PulseAudio can be installed without any trouble on macOS thanks to
package managers such as Homebrew. Actually, the efl package provided by
Homebrew already provides PulseAudio as a dependency. And it actually
just works very fine. Dropping CoreAudio seems therefore a nice option:
removes unmaintained code, fixes bugs, and add features.
2016-10-29 13:32:19 -07:00
|
|
|
ECORE_AUDIO_TYPE_CORE_AUDIO EINA_DEPRECATED, /**< Use Core Audio module (Apple) - DEPRECATED */
|
2013-05-03 13:44:01 -07:00
|
|
|
ECORE_AUDIO_TYPE_CUSTOM, /**< Use custom module */
|
|
|
|
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
|
|
|
/**
|
|
|
|
* @brief Get the length of the file
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Seek to a position within the file
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Get the current position within the file
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Read some data from the file
|
|
|
|
*
|
|
|
|
* @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
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Write some data to the file
|
|
|
|
*
|
|
|
|
* @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
|
|
|
/**
|
|
|
|
* @brief Holds the callback functions to implement virtual file IO
|
|
|
|
* @since 1.8
|
|
|
|
*/
|
|
|
|
typedef struct _Ecore_Audio_Vio Ecore_Audio_Vio;
|
2012-12-14 15:38:01 -08:00
|
|
|
|
|
|
|
/* Audio operations */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize the Ecore_Audio library.
|
|
|
|
*
|
|
|
|
* @return 1 or greater on success, 0 on error.
|
|
|
|
*
|
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);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Shut down the Ecore_Audio library.
|
|
|
|
*
|
|
|
|
* @return 0 when the library is completely shut down, 1 or
|
|
|
|
* 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);
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
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>
|
|
|
|
|
2015-04-15 07:53:39 -07:00
|
|
|
#if HAVE_PULSE
|
|
|
|
# include <ecore_audio_obj_out_pulse.h>
|
|
|
|
#endif
|
2013-04-17 10:31:38 -07:00
|
|
|
|
2013-05-01 08:26:49 -07:00
|
|
|
/**
|
|
|
|
* @}
|
|
|
|
*/
|
|
|
|
|
2015-04-28 05:24:48 -07:00
|
|
|
#undef EAPI
|
|
|
|
#define EAPI
|
|
|
|
|
2012-12-14 15:38:01 -08:00
|
|
|
#endif
|