rustyray_sys/
audio.rs

1use libc::{c_int, c_uint, c_void};
2
3/// Wave, audio wave data
4#[repr(C)]
5#[derive(Debug)]
6pub struct Wave {
7    frame_count: c_uint,
8    sample_rate: c_uint,
9    sample_size: c_uint,
10    channels: c_uint,
11    data: *const c_void,
12}
13
14enum RAudioBuffer {}
15enum RAudioProcessor {}
16
17pub type AudioCallback = extern "C" fn(buffer_data: *const c_void, frames: c_uint);
18
19/// AudioStream, custom audio stream
20#[repr(C)]
21#[derive(Debug)]
22pub struct AudioStream {
23    /// Pointer to internal data used by the audio system
24    buffer: *const RAudioBuffer,
25    /// Pointer to internal data processor, useful for audio effects
26    processor: *const RAudioProcessor,
27
28    /// Frequency (samples per second)
29    sample_rate: c_uint,
30    /// Bit detph (bits per sample): 8, 16, 32 (24 not supported)
31    sample_size: c_uint,
32    /// Number of channels (1-mono, 2-stereo, ...)
33    channels: c_uint,
34}
35
36/// Sound
37#[repr(C)]
38#[derive(Debug)]
39pub struct Sound {
40    /// Audio Stream
41    stream: AudioStream,
42    /// Total number of frames (considering channels)
43    frame_count: c_uint,
44}
45
46#[repr(C)]
47#[derive(Debug)]
48pub struct Music {
49    stream: AudioStream,
50    frame_count: c_uint,
51    looping: bool,
52
53    ctx_type: c_int,
54    ctx_data: *const c_void,
55}