map

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

commit 11324966ff96538c14e0bd37a3624e2f4379a181
parent 3b4f8aaa93d9683e24d4d8f93aad32a4058e3946
Author: Thomas Philippe <dev@porkepik.fr>
Date:   Wed, 28 Aug 2019 01:31:25 +0200

change function names

Diffstat:
Mmap.c | 32++++++++++++++++----------------
1 file changed, 16 insertions(+), 16 deletions(-)

diff --git a/map.c b/map.c @@ -82,7 +82,7 @@ static int ntracks; static void -display_cursor(int oldx, int newx) +print_cursor(int oldx, int newx) { set_cursor(oldx, 4); write_term(" "); @@ -112,11 +112,11 @@ print_playlist(struct track **tracks, int start_index) write(STDOUT_FILENO, buf, buf_len); free(buf); - display_cursor(1, 1); + print_cursor(1, 1); } static void -display_track_info(const char *curdir, struct track track) +print_info(const char *curdir, struct track track) { char *real_path = realpath(curdir, NULL); @@ -133,7 +133,7 @@ display_track_info(const char *curdir, struct track track) } static void -display_timer(int timersec, int track_sec) +print_timer(int timersec, int track_sec) { set_cursor(rows - 1, 13); write_term("\x1b[1K %d:%02d", timersec / 60, timersec % 60); @@ -141,14 +141,14 @@ display_timer(int timersec, int track_sec) } static void -display_pause(void) +print_pause(void) { set_cursor(rows - 1, 13); write_term("||"); } static void -display_volume(int volume) +print_volume(int volume) { set_cursor(rows - 1, 48); write_term("Volume: %-3d", volume); @@ -263,8 +263,8 @@ playtrack(struct track curtrack, struct player player, int trackid) start = time(NULL); opentrack(&curtrack); - display_track_info(player.curdir, curtrack); - display_volume(player.volume); + print_info(player.curdir, curtrack); + print_volume(player.volume); do { if(get_term_size(&rows, &cols)) { @@ -272,8 +272,8 @@ playtrack(struct track curtrack, struct player player, int trackid) print_playlist(player.tracks, 0); cursorid = 1; toptrack = 0; - display_track_info(player.curdir, curtrack); - display_volume(player.volume); + print_info(player.curdir, curtrack); + print_volume(player.volume); } switch (poll_key_event()) { @@ -283,13 +283,13 @@ playtrack(struct track curtrack, struct player player, int trackid) toptrack + cursorid + 1 > ntracks) break; cursorid++; - display_cursor(cursorid - 1, cursorid); + print_cursor(cursorid - 1, cursorid); break; case 'k': if (cursorid <= 1) break; cursorid--; - display_cursor(cursorid + 1, cursorid); + print_cursor(cursorid + 1, cursorid); break; /* page scrolling */ case 'f': @@ -309,11 +309,11 @@ playtrack(struct track curtrack, struct player player, int trackid) /* volume */ case 'o': player.volume = alsa_vol(player.volume, -2); - display_volume(player.volume); + print_volume(player.volume); break; case 'p': player.volume = alsa_vol(player.volume, 2); - display_volume(player.volume); + print_volume(player.volume); break; /* select track under cursor*/ case ' ': @@ -347,7 +347,7 @@ playtrack(struct track curtrack, struct player player, int trackid) } if (pausetime) { - display_pause(); + print_pause(); usleep(10 * 1000); continue; } @@ -360,7 +360,7 @@ playtrack(struct track curtrack, struct player player, int trackid) } timersec = difftime(time(NULL), start); - display_timer(timersec, curtrack.length); + print_timer(timersec, curtrack.length); } while (done); curtrack.close();