The manual
ginnOS
The reference: libc, the libraries and the kernel
Toggle main menu visibility
Loading...
Searching...
No Matches
soundcard.h
Go to the documentation of this file.
1
#pragma once
2
3
/**
4
* @file sys/soundcard.h
5
* @brief the OSS sound interface: ioctl numbers and formats (ABI).
6
*
7
* the numbers are the ones of the Open Sound System on Linux, so ported
8
* programs find the names they know. the kernel has a copy in
9
* src/kernel/audio/soundcard.h; the two must stay the same.
10
*/
11
12
#include <
stdint.h
>
13
14
// sample formats
15
#define AFMT_U8 0x00000008
16
#define AFMT_S16_LE 0x00000010
17
#define AFMT_S16_BE 0x00000020
// not played: SETFMT gives AFMT_S16_LE back
18
19
// /dev/dsp
20
#define SNDCTL_DSP_RESET 0x00005000u
// stop and drop the queued sound
21
#define SNDCTL_DSP_SYNC 0x00005001u
// wait until the queued sound has played
22
#define SNDCTL_DSP_SPEED 0xC0045002u
// int: the sample rate (the device's nearest back)
23
#define SNDCTL_DSP_STEREO 0xC0045003u
// int: 0 mono, 1 stereo
24
#define SNDCTL_DSP_GETBLKSIZE 0xC0045004u
// int: the fragment size
25
#define SNDCTL_DSP_SETFMT 0xC0045005u
// int: AFMT_ (the format in use back)
26
#define SNDCTL_DSP_CHANNELS 0xC0045006u
// int: 1 or 2
27
#define SNDCTL_DSP_SETFRAGMENT 0xC004500Au
// int: the fragments wanted (the device keeps its own)
28
#define SNDCTL_DSP_GETFMTS 0x8004500Bu
// int: the formats the device takes
29
#define SNDCTL_DSP_GETOSPACE 0x8010500Cu
// audio_buf_info: free space
30
#define SNDCTL_DSP_GETISPACE 0x8010500Du
// audio_buf_info: recording (none: EINVAL)
31
#define SNDCTL_DSP_GETODELAY 0x80045017u
// int: bytes queued, not played yet
32
33
/**
34
* the free space for SNDCTL_DSP_GETOSPACE, in bytes of the caller's format.
35
*/
36
typedef
struct
37
{
38
int32_t
fragments
;
// whole free fragments
39
int32_t
fragstotal
;
// fragments in the buffer
40
int32_t
fragsize
;
// bytes per fragment
41
int32_t
bytes
;
// free bytes
42
}
audio_buf_info
;
// NOLINT(readability-identifier-naming): the OSS name
43
44
// /dev/mixer: a volume is left | right << 8, each 0 to 100
45
#define SOUND_MIXER_READ_VOLUME 0x80044D00u
46
#define SOUND_MIXER_WRITE_VOLUME 0xC0044D00u
47
#define SOUND_MIXER_READ_DEVMASK 0x80044DFEu
48
#define SOUND_MASK_VOLUME 0x00000001
stdint.h
integer types of fixed width.
int32_t
int int32_t
Definition
stdint.h:14
audio_buf_info
the free space for SNDCTL_DSP_GETOSPACE, in bytes of the caller's format.
Definition
soundcard.h:37
audio_buf_info::fragsize
int32_t fragsize
Definition
soundcard.h:40
audio_buf_info::fragstotal
int32_t fragstotal
Definition
soundcard.h:39
audio_buf_info::bytes
int32_t bytes
Definition
soundcard.h:41
audio_buf_info::fragments
int32_t fragments
Definition
soundcard.h:38
src
libc
include
sys
soundcard.h
Generated by
1.18.0