mirror of
https://gitee.com/openharmony/third_party_alsa-lib
synced 2024-11-23 07:30:32 +00:00
Get rid of enum type checking ugly trick
This commit is contained in:
parent
78af661d60
commit
08232943a2
@ -10,15 +10,6 @@
|
||||
#define SND_BIG_ENDIAN SNDRV_BIG_ENDIAN
|
||||
#endif
|
||||
|
||||
//#define SND_ENUM_TYPECHECK
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
#define snd_enum_to_int(v) ((unsigned int)(unsigned long)(v))
|
||||
#define snd_int_to_enum(v) ((void *)(unsigned long)(v))
|
||||
#define snd_enum_incr(v) (++(unsigned long)(v))
|
||||
#else
|
||||
#define snd_enum_to_int(v) (v)
|
||||
#define snd_int_to_enum(v) (v)
|
||||
#define snd_enum_incr(v) (++(v))
|
||||
#endif
|
||||
|
||||
|
@ -5,28 +5,26 @@
|
||||
* *
|
||||
****************************************************************************/
|
||||
|
||||
/** HwDep information container */
|
||||
typedef struct _snd_hwdep_info snd_hwdep_info_t;
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_hwdep_type *snd_hwdep_type_t;
|
||||
#else
|
||||
typedef enum sndrv_hwdep_type snd_hwdep_type_t;
|
||||
#endif
|
||||
|
||||
#define SND_HWDEP_TYPE_OPL2 ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_OPL2)
|
||||
#define SND_HWDEP_TYPE_OPL3 ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_OPL3)
|
||||
#define SND_HWDEP_TYPE_OPL4 ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_OPL4)
|
||||
#define SND_HWDEP_TYPE_SB16CSP ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_SB16CSP)
|
||||
#define SND_HWDEP_TYPE_EMU10K1 ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_EMU10K1)
|
||||
#define SND_HWDEP_TYPE_YSS225 ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_YSS225)
|
||||
#define SND_HWDEP_TYPE_ICS2115 ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_ICS2115)
|
||||
#define SND_HWDEP_TYPE_LAST ((snd_hwdep_type_t) SNDRV_HWDEP_TYPE_LAST)
|
||||
typedef enum _snd_hwdep_type {
|
||||
SND_HWDEP_TYPE_OPL2 = SNDRV_HWDEP_TYPE_OPL2,
|
||||
SND_HWDEP_TYPE_OPL3 = SNDRV_HWDEP_TYPE_OPL3,
|
||||
SND_HWDEP_TYPE_OPL4 = SNDRV_HWDEP_TYPE_OPL4,
|
||||
SND_HWDEP_TYPE_SB16CSP = SNDRV_HWDEP_TYPE_SB16CSP,
|
||||
SND_HWDEP_TYPE_EMU10K1 = SNDRV_HWDEP_TYPE_EMU10K1,
|
||||
SND_HWDEP_TYPE_YSS225 = SNDRV_HWDEP_TYPE_YSS225,
|
||||
SND_HWDEP_TYPE_ICS2115 = SNDRV_HWDEP_TYPE_ICS2115,
|
||||
SND_HWDEP_TYPE_LAST = SNDRV_HWDEP_TYPE_LAST,
|
||||
} snd_hwdep_type_t;
|
||||
|
||||
#define SND_HWDEP_OPEN_READ (O_RDONLY)
|
||||
#define SND_HWDEP_OPEN_WRITE (O_WRONLY)
|
||||
#define SND_HWDEP_OPEN_DUPLEX (O_RDWR)
|
||||
#define SND_HWDEP_OPEN_NONBLOCK (O_NONBLOCK)
|
||||
|
||||
/** HwDep handle */
|
||||
typedef struct _snd_hwdep snd_hwdep_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -43,21 +43,11 @@
|
||||
|
||||
#include "asoundlib.h"
|
||||
|
||||
enum _snd_set_mode {
|
||||
typedef enum _snd_set_mode {
|
||||
SND_CHANGE,
|
||||
SND_TRY,
|
||||
SND_TEST,
|
||||
};
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_set_mode *snd_set_mode_t;
|
||||
#else
|
||||
typedef enum _snd_set_mode snd_set_mode_t;
|
||||
#endif
|
||||
|
||||
#define SND_CHANGE ((snd_set_mode_t) SND_CHANGE)
|
||||
#define SND_TRY ((snd_set_mode_t) SND_TRY)
|
||||
#define SND_TEST ((snd_set_mode_t) SND_TEST)
|
||||
} snd_set_mode_t;
|
||||
|
||||
size_t page_align(size_t size);
|
||||
size_t page_size(void);
|
||||
|
@ -17,20 +17,10 @@ typedef int (*snd_mixer_elem_callback_t)(snd_mixer_elem_t *elem,
|
||||
typedef int (*snd_mixer_compare_t)(const snd_mixer_elem_t *e1,
|
||||
const snd_mixer_elem_t *e2);
|
||||
|
||||
enum _snd_mixer_elem_type {
|
||||
typedef enum _snd_mixer_elem_type {
|
||||
SND_MIXER_ELEM_SIMPLE,
|
||||
SND_MIXER_ELEM_LAST = SND_MIXER_ELEM_SIMPLE,
|
||||
};
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_mixer_elem_type *snd_mixer_elem_type_t;
|
||||
#else
|
||||
typedef enum _snd_mixer_elem_type snd_mixer_elem_type_t;
|
||||
#endif
|
||||
|
||||
#define SND_MIXER_ELEM_SIMPLE ((snd_mixer_elem_type_t) SND_MIXER_ELEM_SIMPLE)
|
||||
#define SND_MIXER_ELEM_LAST ((snd_mixer_elem_type_t) SND_MIXER_ELEM_LAST)
|
||||
|
||||
} snd_mixer_elem_type_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@ -63,7 +53,7 @@ int snd_mixer_class_unregister(snd_mixer_class_t *clss);
|
||||
* Simple (legacy) mixer API
|
||||
*/
|
||||
|
||||
enum _snd_mixer_selem_channel_id {
|
||||
typedef enum _snd_mixer_selem_channel_id {
|
||||
SND_MIXER_SCHN_UNKNOWN = -1,
|
||||
SND_MIXER_SCHN_FRONT_LEFT = 0,
|
||||
SND_MIXER_SCHN_FRONT_RIGHT,
|
||||
@ -73,28 +63,12 @@ enum _snd_mixer_selem_channel_id {
|
||||
SND_MIXER_SCHN_WOOFER,
|
||||
SND_MIXER_SCHN_LAST = 31,
|
||||
SND_MIXER_SCHN_MONO = SND_MIXER_SCHN_FRONT_LEFT
|
||||
};
|
||||
} snd_mixer_selem_channel_id_t;
|
||||
|
||||
/* Simple mixer */
|
||||
|
||||
typedef struct _snd_mixer_selem_id snd_mixer_selem_id_t;
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_mixer_selem_channel_id *snd_mixer_selem_channel_id_t;
|
||||
#else
|
||||
typedef enum _snd_mixer_selem_channel_id snd_mixer_selem_channel_id_t;
|
||||
#endif
|
||||
|
||||
#define SND_MIXER_SCHN_UNKNOWN ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_UNKNOWN)
|
||||
#define SND_MIXER_SCHN_FRONT_LEFT ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_FRONT_LEFT)
|
||||
#define SND_MIXER_SCHN_FRONT_RIGHT ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_FRONT_RIGHT)
|
||||
#define SND_MIXER_SCHN_FRONT_CENTER ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_FRONT_CENTER)
|
||||
#define SND_MIXER_SCHN_REAR_LEFT ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_REAR_LEFT)
|
||||
#define SND_MIXER_SCHN_REAR_RIGHT ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_REAR_RIGHT)
|
||||
#define SND_MIXER_SCHN_WOOFER ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_WOOFER)
|
||||
#define SND_MIXER_SCHN_LAST ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_LAST)
|
||||
#define SND_MIXER_SCHN_MONO ((snd_mixer_selem_channel_id_t) SND_MIXER_SCHN_MONO)
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -300,22 +300,13 @@ typedef enum sndrv_seq_stop_mode snd_seq_stop_mode_t;
|
||||
|
||||
#define SND_SEQ_NONBLOCK 1
|
||||
|
||||
enum _snd_seq_type {
|
||||
typedef enum _snd_seq_type {
|
||||
SND_SEQ_TYPE_HW,
|
||||
SND_SEQ_TYPE_SHM,
|
||||
SND_SEQ_TYPE_INET,
|
||||
};
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_seq_type *snd_seq_type_t;
|
||||
#else
|
||||
typedef enum _snd_seq_type snd_seq_type_t;
|
||||
#endif
|
||||
|
||||
#define SND_SEQ_TYPE_HW ((snd_seq_type_t) SND_SEQ_TYPE_HW)
|
||||
#define SND_SEQ_TYPE_SHM ((snd_seq_type_t) SND_SEQ_TYPE_SHM)
|
||||
#define SND_SEQ_TYPE_INET ((snd_seq_type_t) SND_SEQ_TYPE_INET)
|
||||
} snd_seq_type_t;
|
||||
|
||||
/** Sequencer handle */
|
||||
typedef struct _snd_seq snd_seq_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -12,26 +12,22 @@ typedef struct sndrv_timer_params snd_timer_params_t;
|
||||
typedef struct sndrv_timer_status snd_timer_status_t;
|
||||
typedef struct sndrv_timer_read snd_timer_read_t;
|
||||
|
||||
#ifdef SND_ENUM_TYPECHECK
|
||||
typedef struct __snd_timer_type *snd_timer_type_t;
|
||||
typedef struct __snd_timer_slave_type *snd_timer_slave_type_t;
|
||||
#else
|
||||
typedef enum sndrv_timer_type snd_timer_type_t;
|
||||
typedef enum sndrv_timer_slave_type snd_timer_slave_type_t;
|
||||
#endif
|
||||
typedef enum _snd_timer_type {
|
||||
SND_TIMER_TYPE_NONE = SNDRV_TIMER_TYPE_NONE,
|
||||
SND_TIMER_TYPE_SLAVE = SNDRV_TIMER_TYPE_SLAVE,
|
||||
SND_TIMER_TYPE_GLOBAL = SNDRV_TIMER_TYPE_GLOBAL,
|
||||
SND_TIMER_TYPE_CARD = SNDRV_TIMER_TYPE_CARD,
|
||||
SND_TIMER_TYPE_PCM = SNDRV_TIMER_TYPE_PCM,
|
||||
SND_TIMER_TYPE_LAST = SNDRV_TIMER_TYPE_LAST,
|
||||
} snd_timer_type_t;
|
||||
|
||||
#define SND_TIMER_TYPE_NONE ((snd_timer_type_t) SNDRV_TIMER_TYPE_NONE)
|
||||
#define SND_TIMER_TYPE_SLAVE ((snd_timer_type_t) SNDRV_TIMER_TYPE_SLAVE)
|
||||
#define SND_TIMER_TYPE_GLOBAL ((snd_timer_type_t) SNDRV_TIMER_TYPE_GLOBAL)
|
||||
#define SND_TIMER_TYPE_CARD ((snd_timer_type_t) SNDRV_TIMER_TYPE_CARD)
|
||||
#define SND_TIMER_TYPE_PCM ((snd_timer_type_t) SNDRV_TIMER_TYPE_PCM)
|
||||
#define SND_TIMER_TYPE_LAST ((snd_timer_type_t) SNDRV_TIMER_TYPE_LAST)
|
||||
|
||||
#define SND_TIMER_STYPE_NONE ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_NONE
|
||||
#define SND_TIMER_STYPE_APPLICATION ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_APPLICATION
|
||||
#define SND_TIMER_STYPE_SEQUENCER ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_SEQUENCER
|
||||
#define SND_TIMER_STYPE_OSS_SEQUENCER ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_OSS_SEQUENCER
|
||||
#define SND_TIMER_STYPE_LAST ((snd_timer_slave_type_t) SNDRV_TIMER_STYPE_LAST
|
||||
typedef enum _snd_timer_slave_type {
|
||||
SND_TIMER_STYPE_NONE = SNDRV_TIMER_STYPE_NONE,
|
||||
SND_TIMER_STYPE_APPLICATION = SNDRV_TIMER_STYPE_APPLICATION,
|
||||
SND_TIMER_STYPE_SEQUENCER = SNDRV_TIMER_STYPE_SEQUENCER,
|
||||
SND_TIMER_STYPE_OSS_SEQUENCER = SNDRV_TIMER_STYPE_OSS_SEQUENCER,
|
||||
SND_TIMER_STYPE_LAST = SNDRV_TIMER_STYPE_LAST,
|
||||
} snd_timer_slave_type_t;
|
||||
|
||||
#define SND_TIMER_GLOBAL_SYSTEM SNDRV_TIMER_GLOBAL_SYSTEM
|
||||
#define SND_TIMER_GLOBAL_RTC SNDRV_TIMER_GLOBAL_RTC
|
||||
|
Loading…
Reference in New Issue
Block a user