mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Some cleaning renames. Prepared API for new plugins
This commit is contained in:
parent
df35e8457a
commit
3733bbdcff
12 changed files with 164 additions and 164 deletions
|
|
@ -40,8 +40,8 @@ typedef struct {
|
|||
snd_pcm_channel_info_t channel_info;
|
||||
snd_pcm_channel_params_t channel_params;
|
||||
snd_pcm_channel_setup_t channel_setup;
|
||||
off_t frame_data;
|
||||
int frame_io;
|
||||
off_t appl_ptr;
|
||||
int hw_ptr;
|
||||
int link;
|
||||
snd_xfer_t read;
|
||||
snd_xfer_t write;
|
||||
|
|
|
|||
|
|
@ -125,8 +125,8 @@ int snd_pcm_drain(snd_pcm_t *handle);
|
|||
int snd_pcm_flush(snd_pcm_t *handle);
|
||||
int snd_pcm_pause(snd_pcm_t *handle, int enable);
|
||||
int snd_pcm_state(snd_pcm_t *handle);
|
||||
ssize_t snd_pcm_frame_io(snd_pcm_t *handle, int update);
|
||||
ssize_t snd_pcm_frame_data(snd_pcm_t *handle, off_t offset);
|
||||
ssize_t snd_pcm_hw_ptr(snd_pcm_t *handle, int update);
|
||||
ssize_t snd_pcm_appl_ptr(snd_pcm_t *handle, off_t offset);
|
||||
ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size);
|
||||
ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size);
|
||||
ssize_t snd_pcm_writev(snd_pcm_t *handle, const struct iovec *vector, unsigned long count);
|
||||
|
|
@ -142,8 +142,8 @@ int snd_pcm_channels_mask(snd_pcm_t *handle, bitset_t *client_vmask);
|
|||
int snd_pcm_mmap(snd_pcm_t *handle, snd_pcm_mmap_status_t **status, snd_pcm_mmap_control_t **control, void **buffer);
|
||||
int snd_pcm_munmap(snd_pcm_t *handle);
|
||||
int snd_pcm_mmap_state(snd_pcm_t *handle);
|
||||
ssize_t snd_pcm_mmap_frame_io(snd_pcm_t *handle);
|
||||
ssize_t snd_pcm_mmap_frame_data(snd_pcm_t *handle, off_t offset);
|
||||
ssize_t snd_pcm_mmap_hw_ptr(snd_pcm_t *handle);
|
||||
ssize_t snd_pcm_mmap_appl_ptr(snd_pcm_t *handle, off_t offset);
|
||||
int snd_pcm_mmap_status(snd_pcm_t *handle, snd_pcm_mmap_status_t **status);
|
||||
int snd_pcm_mmap_control(snd_pcm_t *handle, snd_pcm_mmap_control_t **control);
|
||||
int snd_pcm_mmap_data(snd_pcm_t *handle, void **buffer);
|
||||
|
|
@ -155,9 +155,9 @@ ssize_t snd_pcm_mmap_write(snd_pcm_t *handle, const void *buffer, size_t size);
|
|||
ssize_t snd_pcm_mmap_read(snd_pcm_t *handle, void *buffer, size_t size);
|
||||
ssize_t snd_pcm_mmap_writev(snd_pcm_t *handle, const struct iovec *vector, unsigned long count);
|
||||
ssize_t snd_pcm_mmap_readv(snd_pcm_t *handle, const struct iovec *vector, unsigned long count);
|
||||
int snd_pcm_mmap_frames_avail(snd_pcm_t *handle, ssize_t *frames);
|
||||
ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *handle, size_t frames);
|
||||
ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *handle);
|
||||
int snd_pcm_mmap_avail(snd_pcm_t *handle, ssize_t *frames);
|
||||
ssize_t snd_pcm_mmap_xfer(snd_pcm_t *handle, size_t frames);
|
||||
ssize_t snd_pcm_mmap_offset(snd_pcm_t *handle);
|
||||
ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *channels, size_t frames);
|
||||
ssize_t snd_pcm_mmap_write_frames(snd_pcm_t *handle, const void *buffer, size_t frames);
|
||||
ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *channels, size_t frames);
|
||||
|
|
|
|||
|
|
@ -368,8 +368,8 @@ int pcm_shm_cmd(client_t *client)
|
|||
case SND_PCM_IOCTL_STATUS:
|
||||
ctrl->result = snd_pcm_status(pcm, &ctrl->u.status);
|
||||
break;
|
||||
case SND_PCM_IOCTL_FRAME_IO:
|
||||
ctrl->result = snd_pcm_frame_io(pcm, ctrl->u.frame_io);
|
||||
case SND_PCM_IOCTL_HW_PTR:
|
||||
ctrl->result = snd_pcm_hw_ptr(pcm, ctrl->u.hw_ptr);
|
||||
break;
|
||||
case SND_PCM_IOCTL_PREPARE:
|
||||
ctrl->result = snd_pcm_prepare(pcm);
|
||||
|
|
@ -475,8 +475,8 @@ int pcm_shm_cmd(client_t *client)
|
|||
ctrl->result = snd_pcm_readv(pcm, vector, ctrl->u.readv.count);
|
||||
break;
|
||||
}
|
||||
case SND_PCM_IOCTL_FRAME_DATA:
|
||||
ctrl->result = snd_pcm_frame_data(pcm, ctrl->u.frame_data);
|
||||
case SND_PCM_IOCTL_APPL_PTR:
|
||||
ctrl->result = snd_pcm_appl_ptr(pcm, ctrl->u.appl_ptr);
|
||||
break;
|
||||
case SND_PCM_IOCTL_LINK:
|
||||
{
|
||||
|
|
|
|||
|
|
@ -152,13 +152,13 @@ int snd_pcm_state(snd_pcm_t *handle)
|
|||
return handle->fast_ops->state(handle->fast_op_arg);
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_frame_io(snd_pcm_t *handle, int update)
|
||||
ssize_t snd_pcm_hw_ptr(snd_pcm_t *handle, int update)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->valid_setup);
|
||||
if (handle->mmap_status && !update)
|
||||
return handle->mmap_status->frame_io;
|
||||
return handle->fast_ops->frame_io(handle->fast_op_arg, update);
|
||||
return handle->mmap_status->hw_ptr;
|
||||
return handle->fast_ops->hw_ptr(handle->fast_op_arg, update);
|
||||
}
|
||||
|
||||
int snd_pcm_prepare(snd_pcm_t *handle)
|
||||
|
|
@ -192,15 +192,15 @@ int snd_pcm_pause(snd_pcm_t *handle, int enable)
|
|||
}
|
||||
|
||||
|
||||
ssize_t snd_pcm_frame_data(snd_pcm_t *handle, off_t offset)
|
||||
ssize_t snd_pcm_appl_ptr(snd_pcm_t *handle, off_t offset)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->valid_setup);
|
||||
if (handle->mmap_control) {
|
||||
if (offset == 0)
|
||||
return handle->mmap_control->frame_data;
|
||||
return handle->mmap_control->appl_ptr;
|
||||
}
|
||||
return handle->fast_ops->frame_data(handle->fast_op_arg, offset);
|
||||
return handle->fast_ops->appl_ptr(handle->fast_op_arg, offset);
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size)
|
||||
|
|
@ -208,7 +208,7 @@ ssize_t snd_pcm_write(snd_pcm_t *handle, const void *buffer, size_t size)
|
|||
assert(handle);
|
||||
assert(size == 0 || buffer);
|
||||
assert(handle->valid_setup);
|
||||
assert(size % handle->setup.frames_align == 0);
|
||||
assert(size % handle->setup.align == 0);
|
||||
return handle->fast_ops->write(handle->fast_op_arg, 0, buffer, size);
|
||||
}
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ ssize_t snd_pcm_read(snd_pcm_t *handle, void *buffer, size_t size)
|
|||
assert(handle);
|
||||
assert(size == 0 || buffer);
|
||||
assert(handle->valid_setup);
|
||||
assert(size % handle->setup.frames_align == 0);
|
||||
assert(size % handle->setup.align == 0);
|
||||
return handle->fast_ops->read(handle->fast_op_arg, 0, buffer, size);
|
||||
}
|
||||
|
||||
|
|
@ -398,13 +398,13 @@ int snd_pcm_dump_setup(snd_pcm_t *handle, FILE *fp)
|
|||
fprintf(fp, "buffer_size: %ld\n", (long)setup->buffer_size);
|
||||
fprintf(fp, "frag_size: %ld\n", (long)setup->frag_size);
|
||||
fprintf(fp, "frags: %ld\n", (long)setup->frags);
|
||||
fprintf(fp, "frame_boundary: %ld\n", (long)setup->frame_boundary);
|
||||
fprintf(fp, "boundary: %ld\n", (long)setup->boundary);
|
||||
fprintf(fp, "msbits_per_sample: %d\n", setup->msbits_per_sample);
|
||||
fprintf(fp, "frames_min: %ld\n", (long)setup->frames_min);
|
||||
fprintf(fp, "frames_align: %ld\n", (long)setup->frames_align);
|
||||
fprintf(fp, "frames_xrun_max: %ld\n", (long)setup->frames_xrun_max);
|
||||
fprintf(fp, "avail_min: %ld\n", (long)setup->avail_min);
|
||||
fprintf(fp, "align: %ld\n", (long)setup->align);
|
||||
fprintf(fp, "xrun_max: %ld\n", (long)setup->xrun_max);
|
||||
fprintf(fp, "fill_mode: %s\n", assoc(setup->fill_mode, fills));
|
||||
fprintf(fp, "frames_fill_max: %ld\n", (long)setup->frames_fill_max);
|
||||
fprintf(fp, "fill_max: %ld\n", (long)setup->fill_max);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -298,13 +298,13 @@ static int snd_pcm_client_shm_state(snd_pcm_t *pcm)
|
|||
return status.state;
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_client_shm_frame_io(snd_pcm_t *pcm, int update)
|
||||
static ssize_t snd_pcm_client_shm_hw_ptr(snd_pcm_t *pcm, int update)
|
||||
{
|
||||
snd_pcm_client_t *client = pcm->private;
|
||||
snd_pcm_client_shm_t *ctrl = client->u.shm.ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SND_PCM_IOCTL_FRAME_IO;
|
||||
ctrl->u.frame_io = update;
|
||||
ctrl->cmd = SND_PCM_IOCTL_HW_PTR;
|
||||
ctrl->u.hw_ptr = update;
|
||||
err = snd_pcm_client_shm_action(pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -372,13 +372,13 @@ static int snd_pcm_client_shm_pause(snd_pcm_t *pcm, int enable)
|
|||
return ctrl->result;
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_client_shm_frame_data(snd_pcm_t *pcm, off_t offset)
|
||||
static ssize_t snd_pcm_client_shm_appl_ptr(snd_pcm_t *pcm, off_t offset)
|
||||
{
|
||||
snd_pcm_client_t *client = pcm->private;
|
||||
snd_pcm_client_shm_t *ctrl = client->u.shm.ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SND_PCM_IOCTL_FRAME_DATA;
|
||||
ctrl->u.frame_data = offset;
|
||||
ctrl->cmd = SND_PCM_IOCTL_APPL_PTR;
|
||||
ctrl->u.appl_ptr = offset;
|
||||
err = snd_pcm_client_shm_action(pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -654,14 +654,14 @@ struct snd_pcm_fast_ops snd_pcm_client_fast_ops = {
|
|||
channel_params: snd_pcm_client_shm_channel_params,
|
||||
channel_setup: snd_pcm_client_shm_channel_setup,
|
||||
status: snd_pcm_client_shm_status,
|
||||
frame_io: snd_pcm_client_shm_frame_io,
|
||||
hw_ptr: snd_pcm_client_shm_hw_ptr,
|
||||
state: snd_pcm_client_shm_state,
|
||||
prepare: snd_pcm_client_shm_prepare,
|
||||
go: snd_pcm_client_shm_go,
|
||||
drain: snd_pcm_client_shm_drain,
|
||||
flush: snd_pcm_client_shm_flush,
|
||||
pause: snd_pcm_client_shm_pause,
|
||||
frame_data: snd_pcm_client_shm_frame_data,
|
||||
appl_ptr: snd_pcm_client_shm_appl_ptr,
|
||||
write: snd_pcm_client_shm_write,
|
||||
writev: snd_pcm_client_shm_writev,
|
||||
read: snd_pcm_client_shm_read,
|
||||
|
|
|
|||
|
|
@ -150,11 +150,11 @@ static int snd_pcm_hw_state(snd_pcm_t *pcm)
|
|||
return status.state;
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_hw_frame_io(snd_pcm_t *pcm, int update ATTRIBUTE_UNUSED)
|
||||
static ssize_t snd_pcm_hw_hw_ptr(snd_pcm_t *pcm, int update ATTRIBUTE_UNUSED)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
int fd = hw->fd;
|
||||
ssize_t pos = ioctl(fd, SND_PCM_IOCTL_FRAME_IO);
|
||||
ssize_t pos = ioctl(fd, SND_PCM_IOCTL_HW_PTR);
|
||||
if (pos < 0)
|
||||
return -errno;
|
||||
return pos;
|
||||
|
|
@ -205,14 +205,14 @@ static int snd_pcm_hw_pause(snd_pcm_t *pcm, int enable)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_hw_frame_data(snd_pcm_t *pcm, off_t offset)
|
||||
static ssize_t snd_pcm_hw_appl_ptr(snd_pcm_t *pcm, off_t offset)
|
||||
{
|
||||
ssize_t result;
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
int fd = hw->fd;
|
||||
if (pcm->mmap_status && pcm->mmap_control)
|
||||
return snd_pcm_mmap_frame_data(pcm, offset);
|
||||
result = ioctl(fd, SND_PCM_IOCTL_FRAME_DATA, offset);
|
||||
return snd_pcm_mmap_appl_ptr(pcm, offset);
|
||||
result = ioctl(fd, SND_PCM_IOCTL_APPL_PTR, offset);
|
||||
if (result < 0)
|
||||
return -errno;
|
||||
return result;
|
||||
|
|
@ -392,14 +392,14 @@ struct snd_pcm_fast_ops snd_pcm_hw_fast_ops = {
|
|||
channel_params: snd_pcm_hw_channel_params,
|
||||
channel_setup: snd_pcm_hw_channel_setup,
|
||||
status: snd_pcm_hw_status,
|
||||
frame_io: snd_pcm_hw_frame_io,
|
||||
hw_ptr: snd_pcm_hw_hw_ptr,
|
||||
state: snd_pcm_hw_state,
|
||||
prepare: snd_pcm_hw_prepare,
|
||||
go: snd_pcm_hw_go,
|
||||
drain: snd_pcm_hw_drain,
|
||||
flush: snd_pcm_hw_flush,
|
||||
pause: snd_pcm_hw_pause,
|
||||
frame_data: snd_pcm_hw_frame_data,
|
||||
appl_ptr: snd_pcm_hw_appl_ptr,
|
||||
write: snd_pcm_hw_write,
|
||||
writev: snd_pcm_hw_writev,
|
||||
read: snd_pcm_hw_read,
|
||||
|
|
|
|||
|
|
@ -43,8 +43,8 @@ struct snd_pcm_fast_ops {
|
|||
int (*flush)(snd_pcm_t *pcm);
|
||||
int (*pause)(snd_pcm_t *pcm, int enable);
|
||||
int (*state)(snd_pcm_t *pcm);
|
||||
ssize_t (*frame_io)(snd_pcm_t *pcm, int update);
|
||||
ssize_t (*frame_data)(snd_pcm_t *pcm, off_t offset);
|
||||
ssize_t (*hw_ptr)(snd_pcm_t *pcm, int update);
|
||||
ssize_t (*appl_ptr)(snd_pcm_t *pcm, off_t offset);
|
||||
ssize_t (*write)(snd_pcm_t *pcm, snd_timestamp_t *tstamp, const void *buffer, size_t size);
|
||||
ssize_t (*writev)(snd_pcm_t *pcm, snd_timestamp_t *tstamp, const struct iovec *vector, unsigned long count);
|
||||
ssize_t (*read)(snd_pcm_t *pcm, snd_timestamp_t *tstamp, void *buffer, size_t size);
|
||||
|
|
@ -131,22 +131,22 @@ int conv_index(int src_format, int dst_format);
|
|||
#define pdprintf( args... ) { ; }
|
||||
#endif
|
||||
|
||||
static inline size_t snd_pcm_mmap_playback_frames_avail(snd_pcm_t *str)
|
||||
static inline size_t snd_pcm_mmap_playback_avail(snd_pcm_t *str)
|
||||
{
|
||||
ssize_t frames_avail;
|
||||
frames_avail = str->mmap_status->frame_io + str->setup.buffer_size - str->mmap_control->frame_data;
|
||||
if (frames_avail < 0)
|
||||
frames_avail += str->setup.frame_boundary;
|
||||
return frames_avail;
|
||||
ssize_t avail;
|
||||
avail = str->mmap_status->hw_ptr + str->setup.buffer_size - str->mmap_control->appl_ptr;
|
||||
if (avail < 0)
|
||||
avail += str->setup.boundary;
|
||||
return avail;
|
||||
}
|
||||
|
||||
static inline size_t snd_pcm_mmap_capture_frames_avail(snd_pcm_t *str)
|
||||
static inline size_t snd_pcm_mmap_capture_avail(snd_pcm_t *str)
|
||||
{
|
||||
ssize_t frames_avail;
|
||||
frames_avail = str->mmap_status->frame_io - str->mmap_control->frame_data;
|
||||
if (frames_avail < 0)
|
||||
frames_avail += str->setup.frame_boundary;
|
||||
return frames_avail;
|
||||
ssize_t avail;
|
||||
avail = str->mmap_status->hw_ptr - str->mmap_control->appl_ptr;
|
||||
if (avail < 0)
|
||||
avail += str->setup.boundary;
|
||||
return avail;
|
||||
}
|
||||
|
||||
#define snd_pcm_plug_stream(plug) ((plug)->handle->stream)
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@
|
|||
#include <sys/uio.h>
|
||||
#include "pcm_local.h"
|
||||
|
||||
int snd_pcm_frames_avail(snd_pcm_t *handle, ssize_t *frames)
|
||||
int snd_pcm_avail(snd_pcm_t *handle, ssize_t *frames)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->mmap_status && handle->mmap_control);
|
||||
if (handle->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
*frames = snd_pcm_mmap_playback_frames_avail(handle);
|
||||
*frames = snd_pcm_mmap_playback_avail(handle);
|
||||
else
|
||||
*frames = snd_pcm_mmap_capture_frames_avail(handle);
|
||||
*frames = snd_pcm_mmap_capture_avail(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -41,7 +41,7 @@ static int snd_pcm_mmap_playback_ready(snd_pcm_t *handle)
|
|||
{
|
||||
if (handle->mmap_status->state == SND_PCM_STATE_XRUN)
|
||||
return -EPIPE;
|
||||
return snd_pcm_mmap_playback_frames_avail(handle) >= handle->setup.frames_min;
|
||||
return snd_pcm_mmap_playback_avail(handle) >= handle->setup.avail_min;
|
||||
}
|
||||
|
||||
static int snd_pcm_mmap_capture_ready(snd_pcm_t *handle)
|
||||
|
|
@ -52,7 +52,7 @@ static int snd_pcm_mmap_capture_ready(snd_pcm_t *handle)
|
|||
if (handle->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
|
||||
return -EPIPE;
|
||||
}
|
||||
if (snd_pcm_mmap_capture_frames_avail(handle) >= handle->setup.frames_min)
|
||||
if (snd_pcm_mmap_capture_avail(handle) >= handle->setup.avail_min)
|
||||
return 1;
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -69,47 +69,47 @@ int snd_pcm_mmap_ready(snd_pcm_t *handle)
|
|||
}
|
||||
}
|
||||
|
||||
static size_t snd_pcm_mmap_playback_frames_xfer(snd_pcm_t *handle, size_t frames)
|
||||
static size_t snd_pcm_mmap_playback_xfer(snd_pcm_t *handle, size_t frames)
|
||||
{
|
||||
snd_pcm_mmap_control_t *control = handle->mmap_control;
|
||||
size_t frames_cont;
|
||||
size_t frames_avail = snd_pcm_mmap_playback_frames_avail(handle);
|
||||
if (frames_avail < frames)
|
||||
frames = frames_avail;
|
||||
frames_cont = handle->setup.buffer_size - control->frame_data % handle->setup.buffer_size;
|
||||
if (frames_cont < frames)
|
||||
frames = frames_cont;
|
||||
size_t cont;
|
||||
size_t avail = snd_pcm_mmap_playback_avail(handle);
|
||||
if (avail < frames)
|
||||
frames = avail;
|
||||
cont = handle->setup.buffer_size - control->appl_ptr % handle->setup.buffer_size;
|
||||
if (cont < frames)
|
||||
frames = cont;
|
||||
return frames;
|
||||
}
|
||||
|
||||
static size_t snd_pcm_mmap_capture_frames_xfer(snd_pcm_t *handle, size_t frames)
|
||||
static size_t snd_pcm_mmap_capture_xfer(snd_pcm_t *handle, size_t frames)
|
||||
{
|
||||
snd_pcm_mmap_control_t *control = handle->mmap_control;
|
||||
size_t frames_cont;
|
||||
size_t frames_avail = snd_pcm_mmap_capture_frames_avail(handle);
|
||||
if (frames_avail < frames)
|
||||
frames = frames_avail;
|
||||
frames_cont = handle->setup.buffer_size - control->frame_data % handle->setup.buffer_size;
|
||||
if (frames_cont < frames)
|
||||
frames = frames_cont;
|
||||
size_t cont;
|
||||
size_t avail = snd_pcm_mmap_capture_avail(handle);
|
||||
if (avail < frames)
|
||||
frames = avail;
|
||||
cont = handle->setup.buffer_size - control->appl_ptr % handle->setup.buffer_size;
|
||||
if (cont < frames)
|
||||
frames = cont;
|
||||
return frames;
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_mmap_frames_xfer(snd_pcm_t *handle, size_t frames)
|
||||
ssize_t snd_pcm_mmap_xfer(snd_pcm_t *handle, size_t frames)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->mmap_status && handle->mmap_control);
|
||||
if (handle->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
return snd_pcm_mmap_playback_frames_xfer(handle, frames);
|
||||
return snd_pcm_mmap_playback_xfer(handle, frames);
|
||||
else
|
||||
return snd_pcm_mmap_capture_frames_xfer(handle, frames);
|
||||
return snd_pcm_mmap_capture_xfer(handle, frames);
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_mmap_frames_offset(snd_pcm_t *handle)
|
||||
ssize_t snd_pcm_mmap_offset(snd_pcm_t *handle)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->mmap_control);
|
||||
return handle->mmap_control->frame_data % handle->setup.buffer_size;
|
||||
return handle->mmap_control->appl_ptr % handle->setup.buffer_size;
|
||||
}
|
||||
|
||||
int snd_pcm_mmap_state(snd_pcm_t *handle)
|
||||
|
|
@ -119,26 +119,26 @@ int snd_pcm_mmap_state(snd_pcm_t *handle)
|
|||
return handle->mmap_status->state;
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_mmap_frame_io(snd_pcm_t *handle)
|
||||
ssize_t snd_pcm_mmap_hw_ptr(snd_pcm_t *handle)
|
||||
{
|
||||
assert(handle);
|
||||
assert(handle->mmap_status);
|
||||
return handle->mmap_status->frame_io;
|
||||
return handle->mmap_status->hw_ptr;
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_mmap_frame_data(snd_pcm_t *handle, off_t offset)
|
||||
ssize_t snd_pcm_mmap_appl_ptr(snd_pcm_t *handle, off_t offset)
|
||||
{
|
||||
ssize_t frame_data;
|
||||
ssize_t appl_ptr;
|
||||
assert(handle);
|
||||
assert(handle->mmap_status && handle->mmap_control);
|
||||
assert(offset == 0 || handle->type == SND_PCM_TYPE_HW);
|
||||
frame_data = handle->mmap_control->frame_data;
|
||||
appl_ptr = handle->mmap_control->appl_ptr;
|
||||
if (offset == 0)
|
||||
return frame_data;
|
||||
return appl_ptr;
|
||||
switch (handle->mmap_status->state) {
|
||||
case SND_PCM_STATE_RUNNING:
|
||||
if (handle->setup.mode == SND_PCM_MODE_FRAME)
|
||||
snd_pcm_frame_io(handle, 1);
|
||||
snd_pcm_hw_ptr(handle, 1);
|
||||
break;
|
||||
case SND_PCM_STATE_READY:
|
||||
case SND_PCM_STATE_NOTREADY:
|
||||
|
|
@ -148,25 +148,25 @@ ssize_t snd_pcm_mmap_frame_data(snd_pcm_t *handle, off_t offset)
|
|||
if (offset < -(ssize_t)handle->setup.buffer_size)
|
||||
offset = -(ssize_t)handle->setup.buffer_size;
|
||||
else
|
||||
offset -= offset % handle->setup.frames_align;
|
||||
frame_data += offset;
|
||||
if (frame_data < 0)
|
||||
frame_data += handle->setup.frame_boundary;
|
||||
offset -= offset % handle->setup.align;
|
||||
appl_ptr += offset;
|
||||
if (appl_ptr < 0)
|
||||
appl_ptr += handle->setup.boundary;
|
||||
} else {
|
||||
size_t frames_avail;
|
||||
size_t avail;
|
||||
if (handle->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
frames_avail = snd_pcm_mmap_playback_frames_avail(handle);
|
||||
avail = snd_pcm_mmap_playback_avail(handle);
|
||||
else
|
||||
frames_avail = snd_pcm_mmap_capture_frames_avail(handle);
|
||||
if ((size_t)offset > frames_avail)
|
||||
offset = frames_avail;
|
||||
offset -= offset % handle->setup.frames_align;
|
||||
frame_data += offset;
|
||||
if ((size_t)frame_data >= handle->setup.frame_boundary)
|
||||
frame_data -= handle->setup.frame_boundary;
|
||||
avail = snd_pcm_mmap_capture_avail(handle);
|
||||
if ((size_t)offset > avail)
|
||||
offset = avail;
|
||||
offset -= offset % handle->setup.align;
|
||||
appl_ptr += offset;
|
||||
if ((size_t)appl_ptr >= handle->setup.boundary)
|
||||
appl_ptr -= handle->setup.boundary;
|
||||
}
|
||||
handle->mmap_control->frame_data = frame_data;
|
||||
return frame_data;
|
||||
handle->mmap_control->appl_ptr = appl_ptr;
|
||||
return appl_ptr;
|
||||
}
|
||||
|
||||
ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *channels, size_t frames)
|
||||
|
|
@ -184,7 +184,7 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *chan
|
|||
} else {
|
||||
if (status->state == SND_PCM_STATE_RUNNING &&
|
||||
handle->mode & SND_PCM_NONBLOCK)
|
||||
snd_pcm_frame_io(handle, 1);
|
||||
snd_pcm_hw_ptr(handle, 1);
|
||||
}
|
||||
while (frames > 0) {
|
||||
ssize_t mmap_offset;
|
||||
|
|
@ -207,13 +207,13 @@ ssize_t snd_pcm_mmap_write_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *chan
|
|||
return result > 0 ? result : -EPIPE;
|
||||
assert(snd_pcm_mmap_playback_ready(handle));
|
||||
}
|
||||
frames1 = snd_pcm_mmap_playback_frames_xfer(handle, frames);
|
||||
frames1 = snd_pcm_mmap_playback_xfer(handle, frames);
|
||||
assert(frames1 > 0);
|
||||
mmap_offset = snd_pcm_mmap_frames_offset(handle);
|
||||
mmap_offset = snd_pcm_mmap_offset(handle);
|
||||
snd_pcm_areas_copy(channels, offset, handle->channels, mmap_offset, handle->setup.format.channels, frames1, handle->setup.format.format);
|
||||
if (status->state == SND_PCM_STATE_XRUN)
|
||||
return result > 0 ? result : -EPIPE;
|
||||
snd_pcm_frame_data(handle, frames1);
|
||||
snd_pcm_appl_ptr(handle, frames1);
|
||||
frames -= frames1;
|
||||
offset += frames1;
|
||||
result += frames1;
|
||||
|
|
@ -316,7 +316,7 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *chann
|
|||
} else {
|
||||
if (status->state == SND_PCM_STATE_RUNNING &&
|
||||
handle->mode & SND_PCM_NONBLOCK)
|
||||
snd_pcm_frame_io(handle, 1);
|
||||
snd_pcm_hw_ptr(handle, 1);
|
||||
}
|
||||
if (status->state == SND_PCM_STATE_PREPARED &&
|
||||
handle->setup.start_mode == SND_PCM_START_DATA) {
|
||||
|
|
@ -345,14 +345,14 @@ ssize_t snd_pcm_mmap_read_areas(snd_pcm_t *handle, snd_pcm_channel_area_t *chann
|
|||
return result > 0 ? result : -EPIPE;
|
||||
assert(snd_pcm_mmap_capture_ready(handle));
|
||||
}
|
||||
frames1 = snd_pcm_mmap_capture_frames_xfer(handle, frames);
|
||||
frames1 = snd_pcm_mmap_capture_xfer(handle, frames);
|
||||
assert(frames1 > 0);
|
||||
mmap_offset = snd_pcm_mmap_frames_offset(handle);
|
||||
mmap_offset = snd_pcm_mmap_offset(handle);
|
||||
snd_pcm_areas_copy(handle->channels, mmap_offset, channels, offset, handle->setup.format.channels, frames1, handle->setup.format.format);
|
||||
if (status->state == SND_PCM_STATE_XRUN &&
|
||||
handle->setup.xrun_mode == SND_PCM_XRUN_DRAIN)
|
||||
return result > 0 ? result : -EPIPE;
|
||||
snd_pcm_frame_data(handle, frames1);
|
||||
snd_pcm_appl_ptr(handle, frames1);
|
||||
frames -= frames1;
|
||||
offset += frames1;
|
||||
result += frames1;
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ static int snd_pcm_multi_params(snd_pcm_t *pcm, snd_pcm_params_t *params)
|
|||
p.format.interleave = 1;
|
||||
p.format.channels = multi->slaves[i].channels_total;
|
||||
#if 1
|
||||
p.frames_xrun_max = ~0;
|
||||
p.xrun_max = ~0;
|
||||
#endif
|
||||
err = snd_pcm_params(handle, &p);
|
||||
if (err < 0)
|
||||
|
|
@ -211,7 +211,7 @@ static int snd_pcm_multi_setup(snd_pcm_t *pcm, snd_pcm_setup_t *setup)
|
|||
return err;
|
||||
if (setup->format.rate != s.format.rate)
|
||||
return -EINVAL;
|
||||
if (setup->frames_align % s.frames_align != 0)
|
||||
if (setup->align % s.align != 0)
|
||||
return -EINVAL;
|
||||
}
|
||||
setup->format.interleave = multi->interleave;
|
||||
|
|
@ -275,11 +275,11 @@ static int snd_pcm_multi_state(snd_pcm_t *pcm)
|
|||
return snd_pcm_state(handle);
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_multi_frame_io(snd_pcm_t *pcm, int update)
|
||||
static ssize_t snd_pcm_multi_hw_ptr(snd_pcm_t *pcm, int update)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
snd_pcm_t *handle = multi->slaves[0].handle;
|
||||
return snd_pcm_frame_io(handle, update);
|
||||
return snd_pcm_hw_ptr(handle, update);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_prepare(snd_pcm_t *pcm)
|
||||
|
|
@ -367,25 +367,25 @@ static int snd_pcm_multi_channel_setup(snd_pcm_t *pcm, snd_pcm_channel_setup_t *
|
|||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_multi_frame_data(snd_pcm_t *pcm, off_t offset)
|
||||
static ssize_t snd_pcm_multi_appl_ptr(snd_pcm_t *pcm, off_t offset)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
ssize_t pos, newpos;
|
||||
unsigned int i;
|
||||
snd_pcm_t *handle_0 = multi->slaves[0].handle;
|
||||
|
||||
pos = snd_pcm_frame_data(handle_0, 0);
|
||||
newpos = snd_pcm_frame_data(handle_0, offset);
|
||||
pos = snd_pcm_appl_ptr(handle_0, 0);
|
||||
newpos = snd_pcm_appl_ptr(handle_0, offset);
|
||||
if (newpos < 0)
|
||||
return newpos;
|
||||
offset = newpos - pos;
|
||||
if (offset < 0)
|
||||
offset += handle_0->setup.frame_boundary;
|
||||
offset += handle_0->setup.boundary;
|
||||
|
||||
for (i = 1; i < multi->slaves_count; ++i) {
|
||||
snd_pcm_t *handle_i = multi->slaves[i].handle;
|
||||
ssize_t newpos_i;
|
||||
newpos_i = snd_pcm_frame_data(handle_i, offset);
|
||||
newpos_i = snd_pcm_appl_ptr(handle_i, offset);
|
||||
if (newpos_i < 0)
|
||||
return newpos_i;
|
||||
if (newpos_i != newpos)
|
||||
|
|
@ -578,7 +578,7 @@ static int snd_pcm_multi_mmap_control(snd_pcm_t *pcm, snd_pcm_mmap_control_t **c
|
|||
unsigned int i;
|
||||
for (i = 1; i < multi->slaves_count; ++i) {
|
||||
snd_pcm_setup_t *setup = &multi->slaves[i].handle->setup;
|
||||
/* Don't permit mmap if frame_data's have
|
||||
/* Don't permit mmap if appl_ptr's have
|
||||
different ranges */
|
||||
if (setup->buffer_size != setup_0->buffer_size)
|
||||
return -EBADFD;
|
||||
|
|
@ -737,7 +737,7 @@ struct snd_pcm_fast_ops snd_pcm_multi_fast_ops = {
|
|||
channel_params: snd_pcm_multi_channel_params,
|
||||
channel_setup: snd_pcm_multi_channel_setup,
|
||||
status: snd_pcm_multi_status,
|
||||
frame_io: snd_pcm_multi_frame_io,
|
||||
hw_ptr: snd_pcm_multi_hw_ptr,
|
||||
state: snd_pcm_multi_state,
|
||||
prepare: snd_pcm_multi_prepare,
|
||||
go: snd_pcm_multi_go,
|
||||
|
|
@ -748,7 +748,7 @@ struct snd_pcm_fast_ops snd_pcm_multi_fast_ops = {
|
|||
writev: snd_pcm_multi_writev,
|
||||
read: snd_pcm_multi_read,
|
||||
readv: snd_pcm_multi_readv,
|
||||
frame_data: snd_pcm_multi_frame_data,
|
||||
appl_ptr: snd_pcm_multi_appl_ptr,
|
||||
mmap_status: snd_pcm_multi_mmap_status,
|
||||
mmap_control: snd_pcm_multi_mmap_control,
|
||||
mmap_data: snd_pcm_multi_mmap_data,
|
||||
|
|
|
|||
|
|
@ -270,14 +270,14 @@ static int snd_pcm_plug_setup(snd_pcm_t *pcm, snd_pcm_setup_t *setup)
|
|||
return err;
|
||||
if (!plug->first)
|
||||
return 0;
|
||||
setup->frame_boundary /= setup->frag_size;
|
||||
setup->boundary /= setup->frag_size;
|
||||
setup->frag_size = snd_pcm_plug_client_size(plug, setup->frag_size);
|
||||
setup->frame_boundary *= setup->frag_size;
|
||||
setup->boundary *= setup->frag_size;
|
||||
setup->buffer_size = setup->frags * setup->frag_size;
|
||||
setup->frames_min = snd_pcm_plug_client_size(plug, setup->frames_min);
|
||||
setup->frames_align = snd_pcm_plug_client_size(plug, setup->frames_align);
|
||||
setup->frames_xrun_max = snd_pcm_plug_client_size(plug, setup->frames_xrun_max);
|
||||
setup->frames_fill_max = snd_pcm_plug_client_size(plug, setup->frames_fill_max);
|
||||
setup->avail_min = snd_pcm_plug_client_size(plug, setup->avail_min);
|
||||
setup->align = snd_pcm_plug_client_size(plug, setup->align);
|
||||
setup->xrun_max = snd_pcm_plug_client_size(plug, setup->xrun_max);
|
||||
setup->fill_max = snd_pcm_plug_client_size(plug, setup->fill_max);
|
||||
setup->mmap_bytes = 0;
|
||||
if (plug->handle->stream == SND_PCM_STREAM_PLAYBACK)
|
||||
setup->format = plug->first->src_format;
|
||||
|
|
@ -301,10 +301,10 @@ static int snd_pcm_plug_status(snd_pcm_t *pcm, snd_pcm_status_t *status)
|
|||
if (err < 0)
|
||||
return err;
|
||||
|
||||
status->frame_io = snd_pcm_plug_client_size(plug, status->frame_io);
|
||||
status->frame_data = snd_pcm_plug_client_size(plug, status->frame_data);
|
||||
status->frames_avail = snd_pcm_plug_client_size(plug, status->frames_avail);
|
||||
status->frames_avail_max = snd_pcm_plug_client_size(plug, status->frames_avail_max);
|
||||
status->hw_ptr = snd_pcm_plug_client_size(plug, status->hw_ptr);
|
||||
status->appl_ptr = snd_pcm_plug_client_size(plug, status->appl_ptr);
|
||||
status->avail = snd_pcm_plug_client_size(plug, status->avail);
|
||||
status->avail_max = snd_pcm_plug_client_size(plug, status->avail_max);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -314,13 +314,13 @@ static int snd_pcm_plug_state(snd_pcm_t *pcm)
|
|||
return snd_pcm_state(plug->slave);
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_plug_frame_io(snd_pcm_t *pcm, int update)
|
||||
static ssize_t snd_pcm_plug_hw_ptr(snd_pcm_t *pcm, int update)
|
||||
{
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
ssize_t frame_io = snd_pcm_frame_io(plug->slave, update);
|
||||
if (frame_io < 0)
|
||||
return frame_io;
|
||||
return snd_pcm_plug_client_size(plug, frame_io);
|
||||
ssize_t hw_ptr = snd_pcm_hw_ptr(plug->slave, update);
|
||||
if (hw_ptr < 0)
|
||||
return hw_ptr;
|
||||
return snd_pcm_plug_client_size(plug, hw_ptr);
|
||||
}
|
||||
|
||||
static int snd_pcm_plug_prepare(snd_pcm_t *pcm)
|
||||
|
|
@ -398,7 +398,7 @@ static int snd_pcm_plug_channel_setup(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_c
|
|||
return -ENOSYS;
|
||||
}
|
||||
|
||||
static ssize_t snd_pcm_plug_frame_data(snd_pcm_t *pcm, off_t offset)
|
||||
static ssize_t snd_pcm_plug_appl_ptr(snd_pcm_t *pcm, off_t offset)
|
||||
{
|
||||
ssize_t ret;
|
||||
snd_pcm_plug_t *plug = pcm->private;
|
||||
|
|
@ -412,7 +412,7 @@ static ssize_t snd_pcm_plug_frame_data(snd_pcm_t *pcm, off_t offset)
|
|||
if (offset < 0)
|
||||
return offset;
|
||||
}
|
||||
ret = snd_pcm_frame_data(plug->slave, offset);
|
||||
ret = snd_pcm_appl_ptr(plug->slave, offset);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
return snd_pcm_plug_client_size(plug, ret);
|
||||
|
|
@ -661,14 +661,14 @@ struct snd_pcm_fast_ops snd_pcm_plug_fast_ops = {
|
|||
channel_params: snd_pcm_plug_channel_params,
|
||||
channel_setup: snd_pcm_plug_channel_setup,
|
||||
status: snd_pcm_plug_status,
|
||||
frame_io: snd_pcm_plug_frame_io,
|
||||
hw_ptr: snd_pcm_plug_hw_ptr,
|
||||
state: snd_pcm_plug_state,
|
||||
prepare: snd_pcm_plug_prepare,
|
||||
go: snd_pcm_plug_go,
|
||||
drain: snd_pcm_plug_drain,
|
||||
flush: snd_pcm_plug_flush,
|
||||
pause: snd_pcm_plug_pause,
|
||||
frame_data: snd_pcm_plug_frame_data,
|
||||
appl_ptr: snd_pcm_plug_appl_ptr,
|
||||
write: snd_pcm_plug_write,
|
||||
writev: snd_pcm_plug_writev,
|
||||
read: snd_pcm_plug_read,
|
||||
|
|
@ -690,18 +690,18 @@ static void snd_pcm_plug_slave_params(snd_pcm_plug_t *plug,
|
|||
/* compute right sizes */
|
||||
slave_params->frag_size = snd_pcm_plug_slave_size(plug, params->frag_size);
|
||||
slave_params->buffer_size = snd_pcm_plug_slave_size(plug, params->buffer_size);
|
||||
slave_params->frames_fill_max = snd_pcm_plug_slave_size(plug, params->frames_fill_max);
|
||||
slave_params->frames_min = snd_pcm_plug_slave_size(plug, params->frames_min);
|
||||
slave_params->frames_xrun_max = snd_pcm_plug_slave_size(plug, params->frames_xrun_max);
|
||||
slave_params->frames_align = snd_pcm_plug_slave_size(plug, params->frames_align);
|
||||
if (slave_params->frame_boundary == 0 || slave_params->frame_boundary > LONG_MAX)
|
||||
slave_params->frame_boundary = LONG_MAX;
|
||||
slave_params->fill_max = snd_pcm_plug_slave_size(plug, params->fill_max);
|
||||
slave_params->avail_min = snd_pcm_plug_slave_size(plug, params->avail_min);
|
||||
slave_params->xrun_max = snd_pcm_plug_slave_size(plug, params->xrun_max);
|
||||
slave_params->align = snd_pcm_plug_slave_size(plug, params->align);
|
||||
if (slave_params->boundary == 0 || slave_params->boundary > LONG_MAX)
|
||||
slave_params->boundary = LONG_MAX;
|
||||
assert(params->buffer_size > 0);
|
||||
slave_params->frame_boundary /= params->buffer_size;
|
||||
if (slave_params->frame_boundary > LONG_MAX / slave_params->buffer_size)
|
||||
slave_params->frame_boundary = LONG_MAX;
|
||||
slave_params->boundary /= params->buffer_size;
|
||||
if (slave_params->boundary > LONG_MAX / slave_params->buffer_size)
|
||||
slave_params->boundary = LONG_MAX;
|
||||
else
|
||||
slave_params->frame_boundary *= slave_params->buffer_size;
|
||||
slave_params->boundary *= slave_params->buffer_size;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -80,8 +80,8 @@ static ssize_t mmap_src_channels(snd_pcm_plugin_t *plugin,
|
|||
return -EPIPE;
|
||||
assert(snd_pcm_mmap_ready(stream));
|
||||
}
|
||||
pos = snd_pcm_mmap_frames_offset(stream);
|
||||
assert(pos % setup->frames_align == 0);
|
||||
pos = snd_pcm_mmap_offset(stream);
|
||||
assert(pos % setup->align == 0);
|
||||
|
||||
sv = plugin->buf_channels;
|
||||
dv = stream->channels;
|
||||
|
|
@ -99,7 +99,7 @@ static ssize_t mmap_src_channels(snd_pcm_plugin_t *plugin,
|
|||
++sv;
|
||||
++dv;
|
||||
}
|
||||
return snd_pcm_mmap_frames_xfer(stream, frames);
|
||||
return snd_pcm_mmap_xfer(stream, frames);
|
||||
}
|
||||
|
||||
static ssize_t mmap_dst_channels(snd_pcm_plugin_t *plugin,
|
||||
|
|
@ -147,8 +147,8 @@ static ssize_t mmap_dst_channels(snd_pcm_plugin_t *plugin,
|
|||
return -EPIPE;
|
||||
assert(snd_pcm_mmap_ready(stream));
|
||||
}
|
||||
pos = snd_pcm_mmap_frames_offset(stream);
|
||||
assert(pos % setup->frames_align == 0);
|
||||
pos = snd_pcm_mmap_offset(stream);
|
||||
assert(pos % setup->align == 0);
|
||||
|
||||
sv = stream->channels;
|
||||
dv = plugin->buf_channels;
|
||||
|
|
@ -162,7 +162,7 @@ static ssize_t mmap_dst_channels(snd_pcm_plugin_t *plugin,
|
|||
++sv;
|
||||
++dv;
|
||||
}
|
||||
return snd_pcm_mmap_frames_xfer(stream, frames);
|
||||
return snd_pcm_mmap_xfer(stream, frames);
|
||||
}
|
||||
|
||||
static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin,
|
||||
|
|
@ -188,7 +188,7 @@ static ssize_t mmap_playback_transfer(snd_pcm_plugin_t *plugin,
|
|||
}
|
||||
#endif
|
||||
|
||||
err = snd_pcm_frame_data(stream, frames);
|
||||
err = snd_pcm_appl_ptr(stream, frames);
|
||||
if (err < 0)
|
||||
return err;
|
||||
if (snd_pcm_mmap_state(stream) == SND_PCM_STATE_PREPARED &&
|
||||
|
|
@ -216,7 +216,7 @@ static ssize_t mmap_capture_transfer(snd_pcm_plugin_t *plugin,
|
|||
stream = plugin->plug->slave;
|
||||
|
||||
/* FIXME: not here the increment */
|
||||
err = snd_pcm_frame_data(stream, frames);
|
||||
err = snd_pcm_appl_ptr(stream, frames);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
|
|||
if (*bufsize > LATENCY_MAX)
|
||||
return -1;
|
||||
params.frag_size = *bufsize / 2;
|
||||
params.frames_min = 1;
|
||||
params.avail_min = 1;
|
||||
params.buffer_size = *bufsize;
|
||||
|
||||
if ((err = snd_pcm_params(phandle, ¶ms)) < 0) {
|
||||
|
|
@ -109,9 +109,9 @@ void showstat(snd_pcm_t *handle, snd_pcm_status_t *rstatus, size_t frames)
|
|||
}
|
||||
printf(" state = %i\n", status.state);
|
||||
printf(" frames = %i\n", frames);
|
||||
printf(" frame_io = %li\n", (long)status.frame_io);
|
||||
printf(" frame_data = %li\n", (long)status.frame_data);
|
||||
printf(" frames_avail = %li\n", (long)status.frames_avail);
|
||||
printf(" hw_ptr = %li\n", (long)status.hw_ptr);
|
||||
printf(" appl_ptr = %li\n", (long)status.appl_ptr);
|
||||
printf(" avail = %li\n", (long)status.avail);
|
||||
if (rstatus)
|
||||
*rstatus = status;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue