a couple more useful procs. spaces -> tabs
This commit is contained in:
@@ -6,165 +6,165 @@ import "core:c"
|
|||||||
foreign import alsa "system:asound"
|
foreign import alsa "system:asound"
|
||||||
|
|
||||||
pcm_open_flags :: enum i32 {
|
pcm_open_flags :: enum i32 {
|
||||||
BLOCK = 0x0,
|
BLOCK = 0x0,
|
||||||
NONBLOCK = 0x00000001,
|
NONBLOCK = 0x00000001,
|
||||||
ASYNC = 0x00000002,
|
ASYNC = 0x00000002,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PCM stream (direction) */
|
/** PCM stream (direction) */
|
||||||
pcm_stream_t :: enum i32 {
|
pcm_stream_t :: enum i32 {
|
||||||
/** Playback stream */
|
/** Playback stream */
|
||||||
PLAYBACK = 0,
|
PLAYBACK = 0,
|
||||||
/** Capture stream */
|
/** Capture stream */
|
||||||
CAPTURE,
|
CAPTURE,
|
||||||
LAST = CAPTURE,
|
LAST = CAPTURE,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PCM sample format */
|
/** PCM sample format */
|
||||||
pcm_format_t :: enum {
|
pcm_format_t :: enum {
|
||||||
/** Unknown */
|
/** Unknown */
|
||||||
UNKNOWN = -1,
|
UNKNOWN = -1,
|
||||||
/** Signed 8 bit */
|
/** Signed 8 bit */
|
||||||
S8 = 0,
|
S8 = 0,
|
||||||
/** Unsigned 8 bit */
|
/** Unsigned 8 bit */
|
||||||
U8,
|
U8,
|
||||||
/** Signed 16 bit Little Endian */
|
/** Signed 16 bit Little Endian */
|
||||||
S16_LE,
|
S16_LE,
|
||||||
/** Signed 16 bit Big Endian */
|
/** Signed 16 bit Big Endian */
|
||||||
S16_BE,
|
S16_BE,
|
||||||
/** Unsigned 16 bit Little Endian */
|
/** Unsigned 16 bit Little Endian */
|
||||||
U16_LE,
|
U16_LE,
|
||||||
/** Unsigned 16 bit Big Endian */
|
/** Unsigned 16 bit Big Endian */
|
||||||
U16_BE,
|
U16_BE,
|
||||||
/** Signed 24 bit Little Endian using low three bytes in 32-bit word */
|
/** Signed 24 bit Little Endian using low three bytes in 32-bit word */
|
||||||
S24_LE,
|
S24_LE,
|
||||||
/** Signed 24 bit Big Endian using low three bytes in 32-bit word */
|
/** Signed 24 bit Big Endian using low three bytes in 32-bit word */
|
||||||
S24_BE,
|
S24_BE,
|
||||||
/** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */
|
/** Unsigned 24 bit Little Endian using low three bytes in 32-bit word */
|
||||||
U24_LE,
|
U24_LE,
|
||||||
/** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */
|
/** Unsigned 24 bit Big Endian using low three bytes in 32-bit word */
|
||||||
U24_BE,
|
U24_BE,
|
||||||
/** Signed 32 bit Little Endian */
|
/** Signed 32 bit Little Endian */
|
||||||
S32_LE,
|
S32_LE,
|
||||||
/** Signed 32 bit Big Endian */
|
/** Signed 32 bit Big Endian */
|
||||||
S32_BE,
|
S32_BE,
|
||||||
/** Unsigned 32 bit Little Endian */
|
/** Unsigned 32 bit Little Endian */
|
||||||
U32_LE,
|
U32_LE,
|
||||||
/** Unsigned 32 bit Big Endian */
|
/** Unsigned 32 bit Big Endian */
|
||||||
U32_BE,
|
U32_BE,
|
||||||
/** Float 32 bit Little Endian, Range -1.0 to 1.0 */
|
/** Float 32 bit Little Endian, Range -1.0 to 1.0 */
|
||||||
FLOAT_LE,
|
FLOAT_LE,
|
||||||
/** Float 32 bit Big Endian, Range -1.0 to 1.0 */
|
/** Float 32 bit Big Endian, Range -1.0 to 1.0 */
|
||||||
FLOAT_BE,
|
FLOAT_BE,
|
||||||
/** Float 64 bit Little Endian, Range -1.0 to 1.0 */
|
/** Float 64 bit Little Endian, Range -1.0 to 1.0 */
|
||||||
FLOAT64_LE,
|
FLOAT64_LE,
|
||||||
/** Float 64 bit Big Endian, Range -1.0 to 1.0 */
|
/** Float 64 bit Big Endian, Range -1.0 to 1.0 */
|
||||||
FLOAT64_BE,
|
FLOAT64_BE,
|
||||||
/** IEC-958 Little Endian */
|
/** IEC-958 Little Endian */
|
||||||
IEC958_SUBFRAME_LE,
|
IEC958_SUBFRAME_LE,
|
||||||
/** IEC-958 Big Endian */
|
/** IEC-958 Big Endian */
|
||||||
IEC958_SUBFRAME_BE,
|
IEC958_SUBFRAME_BE,
|
||||||
/** Mu-Law */
|
/** Mu-Law */
|
||||||
MU_LAW,
|
MU_LAW,
|
||||||
/** A-Law */
|
/** A-Law */
|
||||||
A_LAW,
|
A_LAW,
|
||||||
/** Ima-ADPCM */
|
/** Ima-ADPCM */
|
||||||
IMA_ADPCM,
|
IMA_ADPCM,
|
||||||
/** MPEG */
|
/** MPEG */
|
||||||
MPEG,
|
MPEG,
|
||||||
/** GSM */
|
/** GSM */
|
||||||
GSM,
|
GSM,
|
||||||
/** Signed 20bit Little Endian in 4bytes format, LSB justified */
|
/** Signed 20bit Little Endian in 4bytes format, LSB justified */
|
||||||
S20_LE,
|
S20_LE,
|
||||||
/** Signed 20bit Big Endian in 4bytes format, LSB justified */
|
/** Signed 20bit Big Endian in 4bytes format, LSB justified */
|
||||||
S20_BE,
|
S20_BE,
|
||||||
/** Unsigned 20bit Little Endian in 4bytes format, LSB justified */
|
/** Unsigned 20bit Little Endian in 4bytes format, LSB justified */
|
||||||
U20_LE,
|
U20_LE,
|
||||||
/** Unsigned 20bit Big Endian in 4bytes format, LSB justified */
|
/** Unsigned 20bit Big Endian in 4bytes format, LSB justified */
|
||||||
U20_BE,
|
U20_BE,
|
||||||
/** Special */
|
/** Special */
|
||||||
SPECIAL = 31,
|
SPECIAL = 31,
|
||||||
/** Signed 24bit Little Endian in 3bytes format */
|
/** Signed 24bit Little Endian in 3bytes format */
|
||||||
S24_3LE = 32,
|
S24_3LE = 32,
|
||||||
/** Signed 24bit Big Endian in 3bytes format */
|
/** Signed 24bit Big Endian in 3bytes format */
|
||||||
S24_3BE,
|
S24_3BE,
|
||||||
/** Unsigned 24bit Little Endian in 3bytes format */
|
/** Unsigned 24bit Little Endian in 3bytes format */
|
||||||
U24_3LE,
|
U24_3LE,
|
||||||
/** Unsigned 24bit Big Endian in 3bytes format */
|
/** Unsigned 24bit Big Endian in 3bytes format */
|
||||||
U24_3BE,
|
U24_3BE,
|
||||||
/** Signed 20bit Little Endian in 3bytes format */
|
/** Signed 20bit Little Endian in 3bytes format */
|
||||||
S20_3LE,
|
S20_3LE,
|
||||||
/** Signed 20bit Big Endian in 3bytes format */
|
/** Signed 20bit Big Endian in 3bytes format */
|
||||||
S20_3BE,
|
S20_3BE,
|
||||||
/** Unsigned 20bit Little Endian in 3bytes format */
|
/** Unsigned 20bit Little Endian in 3bytes format */
|
||||||
U20_3LE,
|
U20_3LE,
|
||||||
/** Unsigned 20bit Big Endian in 3bytes format */
|
/** Unsigned 20bit Big Endian in 3bytes format */
|
||||||
U20_3BE,
|
U20_3BE,
|
||||||
/** Signed 18bit Little Endian in 3bytes format */
|
/** Signed 18bit Little Endian in 3bytes format */
|
||||||
S18_3LE,
|
S18_3LE,
|
||||||
/** Signed 18bit Big Endian in 3bytes format */
|
/** Signed 18bit Big Endian in 3bytes format */
|
||||||
S18_3BE,
|
S18_3BE,
|
||||||
/** Unsigned 18bit Little Endian in 3bytes format */
|
/** Unsigned 18bit Little Endian in 3bytes format */
|
||||||
U18_3LE,
|
U18_3LE,
|
||||||
/** Unsigned 18bit Big Endian in 3bytes format */
|
/** Unsigned 18bit Big Endian in 3bytes format */
|
||||||
U18_3BE,
|
U18_3BE,
|
||||||
/* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */
|
/* G.723 (ADPCM) 24 kbit/s, 8 samples in 3 bytes */
|
||||||
G723_24,
|
G723_24,
|
||||||
/* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */
|
/* G.723 (ADPCM) 24 kbit/s, 1 sample in 1 byte */
|
||||||
G723_24_1B,
|
G723_24_1B,
|
||||||
/* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */
|
/* G.723 (ADPCM) 40 kbit/s, 8 samples in 3 bytes */
|
||||||
G723_40,
|
G723_40,
|
||||||
/* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */
|
/* G.723 (ADPCM) 40 kbit/s, 1 sample in 1 byte */
|
||||||
G723_40_1B,
|
G723_40_1B,
|
||||||
/* Direct Stream Digital (DSD) in 1-byte samples (x8) */
|
/* Direct Stream Digital (DSD) in 1-byte samples (x8) */
|
||||||
DSD_U8,
|
DSD_U8,
|
||||||
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
|
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
|
||||||
DSD_U16_LE,
|
DSD_U16_LE,
|
||||||
/* Direct Stream Digital (DSD) in 4-byte samples (x32) */
|
/* Direct Stream Digital (DSD) in 4-byte samples (x32) */
|
||||||
DSD_U32_LE,
|
DSD_U32_LE,
|
||||||
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
|
/* Direct Stream Digital (DSD) in 2-byte samples (x16) */
|
||||||
DSD_U16_BE,
|
DSD_U16_BE,
|
||||||
/* Direct Stream Digital (DSD) in 4-byte samples (x32) */
|
/* Direct Stream Digital (DSD) in 4-byte samples (x32) */
|
||||||
DSD_U32_BE,
|
DSD_U32_BE,
|
||||||
LAST = DSD_U32_BE,
|
LAST = DSD_U32_BE,
|
||||||
|
|
||||||
/** Signed 16 bit CPU endian */
|
/** Signed 16 bit CPU endian */
|
||||||
S16 = S16_BE when ODIN_ENDIAN == .Big else S16_LE,
|
S16 = S16_BE when ODIN_ENDIAN == .Big else S16_LE,
|
||||||
/** Unsigned 16 bit CPU endian */
|
/** Unsigned 16 bit CPU endian */
|
||||||
U16 = U16_BE when ODIN_ENDIAN == .Big else U16_LE,
|
U16 = U16_BE when ODIN_ENDIAN == .Big else U16_LE,
|
||||||
/** Signed 24 bit CPU endian */
|
/** Signed 24 bit CPU endian */
|
||||||
S24 = S24_BE when ODIN_ENDIAN == .Big else S32_LE,
|
S24 = S24_BE when ODIN_ENDIAN == .Big else S32_LE,
|
||||||
/** Unsigned 24 bit CPU endian */
|
/** Unsigned 24 bit CPU endian */
|
||||||
U24 = U24_BE when ODIN_ENDIAN == .Big else U24_LE,
|
U24 = U24_BE when ODIN_ENDIAN == .Big else U24_LE,
|
||||||
/** Signed 32 bit CPU endian */
|
/** Signed 32 bit CPU endian */
|
||||||
S32 = S32_BE when ODIN_ENDIAN == .Big else S32_LE,
|
S32 = S32_BE when ODIN_ENDIAN == .Big else S32_LE,
|
||||||
/** Unsigned 32 bit CPU endian */
|
/** Unsigned 32 bit CPU endian */
|
||||||
U32 = U32_BE when ODIN_ENDIAN == .Big else U32_LE,
|
U32 = U32_BE when ODIN_ENDIAN == .Big else U32_LE,
|
||||||
/** Float 32 bit CPU endian */
|
/** Float 32 bit CPU endian */
|
||||||
FLOAT = FLOAT_BE when ODIN_ENDIAN == .Big else FLOAT_LE,
|
FLOAT = FLOAT_BE when ODIN_ENDIAN == .Big else FLOAT_LE,
|
||||||
/** Float 64 bit CPU endian */
|
/** Float 64 bit CPU endian */
|
||||||
FLOAT64 = FLOAT64_BE when ODIN_ENDIAN == .Big else FLOAT64_LE,
|
FLOAT64 = FLOAT64_BE when ODIN_ENDIAN == .Big else FLOAT64_LE,
|
||||||
/** IEC-958 CPU Endian */
|
/** IEC-958 CPU Endian */
|
||||||
IEC958_SUBFRAME = IEC958_SUBFRAME_BE when ODIN_ENDIAN == .Big else IEC958_SUBFRAME_LE,
|
IEC958_SUBFRAME = IEC958_SUBFRAME_BE when ODIN_ENDIAN == .Big else IEC958_SUBFRAME_LE,
|
||||||
/** Signed 20bit in 4bytes format, LSB justified, CPU Endian */
|
/** Signed 20bit in 4bytes format, LSB justified, CPU Endian */
|
||||||
S20 = S20_BE when ODIN_ENDIAN == .Big else S20_LE,
|
S20 = S20_BE when ODIN_ENDIAN == .Big else S20_LE,
|
||||||
/** Unsigned 20bit in 4bytes format, LSB justified, CPU Endian */
|
/** Unsigned 20bit in 4bytes format, LSB justified, CPU Endian */
|
||||||
U20 = U20_BE when ODIN_ENDIAN == .Big else U20_LE,
|
U20 = U20_BE when ODIN_ENDIAN == .Big else U20_LE,
|
||||||
}
|
}
|
||||||
|
|
||||||
/** PCM access type */
|
/** PCM access type */
|
||||||
pcm_access_t :: enum {
|
pcm_access_t :: enum {
|
||||||
/** mmap access with simple interleaved channels */
|
/** mmap access with simple interleaved channels */
|
||||||
MMAP_INTERLEAVED = 0,
|
MMAP_INTERLEAVED = 0,
|
||||||
/** mmap access with simple non interleaved channels */
|
/** mmap access with simple non interleaved channels */
|
||||||
MMAP_NONINTERLEAVED,
|
MMAP_NONINTERLEAVED,
|
||||||
/** mmap access with complex placement */
|
/** mmap access with complex placement */
|
||||||
MMAP_COMPLEX,
|
MMAP_COMPLEX,
|
||||||
/** snd_pcm_readi/snd_pcm_writei access */
|
/** snd_pcm_readi/snd_pcm_writei access */
|
||||||
RW_INTERLEAVED,
|
RW_INTERLEAVED,
|
||||||
/** snd_pcm_readn/snd_pcm_writen access */
|
/** snd_pcm_readn/snd_pcm_writen access */
|
||||||
RW_NONINTERLEAVED,
|
RW_NONINTERLEAVED,
|
||||||
LAST = RW_NONINTERLEAVED
|
LAST = RW_NONINTERLEAVED
|
||||||
}
|
}
|
||||||
|
|
||||||
/** channel positions */
|
/** channel positions */
|
||||||
@@ -223,19 +223,24 @@ pcm_chmap_t :: struct {
|
|||||||
|
|
||||||
@(link_prefix="snd_")
|
@(link_prefix="snd_")
|
||||||
foreign alsa {
|
foreign alsa {
|
||||||
pcm_open :: proc(pcmp: ^^pcm_t, name: cstring, stream: pcm_stream_t, mode: pcm_open_flags) -> i32 ---
|
pcm_open :: proc(pcmp: ^^pcm_t, name: cstring, stream: pcm_stream_t, mode: pcm_open_flags) -> i32 ---
|
||||||
strerror :: proc(errnum: i32) -> cstring ---
|
strerror :: proc(errnum: i32) -> cstring ---
|
||||||
pcm_set_params :: proc(
|
pcm_set_params :: proc(
|
||||||
pcm: ^pcm_t,
|
pcm: ^pcm_t,
|
||||||
format: pcm_format_t,
|
format: pcm_format_t,
|
||||||
access: pcm_access_t,
|
access: pcm_access_t,
|
||||||
channels: u32,
|
channels: u32,
|
||||||
rate: u32,
|
rate: u32,
|
||||||
soft_resample: i32,
|
soft_resample: i32,
|
||||||
latency: u32) -> i32 ---
|
latency: u32) -> i32 ---
|
||||||
pcm_drain :: proc(pcm: ^pcm_t) -> i32 ---
|
pcm_drain :: proc(pcm: ^pcm_t) -> i32 ---
|
||||||
pcm_close :: proc(pcm: ^pcm_t) -> i32 ---
|
pcm_close :: proc(pcm: ^pcm_t) -> i32 ---
|
||||||
pcm_writei :: proc(pcm: ^pcm_t, buffer: rawptr, size: pcm_uframes_t) -> pcm_sframes_t ---
|
pcm_prepare :: proc(pcm: ^pcm_t) -> i32 ---
|
||||||
|
pcm_writei :: proc(pcm: ^pcm_t, buffer: rawptr, size: pcm_uframes_t) -> pcm_sframes_t ---
|
||||||
|
pcm_writen :: proc(pcm: ^pcm_t, bufs: [^]rawptr, size: pcm_uframes_t) -> pcm_sframes_t ---
|
||||||
|
pcm_readi :: proc(pcm: ^pcm_t, buffer: rawptr, size: pcm_uframes_t) -> pcm_sframes_t ---
|
||||||
|
pcm_readn :: proc(pcm: ^pcm_t, bufs: [^]rawptr, size: pcm_uframes_t) -> pcm_sframes_t ---
|
||||||
|
pcm_format_width :: proc(format: pcm_format_t) -> i32 ---
|
||||||
pcm_hw_params_set_channels :: proc(pcm: ^pcm_t, params: ^pcm_hw_params_t, val: u32) ---
|
pcm_hw_params_set_channels :: proc(pcm: ^pcm_t, params: ^pcm_hw_params_t, val: u32) ---
|
||||||
pcm_chmap_long_name :: proc(val: pcm_chmap_position) -> cstring ---
|
pcm_chmap_long_name :: proc(val: pcm_chmap_position) -> cstring ---
|
||||||
pcm_get_chmap :: proc(pcm: ^pcm_t) -> ^pcm_chmap_t ---
|
pcm_get_chmap :: proc(pcm: ^pcm_t) -> ^pcm_chmap_t ---
|
||||||
|
|||||||
Reference in New Issue
Block a user