From 2ea3fd4bb3c63dda001a6059094cb7b6053176ac Mon Sep 17 00:00:00 2001 From: Abramo Bagnara Date: Fri, 29 Sep 2000 20:49:18 +0000 Subject: [PATCH] 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 --- aserver/aserver.c | 4 ++-- include/pcm.h | 2 +- include/rawmidi.h | 6 +++--- include/seq.h | 10 +++++----- src/pcm/pcm.c | 6 +++--- src/pcm/pcm_client.c | 6 +++--- src/pcm/pcm_file.c | 6 +++--- src/pcm/pcm_hw.c | 6 +++--- src/pcm/pcm_local.h | 2 +- src/pcm/pcm_mmap.c | 2 +- src/pcm/pcm_multi.c | 6 +++--- src/pcm/pcm_plugin.c | 6 +++--- src/pcm/pcm_plugin.h | 2 +- src/rawmidi/rawmidi.c | 16 ++++++++-------- src/seq/seq.c | 22 +++++++++++----------- test/latency.c | 4 ++-- test/midiloop.c | 4 ++-- test/pcm.c | 24 ++++++++++++------------ test/playmidi1.c | 2 +- test/rawmidi.c | 10 +++++----- test/seq-decoder.c | 2 +- test/seq-sender.c | 8 ++++---- 22 files changed, 78 insertions(+), 78 deletions(-) diff --git a/aserver/aserver.c b/aserver/aserver.c index 6c637f25..083a8f1f 100644 --- a/aserver/aserver.c +++ b/aserver/aserver.c @@ -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); diff --git a/include/pcm.h b/include/pcm.h index 3d2c9b9a..4b5bb8d4 100644 --- a/include/pcm.h +++ b/include/pcm.h @@ -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); diff --git a/include/rawmidi.h b/include/rawmidi.h index 5bdab976..b69c2703 100644 --- a/include/rawmidi.h +++ b/include/rawmidi.h @@ -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); diff --git a/include/seq.h b/include/seq.h index 3bd4989d..2ba07c6c 100644 --- a/include/seq.h +++ b/include/seq.h @@ -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); diff --git a/src/pcm/pcm.c b/src/pcm/pcm.c index 00c35c94..60385330 100644 --- a/src/pcm/pcm.c +++ b/src/pcm/pcm.c @@ -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) diff --git a/src/pcm/pcm_client.c b/src/pcm/pcm_client.c index dbf4c338..feccd4e2 100644 --- a/src/pcm/pcm_client.c +++ b/src/pcm/pcm_client.c @@ -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, diff --git a/src/pcm/pcm_file.c b/src/pcm/pcm_file.c index 316ccd39..4e0698b9 100644 --- a/src/pcm/pcm_file.c +++ b/src/pcm/pcm_file.c @@ -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, diff --git a/src/pcm/pcm_hw.c b/src/pcm/pcm_hw.c index bdfb3b65..557f67fd 100644 --- a/src/pcm/pcm_hw.c +++ b/src/pcm/pcm_hw.c @@ -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, diff --git a/src/pcm/pcm_local.h b/src/pcm/pcm_local.h index acb6ea5c..ad356f95 100644 --- a/src/pcm/pcm_local.h +++ b/src/pcm/pcm_local.h @@ -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); diff --git a/src/pcm/pcm_mmap.c b/src/pcm/pcm_mmap.c index 3f016167..0bc97fa0 100644 --- a/src/pcm/pcm_mmap.c +++ b/src/pcm/pcm_mmap.c @@ -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) diff --git a/src/pcm/pcm_multi.c b/src/pcm/pcm_multi.c index daadc52a..9451ad1a 100644 --- a/src/pcm/pcm_multi.c +++ b/src/pcm/pcm_multi.c @@ -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, diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c index 1c05ddee..07eb0e79 100644 --- a/src/pcm/pcm_plugin.c +++ b/src/pcm/pcm_plugin.c @@ -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, diff --git a/src/pcm/pcm_plugin.h b/src/pcm/pcm_plugin.h index 3f566158..67f4c63c 100644 --- a/src/pcm/pcm_plugin.h +++ b/src/pcm/pcm_plugin.h @@ -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); diff --git a/src/rawmidi/rawmidi.c b/src/rawmidi/rawmidi.c index 1a0cad07..9845776b 100644 --- a/src/rawmidi/rawmidi.c +++ b/src/rawmidi/rawmidi.c @@ -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_DRAIN, &str) < 0) + if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_DROP, &str) < 0) return -errno; return 0; } -int snd_rawmidi_stream_flush(snd_rawmidi_t *rmidi, int str) +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_FLUSH, &str) < 0) + if (ioctl(rmidi->fd, SND_RAWMIDI_IOCTL_STREAM_DRAIN, &str) < 0) return -errno; return 0; } -int snd_rawmidi_output_flush(snd_rawmidi_t *rmidi) +int snd_rawmidi_output_drain(snd_rawmidi_t *rmidi) { - return snd_rawmidi_stream_flush(rmidi, SND_RAWMIDI_STREAM_OUTPUT); + return snd_rawmidi_stream_drain(rmidi, SND_RAWMIDI_STREAM_OUTPUT); } -int snd_rawmidi_input_flush(snd_rawmidi_t *rmidi) +int snd_rawmidi_input_drain(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) diff --git a/src/seq/seq.c b/src/seq/seq.c index ebf16e40..0cc73f77 100644 --- a/src/seq/seq.c +++ b/src/seq/seq.c @@ -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; diff --git a/test/latency.c b/test/latency.c index 6daf446b..7d9071c6 100644 --- a/test/latency.c +++ b/test/latency.c @@ -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", diff --git a/test/midiloop.c b/test/midiloop.c index 2db903de..96bd91df 100644 --- a/test/midiloop.c +++ b/test/midiloop.c @@ -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; diff --git a/test/pcm.c b/test/pcm.c index d48c25c4..9b750ee7 100644 --- a/test/pcm.c +++ b/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"); } diff --git a/test/playmidi1.c b/test/playmidi1.c index c2e6ec9e..a7b20467 100644 --- a/test/playmidi1.c +++ b/test/playmidi1.c @@ -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 (;;) { diff --git a/test/rawmidi.c b/test/rawmidi.c index 1b7915b2..f466ee09 100644 --- a/test/rawmidi.c +++ b/test/rawmidi.c @@ -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) { diff --git a/test/seq-decoder.c b/test/seq-decoder.c index e3b075e0..87e610fe 100644 --- a/test/seq-decoder.c +++ b/test/seq-decoder.c @@ -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); } diff --git a/test/seq-sender.c b/test/seq-sender.c index 8905ac82..b7c1f6c8 100644 --- a/test/seq-sender.c +++ b/test/seq-sender.c @@ -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) -- 2.47.1