From 4d0d41a0f434842636a65b3bb230b83c2c5c50b1 Mon Sep 17 00:00:00 2001 From: William Wilgus Date: Thu, 20 Jun 2024 01:40:05 -0400 Subject: [Cleanup] abrepeat.c ab_repeat_init() doesn't do anything and some of the checks are redundant Change-Id: Icc861c57b119f541c0cbdb9e0074b78f1f4f10bb --- apps/abrepeat.c | 17 +++++++++-------- apps/abrepeat.h | 2 -- apps/gui/wps.c | 1 - 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/abrepeat.c b/apps/abrepeat.c index 19e9450c99..886564aaa5 100644 --- a/apps/abrepeat.c +++ b/apps/abrepeat.c @@ -47,6 +47,7 @@ void ab_end_of_track_report(void) } } +#if 0 void ab_repeat_init(void) { static bool ab_initialized = false; @@ -55,13 +56,13 @@ void ab_repeat_init(void) ab_initialized = true; } } +#endif /* determines if the given song position is earlier than the A mark; intended for use in handling the jump NEXT and PREV commands */ bool ab_before_A_marker(unsigned int song_position) { - return (ab_A_marker != AB_MARKER_NONE) - && (song_position < ab_A_marker); + return (song_position < ab_A_marker); } /* determines if the given song position is later than the A mark; @@ -97,20 +98,20 @@ by this fudge factor when setting a mark */ void ab_set_A_marker(unsigned int song_position) { ab_A_marker = song_position; - ab_A_marker = (ab_A_marker >= EAR_TO_HAND_LATENCY_FUDGE) - ? (ab_A_marker - EAR_TO_HAND_LATENCY_FUDGE) : 0; + ab_A_marker = (ab_A_marker >= EAR_TO_HAND_LATENCY_FUDGE) + ? (ab_A_marker - EAR_TO_HAND_LATENCY_FUDGE) : AB_MARKER_NONE; /* check if markers are out of order */ - if ( (ab_B_marker != AB_MARKER_NONE) && (ab_A_marker > ab_B_marker) ) + if (ab_A_marker > ab_B_marker) ab_B_marker = AB_MARKER_NONE; } void ab_set_B_marker(unsigned int song_position) { ab_B_marker = song_position; - ab_B_marker = (ab_B_marker >= EAR_TO_HAND_LATENCY_FUDGE) - ? (ab_B_marker - EAR_TO_HAND_LATENCY_FUDGE) : 0; + ab_B_marker = (ab_B_marker >= EAR_TO_HAND_LATENCY_FUDGE) + ? (ab_B_marker - EAR_TO_HAND_LATENCY_FUDGE) : AB_MARKER_NONE; /* check if markers are out of order */ - if ( (ab_A_marker != AB_MARKER_NONE) && (ab_B_marker < ab_A_marker) ) + if (ab_B_marker < ab_A_marker) ab_A_marker = AB_MARKER_NONE; } diff --git a/apps/abrepeat.h b/apps/abrepeat.h index 4d2c4ea001..1542b24f47 100644 --- a/apps/abrepeat.h +++ b/apps/abrepeat.h @@ -38,7 +38,6 @@ static inline void ab_void_dummy_marker(unsigned int song_position) } static inline void ab_dummy_voidfn(void){} -#define ab_repeat_init ab_dummy_voidfn #define ab_before_A_marker ab_bool_dummy_marker #define ab_after_A_marker ab_bool_dummy_marker #define ab_jump_to_A_marker ab_dummy_voidfn @@ -59,7 +58,6 @@ static inline void ab_dummy_voidfn(void){} #include "settings.h" -void ab_repeat_init(void); bool ab_before_A_marker(unsigned int song_position); bool ab_after_A_marker(unsigned int song_position); void ab_jump_to_A_marker(void); diff --git a/apps/gui/wps.c b/apps/gui/wps.c index 260730c4a1..0de805bd02 100644 --- a/apps/gui/wps.c +++ b/apps/gui/wps.c @@ -692,7 +692,6 @@ long gui_wps_show(void) long last_left = 0, last_right = 0; struct wps_state *state = get_wps_state(); - ab_repeat_init(); ab_reset_markers(); wps_state_init(); -- cgit v1.2.3