mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Completed renaming drain->stop, flush->drain (PCM). Done renaming drain->drop, flush->drain (rawmidi and seq). Removed wrong module usage count inc/dec from mmap
This commit is contained in:
parent
7088f19233
commit
2ea3fd4bb3
22 changed files with 86 additions and 86 deletions
|
|
@ -383,8 +383,8 @@ int pcm_shm_cmd(client_t *client)
|
|||
case SND_PCM_IOCTL_START:
|
||||
ctrl->result = snd_pcm_start(pcm);
|
||||
break;
|
||||
case SND_PCM_IOCTL_FLUSH:
|
||||
ctrl->result = snd_pcm_flush(pcm);
|
||||
case SND_PCM_IOCTL_DRAIN:
|
||||
ctrl->result = snd_pcm_drain(pcm);
|
||||
break;
|
||||
case SND_PCM_IOCTL_STOP:
|
||||
ctrl->result = snd_pcm_stop(pcm);
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ int snd_pcm_status(snd_pcm_t *handle, snd_pcm_status_t *status);
|
|||
int snd_pcm_prepare(snd_pcm_t *handle);
|
||||
int snd_pcm_start(snd_pcm_t *handle);
|
||||
int snd_pcm_stop(snd_pcm_t *handle);
|
||||
int snd_pcm_flush(snd_pcm_t *handle);
|
||||
int snd_pcm_drain(snd_pcm_t *handle);
|
||||
int snd_pcm_pause(snd_pcm_t *handle, int enable);
|
||||
int snd_pcm_state(snd_pcm_t *handle);
|
||||
int snd_pcm_delay(snd_pcm_t *handle, ssize_t *delayp);
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@ int snd_rawmidi_info(snd_rawmidi_t *handle, snd_rawmidi_info_t * info);
|
|||
int snd_rawmidi_stream_params(snd_rawmidi_t *handle, snd_rawmidi_params_t * params);
|
||||
int snd_rawmidi_stream_setup(snd_rawmidi_t *handle, snd_rawmidi_setup_t * setup);
|
||||
int snd_rawmidi_stream_status(snd_rawmidi_t *handle, snd_rawmidi_status_t * status);
|
||||
int snd_rawmidi_output_drop(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_output_drain(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_output_flush(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_input_flush(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_stream_flush(snd_rawmidi_t *handle, int channel);
|
||||
int snd_rawmidi_input_drain(snd_rawmidi_t *handle);
|
||||
int snd_rawmidi_stream_drain(snd_rawmidi_t *handle, int channel);
|
||||
ssize_t snd_rawmidi_write(snd_rawmidi_t *handle, const void *buffer, size_t size);
|
||||
ssize_t snd_rawmidi_read(snd_rawmidi_t *handle, void *buffer, size_t size);
|
||||
|
||||
|
|
|
|||
|
|
@ -82,13 +82,13 @@ int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
|
|||
int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
|
||||
int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
|
||||
int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer);
|
||||
int snd_seq_flush_output(snd_seq_t *handle);
|
||||
int snd_seq_drain_output(snd_seq_t *handle);
|
||||
int snd_seq_event_output_pending(snd_seq_t *seq);
|
||||
int snd_seq_extract_output(snd_seq_t *handle, snd_seq_event_t **ev);
|
||||
int snd_seq_drain_output(snd_seq_t *handle);
|
||||
int snd_seq_drain_output_buffer(snd_seq_t *handle);
|
||||
int snd_seq_drain_input(snd_seq_t *handle);
|
||||
int snd_seq_drain_input_buffer(snd_seq_t *handle);
|
||||
int snd_seq_drop_output(snd_seq_t *handle);
|
||||
int snd_seq_drop_output_buffer(snd_seq_t *handle);
|
||||
int snd_seq_drop_input(snd_seq_t *handle);
|
||||
int snd_seq_drop_input_buffer(snd_seq_t *handle);
|
||||
int snd_seq_remove_events(snd_seq_t *handle, snd_seq_remove_events_t *info);
|
||||
/* misc */
|
||||
void snd_seq_set_bit(int nr, void *array);
|
||||
|
|
|
|||
|
|
@ -191,10 +191,10 @@ int snd_pcm_stop(snd_pcm_t *pcm)
|
|||
return pcm->fast_ops->stop(pcm->fast_op_arg);
|
||||
}
|
||||
|
||||
int snd_pcm_flush(snd_pcm_t *pcm)
|
||||
int snd_pcm_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
assert(pcm);
|
||||
return pcm->fast_ops->flush(pcm->fast_op_arg);
|
||||
return pcm->fast_ops->drain(pcm->fast_op_arg);
|
||||
}
|
||||
|
||||
int snd_pcm_pause(snd_pcm_t *pcm, int enable)
|
||||
|
|
@ -411,7 +411,7 @@ static assoc_t starts[] = { START(EXPLICIT), START(DATA), END };
|
|||
static assoc_t readys[] = { READY(FRAGMENT), READY(ASAP), END };
|
||||
static assoc_t xfers[] = { XFER(INTERLEAVED), XFER(NONINTERLEAVED), END };
|
||||
static assoc_t mmaps[] = { MMAP(INTERLEAVED), MMAP(NONINTERLEAVED), END };
|
||||
static assoc_t xrun_acts[] = { XRUN_ACT(FLUSH), XRUN_ACT(DRAIN), END };
|
||||
static assoc_t xrun_acts[] = { XRUN_ACT(STOP), XRUN_ACT(DROP), END };
|
||||
static assoc_t onoff[] = { {0, "OFF", NULL}, {1, "ON", NULL}, {-1, "ON", NULL}, END };
|
||||
|
||||
int snd_pcm_dump_setup(snd_pcm_t *pcm, FILE *fp)
|
||||
|
|
|
|||
|
|
@ -362,12 +362,12 @@ static int snd_pcm_client_shm_stop(snd_pcm_t *pcm)
|
|||
return ctrl->result;
|
||||
}
|
||||
|
||||
static int snd_pcm_client_shm_flush(snd_pcm_t *pcm)
|
||||
static int snd_pcm_client_shm_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_client_t *client = pcm->private;
|
||||
snd_pcm_client_shm_t *ctrl = client->u.shm.ctrl;
|
||||
int err;
|
||||
ctrl->cmd = SND_PCM_IOCTL_FLUSH;
|
||||
ctrl->cmd = SND_PCM_IOCTL_DRAIN;
|
||||
err = snd_pcm_client_shm_action(pcm);
|
||||
if (err < 0)
|
||||
return err;
|
||||
|
|
@ -567,7 +567,7 @@ struct snd_pcm_fast_ops snd_pcm_client_fast_ops = {
|
|||
prepare: snd_pcm_client_shm_prepare,
|
||||
start: snd_pcm_client_shm_start,
|
||||
stop: snd_pcm_client_shm_stop,
|
||||
flush: snd_pcm_client_shm_flush,
|
||||
drain: snd_pcm_client_shm_drain,
|
||||
pause: snd_pcm_client_shm_pause,
|
||||
rewind: snd_pcm_client_shm_rewind,
|
||||
writei: snd_pcm_mmap_writei,
|
||||
|
|
|
|||
|
|
@ -110,10 +110,10 @@ static int snd_pcm_file_stop(snd_pcm_t *pcm)
|
|||
return snd_pcm_stop(file->slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_flush(snd_pcm_t *pcm)
|
||||
static int snd_pcm_file_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_file_t *file = pcm->private;
|
||||
return snd_pcm_flush(file->slave);
|
||||
return snd_pcm_drain(file->slave);
|
||||
}
|
||||
|
||||
static int snd_pcm_file_pause(snd_pcm_t *pcm, int enable)
|
||||
|
|
@ -341,7 +341,7 @@ struct snd_pcm_fast_ops snd_pcm_file_fast_ops = {
|
|||
prepare: snd_pcm_file_prepare,
|
||||
start: snd_pcm_file_start,
|
||||
stop: snd_pcm_file_stop,
|
||||
flush: snd_pcm_file_flush,
|
||||
drain: snd_pcm_file_drain,
|
||||
pause: snd_pcm_file_pause,
|
||||
rewind: snd_pcm_file_rewind,
|
||||
writei: snd_pcm_file_writei,
|
||||
|
|
|
|||
|
|
@ -207,11 +207,11 @@ static int snd_pcm_hw_stop(snd_pcm_t *pcm)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int snd_pcm_hw_flush(snd_pcm_t *pcm)
|
||||
static int snd_pcm_hw_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_hw_t *hw = pcm->private;
|
||||
int fd = hw->fd;
|
||||
if (ioctl(fd, SND_PCM_IOCTL_FLUSH) < 0)
|
||||
if (ioctl(fd, SND_PCM_IOCTL_DRAIN) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -454,7 +454,7 @@ struct snd_pcm_fast_ops snd_pcm_hw_fast_ops = {
|
|||
prepare: snd_pcm_hw_prepare,
|
||||
start: snd_pcm_hw_start,
|
||||
stop: snd_pcm_hw_stop,
|
||||
flush: snd_pcm_hw_flush,
|
||||
drain: snd_pcm_hw_drain,
|
||||
pause: snd_pcm_hw_pause,
|
||||
rewind: snd_pcm_hw_rewind,
|
||||
writei: snd_pcm_hw_writei,
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ struct snd_pcm_fast_ops {
|
|||
int (*prepare)(snd_pcm_t *pcm);
|
||||
int (*start)(snd_pcm_t *pcm);
|
||||
int (*stop)(snd_pcm_t *pcm);
|
||||
int (*flush)(snd_pcm_t *pcm);
|
||||
int (*drain)(snd_pcm_t *pcm);
|
||||
int (*pause)(snd_pcm_t *pcm, int enable);
|
||||
int (*state)(snd_pcm_t *pcm);
|
||||
int (*delay)(snd_pcm_t *pcm, ssize_t *delayp);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ static int snd_pcm_mmap_capture_ready(snd_pcm_t *pcm)
|
|||
int ret = 0;
|
||||
if (pcm->mmap_status->state == SND_PCM_STATE_XRUN) {
|
||||
ret = -EPIPE;
|
||||
if (pcm->setup.xrun_act == SND_PCM_XRUN_ACT_DRAIN)
|
||||
if (pcm->setup.xrun_act == SND_PCM_XRUN_ACT_DROP)
|
||||
return -EPIPE;
|
||||
}
|
||||
if (snd_pcm_mmap_capture_avail(pcm) >= pcm->setup.avail_min)
|
||||
|
|
|
|||
|
|
@ -259,10 +259,10 @@ static int snd_pcm_multi_stop(snd_pcm_t *pcm)
|
|||
return snd_pcm_stop(multi->slaves[0].handle);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_flush(snd_pcm_t *pcm)
|
||||
static int snd_pcm_multi_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_multi_t *multi = pcm->private;
|
||||
return snd_pcm_flush(multi->slaves[0].handle);
|
||||
return snd_pcm_drain(multi->slaves[0].handle);
|
||||
}
|
||||
|
||||
static int snd_pcm_multi_pause(snd_pcm_t *pcm, int enable)
|
||||
|
|
@ -521,7 +521,7 @@ struct snd_pcm_fast_ops snd_pcm_multi_fast_ops = {
|
|||
prepare: snd_pcm_multi_prepare,
|
||||
start: snd_pcm_multi_start,
|
||||
stop: snd_pcm_multi_stop,
|
||||
flush: snd_pcm_multi_flush,
|
||||
drain: snd_pcm_multi_drain,
|
||||
pause: snd_pcm_multi_pause,
|
||||
writei: snd_pcm_mmap_writei,
|
||||
writen: snd_pcm_mmap_writen,
|
||||
|
|
|
|||
|
|
@ -142,10 +142,10 @@ int snd_pcm_plugin_stop(snd_pcm_t *pcm)
|
|||
return snd_pcm_stop(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_flush(snd_pcm_t *pcm)
|
||||
int snd_pcm_plugin_drain(snd_pcm_t *pcm)
|
||||
{
|
||||
snd_pcm_plugin_t *plugin = pcm->private;
|
||||
return snd_pcm_flush(plugin->slave);
|
||||
return snd_pcm_drain(plugin->slave);
|
||||
}
|
||||
|
||||
int snd_pcm_plugin_pause(snd_pcm_t *pcm, int enable)
|
||||
|
|
@ -397,7 +397,7 @@ struct snd_pcm_fast_ops snd_pcm_plugin_fast_ops = {
|
|||
prepare: snd_pcm_plugin_prepare,
|
||||
start: snd_pcm_plugin_start,
|
||||
stop: snd_pcm_plugin_stop,
|
||||
flush: snd_pcm_plugin_flush,
|
||||
drain: snd_pcm_plugin_drain,
|
||||
pause: snd_pcm_plugin_pause,
|
||||
rewind: snd_pcm_plugin_rewind,
|
||||
writei: snd_pcm_plugin_writei,
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ int snd_pcm_plugin_delay(snd_pcm_t *pcm, ssize_t *delayp);
|
|||
int snd_pcm_plugin_prepare(snd_pcm_t *pcm);
|
||||
int snd_pcm_plugin_start(snd_pcm_t *pcm);
|
||||
int snd_pcm_plugin_stop(snd_pcm_t *pcm);
|
||||
int snd_pcm_plugin_flush(snd_pcm_t *pcm);
|
||||
int snd_pcm_plugin_drain(snd_pcm_t *pcm);
|
||||
int snd_pcm_plugin_pause(snd_pcm_t *pcm, int enable);
|
||||
ssize_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, size_t frames);
|
||||
ssize_t snd_pcm_plugin_writei(snd_pcm_t *pcm, const void *buffer, size_t size);
|
||||
|
|
|
|||
|
|
@ -155,35 +155,35 @@ int snd_rawmidi_stream_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * statu
|
|||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_output_drain(snd_rawmidi_t *rmidi)
|
||||
int snd_rawmidi_output_drop(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
int str = SND_RAWMIDI_STREAM_OUTPUT;
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_DROP, &str) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_stream_drain(snd_rawmidi_t *rmidi, int str)
|
||||
{
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (str < 0 || str > 1)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_DRAIN, &str) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int snd_rawmidi_stream_flush(snd_rawmidi_t *rmidi, int str)
|
||||
int snd_rawmidi_output_drain(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
if (!rmidi)
|
||||
return -EINVAL;
|
||||
if (str < 0 || str > 1)
|
||||
return -EINVAL;
|
||||
if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_FLUSH, &str) < 0)
|
||||
return -errno;
|
||||
return 0;
|
||||
return snd_rawmidi_stream_drain(rmidi, SND_RAWMIDI_STREAM_OUTPUT);
|
||||
}
|
||||
|
||||
int snd_rawmidi_output_flush(snd_rawmidi_t *rmidi)
|
||||
int snd_rawmidi_input_drain(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
return snd_rawmidi_stream_flush(rmidi, SND_RAWMIDI_STREAM_OUTPUT);
|
||||
}
|
||||
|
||||
int snd_rawmidi_input_flush(snd_rawmidi_t *rmidi)
|
||||
{
|
||||
return snd_rawmidi_stream_flush(rmidi, SND_RAWMIDI_STREAM_INPUT);
|
||||
return snd_rawmidi_stream_drain(rmidi, SND_RAWMIDI_STREAM_INPUT);
|
||||
}
|
||||
|
||||
ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
|
||||
|
|
|
|||
|
|
@ -189,7 +189,7 @@ int snd_seq_resize_output_buffer(snd_seq_t *seq, size_t size)
|
|||
return -EINVAL;
|
||||
if (size < sizeof(snd_seq_event_t))
|
||||
return -EINVAL;
|
||||
snd_seq_drain_output(seq);
|
||||
snd_seq_drop_output(seq);
|
||||
if (size != seq->obufsize) {
|
||||
char *newbuf;
|
||||
newbuf = calloc(1, size);
|
||||
|
|
@ -211,7 +211,7 @@ int snd_seq_resize_input_buffer(snd_seq_t *seq, size_t size)
|
|||
return -EINVAL;
|
||||
if (size < sizeof(snd_seq_event_t))
|
||||
return -EINVAL;
|
||||
snd_seq_drain_input(seq);
|
||||
snd_seq_drop_input(seq);
|
||||
size = (size + sizeof(snd_seq_event_t) - 1) / sizeof(snd_seq_event_t);
|
||||
if (size != seq->ibufsize) {
|
||||
snd_seq_event_t *newbuf;
|
||||
|
|
@ -711,7 +711,7 @@ int snd_seq_event_output(snd_seq_t *seq, snd_seq_event_t *ev)
|
|||
|
||||
result = snd_seq_event_output_buffer(seq, ev);
|
||||
if (result == -EAGAIN) {
|
||||
result = snd_seq_flush_output(seq);
|
||||
result = snd_seq_drain_output(seq);
|
||||
if (result < 0)
|
||||
return result;
|
||||
return snd_seq_event_output_buffer(seq, ev);
|
||||
|
|
@ -803,9 +803,9 @@ int snd_seq_event_output_pending(snd_seq_t *seq)
|
|||
}
|
||||
|
||||
/*
|
||||
* flush output buffer to sequencer
|
||||
* drain output buffer to sequencer
|
||||
*/
|
||||
int snd_seq_flush_output(snd_seq_t *seq)
|
||||
int snd_seq_drain_output(snd_seq_t *seq)
|
||||
{
|
||||
int result;
|
||||
|
||||
|
|
@ -951,7 +951,7 @@ int snd_seq_event_input_pending(snd_seq_t *seq, int fetch_sequencer)
|
|||
/*
|
||||
* clear output buffer
|
||||
*/
|
||||
int snd_seq_drain_output_buffer(snd_seq_t *seq)
|
||||
int snd_seq_drop_output_buffer(snd_seq_t *seq)
|
||||
{
|
||||
if (!seq)
|
||||
return -EINVAL;
|
||||
|
|
@ -962,7 +962,7 @@ int snd_seq_drain_output_buffer(snd_seq_t *seq)
|
|||
/*
|
||||
* clear input buffer
|
||||
*/
|
||||
int snd_seq_drain_input_buffer(snd_seq_t *seq)
|
||||
int snd_seq_drop_input_buffer(snd_seq_t *seq)
|
||||
{
|
||||
if (!seq)
|
||||
return -EINVAL;
|
||||
|
|
@ -974,7 +974,7 @@ int snd_seq_drain_input_buffer(snd_seq_t *seq)
|
|||
/*
|
||||
* clear output buffer and remove events in sequencer queue
|
||||
*/
|
||||
int snd_seq_drain_output(snd_seq_t *seq)
|
||||
int snd_seq_drop_output(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_remove_events_t rminfo;
|
||||
|
||||
|
|
@ -992,7 +992,7 @@ int snd_seq_drain_output(snd_seq_t *seq)
|
|||
/*
|
||||
* clear input buffer and and remove events in sequencer queue
|
||||
*/
|
||||
int snd_seq_drain_input(snd_seq_t *seq)
|
||||
int snd_seq_drop_input(snd_seq_t *seq)
|
||||
{
|
||||
snd_seq_remove_events_t rminfo;
|
||||
|
||||
|
|
@ -1095,7 +1095,7 @@ int snd_seq_remove_events(snd_seq_t *seq, snd_seq_remove_events_t *rmp)
|
|||
* in the library.
|
||||
*/
|
||||
if (rmp->remove_mode == 0)
|
||||
snd_seq_drain_input_buffer(seq);
|
||||
snd_seq_drop_input_buffer(seq);
|
||||
/* other modes are not supported yet */
|
||||
}
|
||||
|
||||
|
|
@ -1106,7 +1106,7 @@ int snd_seq_remove_events(snd_seq_t *seq, snd_seq_remove_events_t *rmp)
|
|||
*/
|
||||
if (rmp->remove_mode == 0) {
|
||||
/* The simple case - remove all */
|
||||
snd_seq_drain_output_buffer(seq);
|
||||
snd_seq_drop_output_buffer(seq);
|
||||
} else {
|
||||
char *ep;
|
||||
size_t len;
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ int setparams(snd_pcm_t *phandle, snd_pcm_t *chandle, int *bufsize)
|
|||
params.format.channels = 2;
|
||||
params.format.rate = USED_RATE;
|
||||
params.start_mode = SND_PCM_START_EXPLICIT;
|
||||
params.xrun_action = SND_PCM_XRUN_ACT_DRAIN;
|
||||
params.xrun_action = SND_PCM_XRUN_ACT_DROP;
|
||||
params.time = 1;
|
||||
*bufsize += 4;
|
||||
|
||||
|
|
@ -244,7 +244,7 @@ int main(void)
|
|||
if (pstatus.trigger_time.tv_sec == cstatus.trigger_time.tv_sec &&
|
||||
pstatus.trigger_time.tv_usec == cstatus.trigger_time.tv_usec)
|
||||
printf("Hardware sync\n");
|
||||
snd_pcm_flush(phandle);
|
||||
snd_pcm_drain(phandle);
|
||||
if (ok) {
|
||||
#if 0
|
||||
printf("Playback time = %li.%i, Record time = %li.%i, diff = %li\n",
|
||||
|
|
|
|||
|
|
@ -200,9 +200,9 @@ int main(int argc, char** argv)
|
|||
fprintf(stderr,"Closing\n");
|
||||
}
|
||||
|
||||
snd_rawmidi_input_flush(handle_in);
|
||||
snd_rawmidi_input_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
snd_rawmidi_output_flush(handle_out);
|
||||
snd_rawmidi_output_drain(handle_out);
|
||||
snd_rawmidi_close(handle_out);
|
||||
|
||||
return 0;
|
||||
|
|
|
|||
24
test/pcm.c
24
test/pcm.c
|
|
@ -86,11 +86,11 @@ void method2(void)
|
|||
return;
|
||||
}
|
||||
printf("done...\n");
|
||||
if ((err = snd_pcm_flush_capture(rhandle)) < 0) {
|
||||
printf("Record flush error: %s\n", snd_strerror(err));
|
||||
if ((err = snd_pcm_drain_capture(rhandle)) < 0) {
|
||||
printf("Record drain error: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
printf("Record flush done...\n");
|
||||
printf("Record drain done...\n");
|
||||
printf("Playback... ");
|
||||
fflush(stdout);
|
||||
if ((err = snd_pcm_writei(phandle, buffer, sizeof(buffer))) != sizeof(buffer)) {
|
||||
|
|
@ -98,11 +98,11 @@ void method2(void)
|
|||
return;
|
||||
}
|
||||
printf("done...\n");
|
||||
if ((err = snd_pcm_flush_playback(phandle)) < 0) {
|
||||
printf("Playback flush error: %s\n", snd_strerror(err));
|
||||
if ((err = snd_pcm_drain_playback(phandle)) < 0) {
|
||||
printf("Playback drain error: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
printf("Playback flush done...\n");
|
||||
printf("Playback drain done...\n");
|
||||
snd_pcm_close(phandle);
|
||||
printf("Playback close...\n");
|
||||
snd_pcm_close(rhandle);
|
||||
|
|
@ -127,11 +127,11 @@ void method3(void)
|
|||
return;
|
||||
}
|
||||
printf("done...\n");
|
||||
if ((err = snd_pcm_flush_capture(handle)) < 0) {
|
||||
printf("Record flush error: %s\n", snd_strerror(err));
|
||||
if ((err = snd_pcm_drain_capture(handle)) < 0) {
|
||||
printf("Record drain error: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
printf("Record flush done...\n");
|
||||
printf("Record drain done...\n");
|
||||
printf("Playback... ");
|
||||
fflush(stdout);
|
||||
if ((err = snd_pcm_writei(handle, buffer, sizeof(buffer))) != sizeof(buffer)) {
|
||||
|
|
@ -139,11 +139,11 @@ void method3(void)
|
|||
return;
|
||||
}
|
||||
printf("done...\n");
|
||||
if ((err = snd_pcm_flush_playback(handle)) < 0) {
|
||||
printf("Playback flush error: %s\n", snd_strerror(err));
|
||||
if ((err = snd_pcm_drain_playback(handle)) < 0) {
|
||||
printf("Playback drain error: %s\n", snd_strerror(err));
|
||||
return;
|
||||
}
|
||||
printf("Playback flush done...\n");
|
||||
printf("Playback drain done...\n");
|
||||
snd_pcm_close(handle);
|
||||
printf("Close...\n");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ static void alsa_sync(void)
|
|||
write_ev(&ev);
|
||||
|
||||
/* dump buffer */
|
||||
left = snd_seq_flush_output(seq_handle);
|
||||
left = snd_seq_drain_output(seq_handle);
|
||||
|
||||
/* wait for the timer start event */
|
||||
for (;;) {
|
||||
|
|
|
|||
|
|
@ -181,12 +181,12 @@ int main(int argc,char** argv)
|
|||
ch=0x90; snd_rawmidi_write(handle_out,&ch,1);
|
||||
ch=60; snd_rawmidi_write(handle_out,&ch,1);
|
||||
ch=100; snd_rawmidi_write(handle_out,&ch,1);
|
||||
snd_rawmidi_output_flush(handle_in);
|
||||
snd_rawmidi_output_drain(handle_in);
|
||||
sleep(1);
|
||||
ch=0x90; snd_rawmidi_write(handle_out,&ch,1);
|
||||
ch=60; snd_rawmidi_write(handle_out,&ch,1);
|
||||
ch=0; snd_rawmidi_write(handle_out,&ch,1);
|
||||
snd_rawmidi_output_flush(handle_out);
|
||||
snd_rawmidi_output_drain(handle_out);
|
||||
}
|
||||
if (fd_out!=-1) {
|
||||
unsigned char ch;
|
||||
|
|
@ -218,7 +218,7 @@ int main(int argc,char** argv)
|
|||
|
||||
if (handle_out) {
|
||||
snd_rawmidi_write(handle_out,&ch,1);
|
||||
snd_rawmidi_output_flush(handle_out);
|
||||
snd_rawmidi_output_drain(handle_out);
|
||||
}
|
||||
if (fd_out!=-1) {
|
||||
write(fd_out,&ch,1);
|
||||
|
|
@ -235,11 +235,11 @@ int main(int argc,char** argv)
|
|||
}
|
||||
|
||||
if (handle_in) {
|
||||
snd_rawmidi_output_flush(handle_in);
|
||||
snd_rawmidi_output_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
}
|
||||
if (handle_out) {
|
||||
snd_rawmidi_output_flush(handle_in);
|
||||
snd_rawmidi_output_drain(handle_in);
|
||||
snd_rawmidi_close(handle_in);
|
||||
}
|
||||
if (fd_in!=-1) {
|
||||
|
|
|
|||
|
|
@ -404,7 +404,7 @@ void event_decoder_start_timer(snd_seq_t *handle, int queue, int client, int por
|
|||
|
||||
if ((err = snd_seq_start_queue(handle, queue, NULL))<0)
|
||||
fprintf(stderr, "Timer event output error: %s\n", snd_strerror(err));
|
||||
while (snd_seq_flush_output(handle)>0)
|
||||
while (snd_seq_drain_output(handle)>0)
|
||||
sleep(1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@ void event_sender_start_timer(snd_seq_t *handle, int client, int queue, snd_pcm_
|
|||
#endif
|
||||
if ((err = snd_seq_start_queue(handle, queue, NULL))<0)
|
||||
fprintf(stderr, "Timer event output error: %s\n", snd_strerror(err));
|
||||
snd_seq_flush_output(handle);
|
||||
snd_seq_drain_output(handle);
|
||||
}
|
||||
|
||||
void event_sender_filter(snd_seq_t *handle)
|
||||
|
|
@ -134,8 +134,8 @@ void send_event(snd_seq_t *handle, int queue, int client, int port,
|
|||
ev.data.note.duration = 500; /* 0.5sec */
|
||||
if ((err = snd_seq_event_output(handle, &ev))<0)
|
||||
fprintf(stderr, "Event output error: %s\n", snd_strerror(err));
|
||||
if ((err = snd_seq_flush_output(handle))<0)
|
||||
fprintf(stderr, "Event flush error: %s\n", snd_strerror(err));
|
||||
if ((err = snd_seq_drain_output(handle))<0)
|
||||
fprintf(stderr, "Event drain error: %s\n", snd_strerror(err));
|
||||
}
|
||||
|
||||
void event_sender(snd_seq_t *handle, int argc, char *argv[])
|
||||
|
|
@ -248,7 +248,7 @@ void event_sender(snd_seq_t *handle, int argc, char *argv[])
|
|||
}
|
||||
#endif
|
||||
if (FD_ISSET(snd_seq_poll_descriptor(handle), &out))
|
||||
snd_seq_flush_output(handle);
|
||||
snd_seq_drain_output(handle);
|
||||
if (FD_ISSET(snd_seq_poll_descriptor(handle), &in)) {
|
||||
do {
|
||||
if ((err = snd_seq_event_input(handle, &ev))<0)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue