|
ginnOS
The reference: libc, the libraries and the kernel
|
the sound output core: /dev/dsp, /dev/mixer and the driver interface. More...
#include "common/stdint.h"Go to the source code of this file.
Data Structures | |
| struct | audio_ops_t |
| struct | audio_device |
| struct | audio_status_t |
| the state for /proc/audio. More... | |
Typedefs | |
| typedef struct audio_device | audio_device_t |
Functions | |
| bool | audio_register (audio_device_t *dev) |
| register the sound device (one, the first one wins) and make /dev/dsp and /dev/mixer. | |
| uint32_t | audio_pull (audio_device_t *dev, void *dst, uint32_t bytes) |
| fill a DMA period from the ring buffer, with silence after the data. | |
| void | audio_status (audio_status_t *status) |
| void | audio_mix_add (int32_t *sums, const uint8_t *frames, uint32_t samples) |
| add 16-bit little-endian samples to sums (the mixing of the streams). | |
| void | audio_mix_out (uint8_t *out, const int32_t *sums, uint32_t samples) |
| write sums as 16-bit little-endian samples, clipped to the 16-bit range. | |
the sound output core: /dev/dsp, /dev/mixer and the driver interface.
a program writes PCM to /dev/dsp. the core converts it to the device format (signed 16-bit little-endian stereo, at the device rate) and keeps it in a ring buffer. the driver plays from DMA buffers split in periods; when the device has played a period, the driver interrupt calls audio_pull to fill it again. if the ring is empty, the period is filled with silence and counted as an underrun (/proc/audio).
several programs can open /dev/dsp at once (up to 8): each has its own ring, and the core adds them together for the device.
| typedef struct audio_device audio_device_t |
| bool audio_register | ( | audio_device_t * | dev | ) |
register the sound device (one, the first one wins) and make /dev/dsp and /dev/mixer.
| uint32_t audio_pull | ( | audio_device_t * | dev, |
| void * | dst, | ||
| uint32_t | bytes ) |
fill a DMA period from the ring buffer, with silence after the data.
call it from the driver interrupt (or from start).
| dst | the period. |
| bytes | its size (a multiple of 4). |
| void audio_status | ( | audio_status_t * | status | ) |
add 16-bit little-endian samples to sums (the mixing of the streams).