[Cleanup] abrepeat.c

ab_repeat_init() doesn't do anything and some of the checks are redundant

Change-Id: Icc861c57b119f541c0cbdb9e0074b78f1f4f10bb
This commit is contained in:
William Wilgus 2024-06-20 01:40:05 -04:00 committed by William Wilgus
parent 547b6a570d
commit 4d0d41a0f4
3 changed files with 9 additions and 11 deletions

View file

@ -47,6 +47,7 @@ void ab_end_of_track_report(void)
} }
} }
#if 0
void ab_repeat_init(void) void ab_repeat_init(void)
{ {
static bool ab_initialized = false; static bool ab_initialized = false;
@ -55,13 +56,13 @@ void ab_repeat_init(void)
ab_initialized = true; ab_initialized = true;
} }
} }
#endif
/* determines if the given song position is earlier than the A mark; /* determines if the given song position is earlier than the A mark;
intended for use in handling the jump NEXT and PREV commands */ intended for use in handling the jump NEXT and PREV commands */
bool ab_before_A_marker(unsigned int song_position) bool ab_before_A_marker(unsigned int song_position)
{ {
return (ab_A_marker != AB_MARKER_NONE) return (song_position < ab_A_marker);
&& (song_position < ab_A_marker);
} }
/* determines if the given song position is later than the A mark; /* 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) void ab_set_A_marker(unsigned int song_position)
{ {
ab_A_marker = song_position; ab_A_marker = song_position;
ab_A_marker = (ab_A_marker >= EAR_TO_HAND_LATENCY_FUDGE) ab_A_marker = (ab_A_marker >= EAR_TO_HAND_LATENCY_FUDGE)
? (ab_A_marker - EAR_TO_HAND_LATENCY_FUDGE) : 0; ? (ab_A_marker - EAR_TO_HAND_LATENCY_FUDGE) : AB_MARKER_NONE;
/* check if markers are out of order */ /* 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; ab_B_marker = AB_MARKER_NONE;
} }
void ab_set_B_marker(unsigned int song_position) void ab_set_B_marker(unsigned int song_position)
{ {
ab_B_marker = song_position; ab_B_marker = song_position;
ab_B_marker = (ab_B_marker >= EAR_TO_HAND_LATENCY_FUDGE) ab_B_marker = (ab_B_marker >= EAR_TO_HAND_LATENCY_FUDGE)
? (ab_B_marker - EAR_TO_HAND_LATENCY_FUDGE) : 0; ? (ab_B_marker - EAR_TO_HAND_LATENCY_FUDGE) : AB_MARKER_NONE;
/* check if markers are out of order */ /* 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; ab_A_marker = AB_MARKER_NONE;
} }

View file

@ -38,7 +38,6 @@ static inline void ab_void_dummy_marker(unsigned int song_position)
} }
static inline void ab_dummy_voidfn(void){} 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_before_A_marker ab_bool_dummy_marker
#define ab_after_A_marker ab_bool_dummy_marker #define ab_after_A_marker ab_bool_dummy_marker
#define ab_jump_to_A_marker ab_dummy_voidfn #define ab_jump_to_A_marker ab_dummy_voidfn
@ -59,7 +58,6 @@ static inline void ab_dummy_voidfn(void){}
#include "settings.h" #include "settings.h"
void ab_repeat_init(void);
bool ab_before_A_marker(unsigned int song_position); bool ab_before_A_marker(unsigned int song_position);
bool ab_after_A_marker(unsigned int song_position); bool ab_after_A_marker(unsigned int song_position);
void ab_jump_to_A_marker(void); void ab_jump_to_A_marker(void);

View file

@ -692,7 +692,6 @@ long gui_wps_show(void)
long last_left = 0, last_right = 0; long last_left = 0, last_right = 0;
struct wps_state *state = get_wps_state(); struct wps_state *state = get_wps_state();
ab_repeat_init();
ab_reset_markers(); ab_reset_markers();
wps_state_init(); wps_state_init();