initial commit
This commit is contained in:
@@ -0,0 +1,135 @@
|
||||
package pulse
|
||||
|
||||
import "core:c"
|
||||
|
||||
foreign import pulse "system:pulse-simple"
|
||||
|
||||
PA_CHANNELS_MAX :: 32
|
||||
|
||||
pa_sample_format :: enum c.int {
|
||||
INVALID = -1,
|
||||
U8 = 0,
|
||||
ALAW,
|
||||
ULAW,
|
||||
S16LE,
|
||||
S16BE,
|
||||
FLOAT32LE,
|
||||
FLOAT32BE,
|
||||
S32LE,
|
||||
S32BE,
|
||||
S24LE,
|
||||
S24BE,
|
||||
S24_32LE,
|
||||
S24_32BE,
|
||||
}
|
||||
|
||||
pa_stream_direction :: enum c.int {
|
||||
NODIRECTION,
|
||||
PLAYBACK,
|
||||
RECORD,
|
||||
UPLOAD,
|
||||
}
|
||||
|
||||
pa_channel_position :: enum c.int {
|
||||
INVALID = -1,
|
||||
MONO = 0,
|
||||
FRONT_LEFT,
|
||||
FRONT_RIGHT,
|
||||
FRONT_CENTER,
|
||||
REAR_CENTER,
|
||||
REAR_LEFT,
|
||||
REAR_RIGHT,
|
||||
LFE,
|
||||
FRONT_LEFT_OF_CENTER,
|
||||
FRONT_RIGHT_OF_CENTER,
|
||||
SIDE_LEFT,
|
||||
SIDE_RIGHT,
|
||||
AUX0,
|
||||
AUX1,
|
||||
AUX2,
|
||||
AUX3,
|
||||
AUX4,
|
||||
AUX5,
|
||||
AUX6,
|
||||
AUX7,
|
||||
AUX8,
|
||||
AUX9,
|
||||
AUX10,
|
||||
AUX11,
|
||||
AUX12,
|
||||
AUX13,
|
||||
AUX14,
|
||||
AUX15,
|
||||
AUX16,
|
||||
AUX17,
|
||||
AUX18,
|
||||
AUX19,
|
||||
AUX20,
|
||||
AUX21,
|
||||
AUX22,
|
||||
AUX23,
|
||||
AUX24,
|
||||
AUX25,
|
||||
AUX26,
|
||||
AUX27,
|
||||
AUX28,
|
||||
AUX29,
|
||||
AUX30,
|
||||
AUX31,
|
||||
TOP_CENTER,
|
||||
TOP_FRONT_LEFT,
|
||||
TOP_FRONT_RIGHT,
|
||||
TOP_FRONT_CENTER,
|
||||
TOP_REAR_LEFT,
|
||||
TOP_REAR_RIGHT,
|
||||
TOP_REAR_CENTER,
|
||||
}
|
||||
|
||||
pa_simple :: struct {}
|
||||
pa_sample_spec :: struct {
|
||||
format: pa_sample_format,
|
||||
rate: u32,
|
||||
channels: u8,
|
||||
}
|
||||
|
||||
// A channel map which can be used to attach labels to specific channels of a stream
|
||||
pa_channel_map :: struct {
|
||||
channels: u8,
|
||||
map_: [PA_CHANNELS_MAX]pa_channel_position,
|
||||
}
|
||||
|
||||
pa_buffer_attr :: struct {
|
||||
maxlength: u32,
|
||||
tlength: u32,
|
||||
prebuf: u32,
|
||||
minreq: u32,
|
||||
fregzie: u32,
|
||||
}
|
||||
|
||||
pa_usec :: u64
|
||||
|
||||
@(link_prefix="pa_")
|
||||
foreign pulse {
|
||||
/* Create a new connection to the server.
|
||||
Parameters
|
||||
server Server name, or NULL for default
|
||||
name A descriptive name for this client (application name, ...)
|
||||
dir Open this stream for recording or playback?
|
||||
dev Sink (resp. source) name, or NULL for default
|
||||
stream_name A descriptive name for this stream (application name, song title, ...)
|
||||
ss The sample type to use
|
||||
map The channel map to use, or NULL for default
|
||||
attr Buffering attributes, or NULL for default
|
||||
error A pointer where the error code is stored when the routine returns NULL. It is OK to pass NULL here.
|
||||
*/
|
||||
simple_new :: proc(server: cstring, name: cstring, dir: pa_stream_direction, dev: cstring, stream_name: cstring, ss: ^pa_sample_spec, _map: ^pa_channel_map, attr: ^pa_buffer_attr, error: ^c.int) -> ^pa_simple ---
|
||||
// Close and free the connection to the server.
|
||||
//
|
||||
// The connection object becomes invalid when this is called.
|
||||
simple_free :: proc(s: ^pa_simple) ---
|
||||
simple_write :: proc(s: ^pa_simple, data: rawptr, bytes: c.size_t, error: ^c.int) -> c.int ---
|
||||
simple_drain :: proc(s: ^pa_simple, error: ^c.int) -> c.int ---
|
||||
simple_read :: proc(s: ^pa_simple, data: rawptr, bytes: c.size_t, error: ^c.int) -> c.int ---
|
||||
simple_get_latency :: proc(s: ^pa_simple, error: ^c.int) -> pa_usec ---
|
||||
simple_flush :: proc(s: ^pa_simple, error: ^c.int) -> c.int ---
|
||||
}
|
||||
Reference in New Issue
Block a user