map

minimalist audio player
git clone https://git.porkepik.fr/map
Log | Files | Refs | README | LICENSE

commit e4f8ec7ea5e76d35e987eee3bbb349ff0a510865
parent da7222f4e222f0a74eab06a3d22f2c2fc9d6b3f3
Author: Thomas Philippe <dev@porkepik.fr>
Date:   Wed,  9 Sep 2020 22:42:46 +0200

fix pause

Diffstat:
Malsa.c | 12++++++++++++
Mmap.c | 6+++++-
2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/alsa.c b/alsa.c @@ -103,6 +103,18 @@ alsa_open(int bits, int rate, int channels) return 0; } +void +alsa_pause(void) +{ + snd_pcm_pause(hdl, 1); +} + +void +alsa_resume(void) +{ + snd_pcm_pause(hdl, 0); +} + int alsa_play(void *buf, size_t nbytes) { diff --git a/map.c b/map.c @@ -42,6 +42,8 @@ char poll_key_event(void); int alsa_init(void); int alsa_vol(int); int alsa_open(int, int, int); +void alsa_pause(void); +void alsa_resume(void); int alsa_play(void *, int); void alsa_close(void); @@ -122,7 +124,7 @@ print_timer(int timersec, int track_sec) static void print_pause(void) { - set_cursor(rows - 1, 13); + set_cursor(rows - 1, 11); write_term("||"); } @@ -306,6 +308,7 @@ next: if (pause_t) start += difftime(time(NULL), pause_t); pause_t = pause_t ? 0 : time(NULL); + alsa_resume(); break; /* rewind */ case 'h': @@ -352,6 +355,7 @@ next: if (pause_t) { print_pause(); + alsa_pause(); usleep(10000); continue; }