ALSA:PCM フォーマットタイプ/マスク

enum snd_pcm_formatPCM フォーマットタイプ
snd_pcm_format_nameフォーマットタイプから名前を取得
マスク
snd_pcm_format_mask_sizeofsnd_pcm_format_mask_t のサイズ取得
snd_pcm_format_mask_mallocsnd_pcm_format_mask_t 確保
snd_pcm_format_mask_freesnd_pcm_format_mask_t 解放
snd_pcm_format_mask_copy複製
チェック
snd_pcm_format_mask_test指定フォーマットが存在するか
snd_pcm_format_mask_emptyビットが空か
セット
snd_pcm_format_mask_noneすべてのビットをクリア
snd_pcm_format_mask_anyすべてのビットをセット
snd_pcm_format_mask_set指定フォーマットを含める
snd_pcm_format_mask_reset指定フォーマットを除外する
typedef enum _snd_pcm_format {
    SND_PCM_FORMAT_UNKNOWN = -1,
    SND_PCM_FORMAT_S8 = 0,
    SND_PCM_FORMAT_U8,
    SND_PCM_FORMAT_S16_LE,
    SND_PCM_FORMAT_S16_BE,
    SND_PCM_FORMAT_U16_LE,
    SND_PCM_FORMAT_U16_BE,
    SND_PCM_FORMAT_S24_LE, //32bit 中の下位 24bit
    SND_PCM_FORMAT_S24_BE,
    SND_PCM_FORMAT_U24_LE,
    SND_PCM_FORMAT_U24_BE,
    SND_PCM_FORMAT_S32_LE,
    SND_PCM_FORMAT_S32_BE,
    SND_PCM_FORMAT_U32_LE,
    SND_PCM_FORMAT_U32_BE,
    SND_PCM_FORMAT_FLOAT_LE, //float 32bit: -1.0〜1.0
    SND_PCM_FORMAT_FLOAT_BE,
    SND_PCM_FORMAT_FLOAT64_LE,
    SND_PCM_FORMAT_FLOAT64_BE,
    SND_PCM_FORMAT_IEC958_SUBFRAME_LE,
    SND_PCM_FORMAT_IEC958_SUBFRAME_BE,
    SND_PCM_FORMAT_MU_LAW,
    SND_PCM_FORMAT_A_LAW,
    SND_PCM_FORMAT_IMA_ADPCM,
    SND_PCM_FORMAT_MPEG,
    SND_PCM_FORMAT_GSM,
    SND_PCM_FORMAT_S20_LE, //32bit中の20bit (LSB)
    SND_PCM_FORMAT_S20_BE,
    SND_PCM_FORMAT_U20_LE,
    SND_PCM_FORMAT_U20_BE,
    SND_PCM_FORMAT_SPECIAL = 31,
    SND_PCM_FORMAT_S24_3LE = 32, //3byte中の24bit
    SND_PCM_FORMAT_S24_3BE,
    SND_PCM_FORMAT_U24_3LE,
    SND_PCM_FORMAT_U24_3BE,
    SND_PCM_FORMAT_S20_3LE, //3byte中の20bit
    SND_PCM_FORMAT_S20_3BE,
    SND_PCM_FORMAT_U20_3LE,
    SND_PCM_FORMAT_U20_3BE,
    SND_PCM_FORMAT_S18_3LE, //3byte中の18bit
    SND_PCM_FORMAT_S18_3BE,
    SND_PCM_FORMAT_U18_3LE,
    SND_PCM_FORMAT_U18_3BE,
    /* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */
    SND_PCM_FORMAT_G723_24,
    /* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */
    SND_PCM_FORMAT_G723_24_1B,
    /* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */
    SND_PCM_FORMAT_G723_40,
    /* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */
    SND_PCM_FORMAT_G723_40_1B,
    /* Direct Stream Digital (DSD) in 1-byte samples (x8) */
    SND_PCM_FORMAT_DSD_U8,
    /* Direct Stream Digital (DSD) in 2-byte samples (x16) */
    SND_PCM_FORMAT_DSD_U16_LE,
    /* Direct Stream Digital (DSD) in 4-byte samples (x32) */
    SND_PCM_FORMAT_DSD_U32_LE,
    /* Direct Stream Digital (DSD) in 2-byte samples (x16) */
    SND_PCM_FORMAT_DSD_U16_BE,
    /* Direct Stream Digital (DSD) in 4-byte samples (x32) */
    SND_PCM_FORMAT_DSD_U32_BE,
    SND_PCM_FORMAT_LAST = SND_PCM_FORMAT_DSD_U32_BE,

    //コンパイル環境のエンディアンに対応
    SND_PCM_FORMAT_S16
    SND_PCM_FORMAT_U16
    SND_PCM_FORMAT_S24
    SND_PCM_FORMAT_U24
    SND_PCM_FORMAT_S32
    SND_PCM_FORMAT_U32
    SND_PCM_FORMAT_FLOAT
    SND_PCM_FORMAT_FLOAT64
    SND_PCM_FORMAT_IEC958_SUBFRAME
    SND_PCM_FORMAT_S20
    SND_PCM_FORMAT_U20
} snd_pcm_format_t;
PCM フォーマットタイプ
const char *snd_pcm_format_name(const snd_pcm_format_t format);
フォーマットタイプから名前を取得
マスク
size_t snd_pcm_format_mask_sizeof(void);
snd_pcm_format_mask_t のサイズ取得
int snd_pcm_format_mask_malloc(snd_pcm_format_mask_t **ptr);
snd_pcm_format_mask_t 確保
void snd_pcm_format_mask_free(snd_pcm_format_mask_t *obj);
snd_pcm_format_mask_t 解放
void snd_pcm_format_mask_copy(snd_pcm_format_mask_t *dst, const snd_pcm_format_mask_t *src);
複製
チェック
int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
指定フォーマットが存在するか
int snd_pcm_format_mask_empty(const snd_pcm_format_mask_t *mask);
ビットが空か
セット
void snd_pcm_format_mask_none(snd_pcm_format_mask_t *mask);
すべてのビットをクリア
void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask);
すべてのビットをセット
void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
指定フォーマットを含める
void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
指定フォーマットを除外する