Skip to content

Commit

Permalink
Add full HSV color model.
Browse files Browse the repository at this point in the history
Fix how ID3 tags are being read to prevent seg fault.

Remove Debian dir per madduck's request.
  • Loading branch information
cgroom committed Dec 10, 2003
1 parent bd2407f commit f13b7d9
Show file tree
Hide file tree
Showing 24 changed files with 849 additions and 536 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ OBJECTS = \
ui_selection_view.o \
ui_playlist_view.o \
ui_colorwheel.o \
ui_colorbox.o \
ui_menubar.o \
gjay_xmms.o \
analysis.o \
Expand Down
6 changes: 6 additions & 0 deletions changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
0.2.8 - December 2003
-Bugs:
- Some (evil) ID3 tags were not readable and caused a core dump.
(Debian bug 222195)
-UI:
- Support full HSV model for song color selection.
0.2.7 - November 2003
- Bugs:
- (Provided by Giacomo Catenazzi) verify opendir()
Expand Down
4 changes: 2 additions & 2 deletions constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
#define SELECT_RADIUS 3

/* Values */
#define MAX_FREQ_VAL 10.0
#define MAX_VOL_DIFF 10.0
#define MIN_CRITERIA 0.1
#define MAX_CRITERIA 10.0
#define MAX_FREQ_VAL 10.0
#define MAX_VOL_DIFF 10.0
#define MIN_RATING 0.0
#define MAX_RATING 5.0
#define MIN_BPM 100.0
Expand Down
14 changes: 0 additions & 14 deletions debian/README.Debian

This file was deleted.

97 changes: 0 additions & 97 deletions debian/changelog

This file was deleted.

24 changes: 0 additions & 24 deletions debian/control

This file was deleted.

26 changes: 0 additions & 26 deletions debian/copyright

This file was deleted.

3 changes: 0 additions & 3 deletions debian/dirs

This file was deleted.

2 changes: 0 additions & 2 deletions debian/docs

This file was deleted.

2 changes: 0 additions & 2 deletions debian/menu

This file was deleted.

73 changes: 0 additions & 73 deletions debian/rules

This file was deleted.

2 changes: 1 addition & 1 deletion gjay.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ int main( int argc, char *argv[] ) {
} else if (get_named_color(buffer, &rgb)) {
prefs.start_color = TRUE;
}
prefs.color = hsv_to_hb(rgb_to_hsv(rgb));
prefs.color = rgb_to_hsv(rgb);
i++;
} else {
fprintf(stderr, "Usage: -c color, where color is a hex number in the form 0xRRGGBB or a color name:\n%s\n", known_colors());
Expand Down
31 changes: 14 additions & 17 deletions playlist.c
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

static song * current;
static song * first;
static gdouble distance ( song * a, song * b );
static void remove_repeats ( song * s, GList * list);

/* How much does brightness factor into matching two songs? */
Expand All @@ -47,9 +46,8 @@ static void remove_repeats ( song * s, GList * list);
GList * generate_playlist ( guint minutes ) {
GList * working, * final, * rand_list, * list;
gint i, list_time, l, r, max_force_index, len;
gdouble min_distance, s_distance;
gdouble max_force, s_force;
song * s, * repeat;
song * s;
time_t t;

list_time = 0;
Expand Down Expand Up @@ -112,26 +110,25 @@ GList * generate_playlist ( guint minutes ) {
gchar * latin1;
latin1 = strdup_to_latin1((char *) selected_files->data);
fprintf(stderr, "File '%s' not found in data file;\n"\
"perhaps it has not been analyzed. Using different starting song.\n",
"perhaps it has not been analyzed. Using random starting song.\n",
latin1);
g_free(latin1);
}
}
if (prefs.start_color || (prefs.start_selected && !first)) {
for (min_distance = 0, list = g_list_first(working); list;
if (prefs.start_color) {
song temp_song;
bzero(&temp_song, sizeof(song));
temp_song.no_data = TRUE;
temp_song.no_rating = TRUE;
temp_song.color = prefs.color;
for (max_force = -1000, list = g_list_first(working);
list;
list = g_list_next(list)) {
s = SONG(list);
if (!s->no_color) {
s_distance =
MIN(fabs(prefs.color.H - s->color.H),
((MIN(prefs.color.H, s->color.H) + 2*M_PI) -
(MAX(prefs.color.H, s->color.H)) +
BRIGHTNESS_FACTOR * fabs(prefs.color.B - s->color.B)));
if ((s_distance < min_distance) ||
((s_distance == min_distance) && (rand() % 2))) {
min_distance = s_distance;
first = SONG(list);
}
s_force = song_force(&temp_song, s);
if (s_force > max_force) {
max_force = s_force;
first = s;
}
}
}
Expand Down
Loading

0 comments on commit f13b7d9

Please sign in to comment.