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
|
|
@ -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