map

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

commit bf51284ca32f95c354e29c12330a1e76224d539d
parent 94c0a0fe90cf2bcf1c5c1be1e6d28ab0a8487644
Author: Thomas Philippe <dev@porkepik.fr>
Date:   Tue, 27 Aug 2019 19:22:02 +0200

rename stuff

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

diff --git a/map.c b/map.c @@ -138,10 +138,10 @@ display_track_info(const char *curdir, struct track track) } static void -display_timer(int timer_sec, int track_sec) +display_timer(int timersec, int track_sec) { set_cursor(rows - 1, 13); - write_term("\x1b[1K %d:%02d", timer_sec / 60, timer_sec % 60); + write_term("\x1b[1K %d:%02d", timersec / 60, timersec % 60); write_term(" / %d:%02d", track_sec / 60, track_sec % 60); } @@ -249,7 +249,7 @@ trackcmp(const void *a, const void *b) } static void -build_track_list(struct track **tracks, char **tracklist) +makeplaylist(struct track **tracks, char **tracklist) { for (int i = 0; i < ntracks; i++) { tracklist[i] = malloc(strlen(tracks[i]->name) + 30); @@ -262,7 +262,7 @@ build_track_list(struct track **tracks, char **tracklist) } static void -open_track(struct track track) +opentrack(struct track track) { int bits, channels, rate; @@ -277,13 +277,13 @@ static int playtrack(struct track curtrack, struct player player, int trackid) { static int cursorid = 1; - int timer_sec = 0, toptrack = 0; + int timersec = 0, toptrack = 0; long done; - time_t start, pause_time = 0; + time_t start, pausetime = 0; int buffer[BUFF_SIZE]; start = time(NULL); - open_track(curtrack); + opentrack(curtrack); display_track_info(player.curdir, curtrack); display_volume(player.volume); @@ -343,17 +343,17 @@ playtrack(struct track curtrack, struct player player, int trackid) goto endtrack; /* resume/pause */ case 'c': - if (pause_time) - start += difftime(time(NULL), pause_time); - pause_time = pause_time ? 0 : time(NULL); + if (pausetime) + start += difftime(time(NULL), pausetime); + pausetime = pausetime ? 0 : time(NULL); break; /* rewind */ case 'h': curtrack.seek(SEEK_SEC * -1); - if (timer_sec >= SEEK_SEC) + if (timersec >= SEEK_SEC) start += SEEK_SEC; else - start += timer_sec; + start += timersec; break; /* skip */ case 'l': @@ -367,7 +367,7 @@ playtrack(struct track curtrack, struct player player, int trackid) goto endtrack; } - if (pause_time) { + if (pausetime) { display_pause(); usleep(10 * 1000); continue; @@ -380,8 +380,8 @@ playtrack(struct track curtrack, struct player player, int trackid) errx(1, "Error during decoding."); } - timer_sec = difftime(time(NULL), start); - display_timer(timer_sec, curtrack.length); + timersec = difftime(time(NULL), start); + display_timer(timersec, curtrack.length); } while (done); curtrack.close(); @@ -408,7 +408,7 @@ main(int argc, char **argv) qsort(tracks, ntracks, sizeof(*tracks), trackcmp); player.tracklist = malloc(ntracks * sizeof(char *)); - build_track_list(tracks, player.tracklist); + makeplaylist(tracks, player.tracklist); player.volume = alsa_vol(player.volume, 0); init_term();