[xwax-devel] [PATCH 3/3] Link the spinner to the reference speed of the timecoder
Brought to you by:
hills
From: Mark H. <ma...@po...> - 2010-08-07 20:53:29
|
Signed-off-by: Mark Hills <ma...@po...> --- interface.c | 5 +++-- timecoder.h | 11 ++++++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/interface.c b/interface.c index 79a8408..2bc801c 100644 --- a/interface.c +++ b/interface.c @@ -529,7 +529,7 @@ static void draw_spinner(SDL_Surface *surface, const struct rect_t *rect, struct player_t *pl) { int x, y, r, c, rangle, pangle; - double position; + double position, rps; Uint8 *rp, *p; SDL_Color col; @@ -537,7 +537,8 @@ static void draw_spinner(SDL_Surface *surface, const struct rect_t *rect, y = rect->y; position = pl->position - pl->offset; - rangle = (int)(pl->position * 1024 * 10 / 18) % 1024; + rps = timecoder_revs_per_sec(pl->timecoder); + rangle = (int)(pl->position * 1024 * rps) % 1024; if (position < 0 || position >= (double)pl->track->length / pl->track->rate) col = warn_col; diff --git a/timecoder.h b/timecoder.h index b9e8b5b..cd49c06 100644 --- a/timecoder.h +++ b/timecoder.h @@ -116,11 +116,20 @@ static inline unsigned int timecoder_get_safe(struct timecoder_t *tc) /* The resolution of the timecode. This is the number of bits per - * second, which corresponds to the frequency of the sine wave */ + * second at reference playback speed */ static inline double timecoder_get_resolution(struct timecoder_t *tc) { return tc->def->resolution * tc->speed; } + +/* The number of revolutions per second of the timecode vinyl, + * used only for visual display */ + +static inline double timecoder_revs_per_sec(struct timecoder_t *tc) +{ + return (33.0 + 1.0 / 3) * tc->speed / 60; +} + #endif -- 1.7.1 |