map

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

commit ccf825397cbfea8fe93494364cc4d11c4b503157
parent 3b381c28316371f9efbc407c66d1ea48c6e5afe7
Author: Thomas Philippe <dev@porkepik.fr>
Date:   Fri, 20 Sep 2019 02:13:20 +0200

fix volume change

Diffstat:
Mmap.c | 19++++++++++---------
1 file changed, 10 insertions(+), 9 deletions(-)

diff --git a/map.c b/map.c @@ -20,7 +20,7 @@ struct player { char *curdir; - long volume; + int volume; struct track **tracks; }; @@ -243,7 +243,7 @@ opentrack(struct track *track) } static int -playtrack(struct track curtrack, struct player player, int trackid) +playtrack(struct track curtrack, struct player player, int *volume, int trackid) { static int cursorid = 1; int timersec = 0, toptrack = 0; @@ -254,7 +254,7 @@ playtrack(struct track curtrack, struct player player, int trackid) start = time(NULL); opentrack(&curtrack); print_info(player.curdir, curtrack); - print_volume(player.volume); + print_volume(*volume); do { if(get_term_size(&rows, &cols)) { @@ -263,7 +263,7 @@ playtrack(struct track curtrack, struct player player, int trackid) cursorid = 1; toptrack = 0; print_info(player.curdir, curtrack); - print_volume(player.volume); + print_volume(*volume); } switch (poll_key_event()) { @@ -298,12 +298,12 @@ playtrack(struct track curtrack, struct player player, int trackid) break; /* volume */ case 'o': - player.volume = alsa_vol(player.volume, -2); - print_volume(player.volume); + *volume = alsa_vol(*volume, -2); + print_volume(*volume); break; case 'p': - player.volume = alsa_vol(player.volume, 2); - print_volume(player.volume); + *volume = alsa_vol(*volume, 2); + print_volume(*volume); break; /* select track under cursor*/ case ' ': @@ -380,7 +380,8 @@ main(int argc, char **argv) init_term(); while (trackid < ntracks) - trackid = playtrack(*player.tracks[trackid], player, trackid); + trackid = playtrack(*player.tracks[trackid], player, + &player.volume, trackid); end_term();