weresocool_portaudio_sys/
lib.rs1#[cfg(any(
9 target_os = "macos",
10 target_os = "linux",
11 target_os = "win32",
12 target_os = "windows"
13))]
14mod c_library {
15 #[link(name = "portaudio")]
16 extern "C" {}
17}
18
19#[rustfmt::skip]
20mod portaudio;
21
22pub use portaudio::*;
23
24pub const PA_NO_DEVICE: PaDeviceIndex = -1;
25
26pub type SampleFormat = ::std::os::raw::c_ulong;
28pub const PA_FLOAT_32: SampleFormat = 0x00000001;
29pub const PA_INT_32: SampleFormat = 0x00000002;
30pub const PA_INT_24: SampleFormat = 0x00000004;
31pub const PA_INT_16: SampleFormat = 0x00000008;
32pub const PA_INT_8: SampleFormat = 0x00000010;
33pub const PA_UINT_8: SampleFormat = 0x00000020;
34pub const PA_CUSTOM_FORMAT: SampleFormat = 0x00010000;
35pub const PA_NON_INTERLEAVED: SampleFormat = 0x80000000;
36
37pub type StreamFlags = ::std::os::raw::c_ulong;
39pub const PA_NO_FLAG: StreamFlags = 0;
40pub const PA_CLIP_OFF: StreamFlags = 0x00000001;
41pub const PA_DITHER_OFF: StreamFlags = 0x00000002;
42pub const PA_NEVER_DROP_INPUT: StreamFlags = 0x00000004;
43pub const PA_PRIME_OUTPUT_BUFFERS_USING_STREAM_CALLBACK: StreamFlags = 0x00000008;
44pub const PA_PLATFORM_SPECIFIC_FLAGS: StreamFlags = 0xFFFF0000;
45
46pub type StreamCallbackFlags = ::std::os::raw::c_ulong;
48pub const INPUT_UNDERFLOW: StreamCallbackFlags = 0x00000001;
49pub const INPUT_OVERFLOW: StreamCallbackFlags = 0x00000002;
50pub const OUTPUT_UNDERFLOW: StreamCallbackFlags = 0x00000004;
51pub const OUTPUT_OVERFLOW: StreamCallbackFlags = 0x00000008;
52pub const PRIMING_OUTPUT: StreamCallbackFlags = 0x00000010;
53
54pub unsafe fn c_str_to_str<'a>(
57 c_str: *const std::os::raw::c_char,
58) -> Result<&'a str, ::std::str::Utf8Error> {
59 unsafe { ::std::ffi::CStr::from_ptr(c_str).to_str() }
60}
61
62pub fn str_to_c_str(rust_str: &str) -> *const std::os::raw::c_char {
64 rust_str.as_ptr() as *const _
65}
66
67pub const PA_CONTINUE: PaStreamCallbackResult = 0;
68pub const PA_COMPLETE: PaStreamCallbackResult = 1;
69pub const PA_ABORT: PaStreamCallbackResult = 2;
70pub type PaStreamCallbackResult = ::std::os::raw::c_int;