27
27
} eax_adjust_props_t;
29
29
static gboolean playing = FALSE;
30
static GSList *exclusive_patches = NULL;
31
// Previous (since last callback) position in the file as percent
31
34
/* option values */
32
35
static void patch_changed (gpointer combo,
39
gboolean was_exclusive = FALSE;
35
40
guint effect = GPOINTER_TO_UINT(data);
36
41
#if ! GTK_CHECK_VERSION(2,4,0)
37
42
guint patch = gtk_option_menu_get_history(GTK_OPTION_MENU(combo));
39
44
guint patch = gtk_combo_box_get_active(GTK_COMBO_BOX(combo));
46
// See if it is exclusive
47
tmplist = exclusive_patches;
48
while (tmplist != NULL) {
49
if (combo == tmplist->data) {
52
tmplist = g_slist_next(tmplist);
54
// OK it was exclusive, reset all other exclusive patches...
56
tmplist = exclusive_patches;
58
while (tmplist != NULL) {
59
if (combo != tmplist->data) {
61
#if ! GTK_CHECK_VERSION(2,4,0)
62
gtk_option_menu_set_history(GTK_OPTION_MENU(tmplist->data), 0);
64
gtk_combo_box_set_active(GTK_COMBO_BOX(tmplist->data), 0);
67
tmplist = g_slist_next(tmplist);
69
// Then make sure it is set
70
#if ! GTK_CHECK_VERSION(2,4,0)
71
gtk_option_menu_set_history(GTK_OPTION_MENU(combo), patch);
73
gtk_combo_box_set_active(GTK_COMBO_BOX(combo), patch);
43
78
// Wire scalevalue to 0
44
g_print("Selecting patch %d for effect %04X\n", patch, effect);
79
// g_print("Selecting patch %d for effect %04X\n", patch, effect);
45
80
jukebox_adjust_eax(effect, patch, 0);
163
198
gint16 scalevalue = (gint16) adj->value;
166
g_print("Setting scalevalue for effect %04X to %d\n",
167
adjprops->effect, scalevalue);
201
//g_print("Setting scalevalue for effect %04X to %d\n",
202
// adjprops->effect, scalevalue);
168
203
jukebox_adjust_eax(adjprops->effect, 0, scalevalue);
254
289
#define VERTICAL 0x01
255
290
u_int8_t last_direction = HORIZONTAL;
292
// Clear old exclusive list...
293
if (exclusive_patches != NULL) {
294
g_slist_free(exclusive_patches);
295
exclusive_patches = NULL;
257
298
// Stuff all EAX stuff into this frame
258
299
hbox = gtk_hbox_new(FALSE, 5);
271
312
// If this groups consists of scalevalues (we are guessing
272
313
// that the first group member speaks for the rest), then create
273
314
// a hbox, else (for patches etc) create a hbox.
274
if (eax->scaleable != 0x00) {
315
if (eax->type == NJB_EAX_SLIDER_CONTROL) {
275
316
group_box = gtk_hbox_new(FALSE, 0);
276
317
last_direction = HORIZONTAL;
282
323
// Then each effect with it's label is stuffed in a vbox
283
324
vbox = gtk_vbox_new(FALSE, 0);
285
if (eax->selectable != 0x00 &&
286
eax->min_selectionvalue == 0x00 &&
287
eax->max_selectionvalue == 0x01) {
326
if (eax->type == NJB_EAX_FIXED_OPTION_CONTROL &&
327
eax->min_value == 0x00 &&
328
eax->max_value == 0x01) {
288
329
guint effect = (guint) eax->number;
290
331
checkbox = gtk_check_button_new_with_label(eax->name);
291
if (eax->current_selectionvalue != 0x00) {
332
if (eax->current_value != 0x00) {
292
333
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(checkbox), TRUE);
294
335
g_signal_connect(GTK_OBJECT(checkbox),
302
343
gtk_misc_set_alignment(GTK_MISC(label), 0.0f, 0.0f);
303
344
gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0);
304
345
// Patch value combobox
305
if (eax->selectable != 0x00) {
346
if (eax->type == NJB_EAX_FIXED_OPTION_CONTROL) {
307
348
GSList *names = NULL;
309
for(i = 0; i < eax->max_selectionvalue - eax->min_selectionvalue + 1; i++) {
310
names = g_slist_append(names, g_strdup(eax->selection_names[i]));
351
for(i = 0; i < eax->max_value - eax->min_value + 1; i++) {
352
names = g_slist_append(names, g_strdup(eax->option_names[i]));
312
GtkWidget *patches = create_patch_menu(eax->number,
314
GTK_SIGNAL_FUNC(patch_changed),
315
eax->current_selectionvalue);
354
patches = create_patch_menu(eax->number,
356
GTK_SIGNAL_FUNC(patch_changed),
316
358
gtk_box_pack_start(GTK_BOX(vbox), patches, TRUE, TRUE, 0);
359
if (eax->exclusive) {
360
// Add to list of exclusive stuff
361
exclusive_patches = g_slist_append(exclusive_patches, (gpointer) patches);
318
364
// Scale value slider
319
if (eax->scaleable != 0x00) {
365
if (eax->type == NJB_EAX_SLIDER_CONTROL) {
320
366
GtkWidget *slider;
322
g_print("Scalevalue %s, min %d, max %d, current %d\n",
323
eax->name, eax->min_scalevalue, eax->max_scalevalue,
324
eax->current_scalevalue);
368
// g_print("Scalevalue %s, min %d, max %d, current %d\n",
369
// eax->name, eax->min_scalevalue, eax->max_scalevalue,
370
// eax->current_scalevalue);
325
371
slider = create_adjustment_control(eax->number,
328
eax->current_scalevalue);
329
375
gtk_box_pack_start(GTK_BOX(vbox), slider, TRUE, TRUE, 0);
330
376
gtk_widget_show(slider);
392
static void adjust_position (GtkAdjustment *adj,
395
// eax_adjust_props_t *adjprops = (eax_adjust_props_t *) data;
396
// gint16 scalevalue = adjprops->max+1 - ((gint16) adj->value);
397
gint16 pos = (gint16) adj->value;
398
// Calculate the byte position offset
402
// If we just passed a track boundary there is no delta,
403
// else we find out how much the position has changed.
404
if ((prevpos == 100 || prevpos == 99) && (pos == 0 || pos == 1)) {
406
} else if (pos >= prevpos) {
407
delta = pos - prevpos;
408
} else if (pos < prevpos) {
409
delta = prevpos - pos;
412
// If someone has dragged the progress bar, delta will be more
413
// than 2 percent (let's say).
418
// If we're skipping backward or forward, execute this.
419
if (playing && skipto > 0) {
420
metadata_t *meta = jukebox_get_current_playing_metadata();
421
guint seconds = mmss_to_seconds(meta->length);
422
guint mspos = (seconds * 1000 * skipto) / 100;
423
g_print("Skipping to millisecond offset %d in track\n", mspos);
425
jukebox_skip_songposition(mspos);
346
431
/* Creates a complicated player window */
347
432
void create_player_window(GList *metalist)
368
453
* (upper - page_size). */
369
454
adj = gtk_adjustment_new (0.0, 0.0, 101.0, 0.1, 1.0, 1.0);
370
455
hscale = gtk_hscale_new (GTK_ADJUSTMENT (adj));
371
gtk_widget_set_sensitive(hscale, FALSE);
456
// To make it possible to skip into the song
457
// gtk_widget_set_sensitive(hscale, FALSE);
458
g_signal_connect_data(GTK_OBJECT(adj),
460
G_CALLBACK(adjust_position),
372
464
gtk_widget_set_usize (GTK_WIDGET (hscale), 200, 30);
373
465
gtk_range_set_update_policy (GTK_RANGE (hscale),
374
466
GTK_UPDATE_CONTINUOUS);
376
468
gtk_scale_set_value_pos (GTK_SCALE(hscale), GTK_POS_TOP);
377
469
gtk_scale_set_draw_value (GTK_SCALE(hscale), FALSE);
378
470
gtk_widget_show (hscale);
471
#if GTK_CHECK_VERSION(2,6,0)
472
button = gtk_button_new_from_stock(GTK_STOCK_MEDIA_STOP);
379
474
button = gtk_button_new_with_label(_("STOP"));
380
476
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
381
477
gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), button,
382
478
FALSE, FALSE, 0);
402
498
/* Manouver panel */
403
499
hbox2 = gtk_hbox_new(FALSE, 0);
501
#if GTK_CHECK_VERSION(2,6,0)
502
button = gtk_button_new_from_stock(GTK_STOCK_MEDIA_PREVIOUS);
405
504
button = gtk_button_new();
406
505
hbox3 = gtk_hbox_new(FALSE, 0);
407
506
arrow = gtk_arrow_new(GTK_ARROW_LEFT, GTK_SHADOW_NONE);
410
509
gtk_box_pack_start(GTK_BOX(hbox3), label, TRUE, TRUE, 0);
411
510
gtk_widget_show(arrow);
412
511
gtk_container_add(GTK_CONTAINER(button), hbox3);
413
513
g_signal_connect_object(GTK_OBJECT(button),
415
515
G_CALLBACK(prevbutton_click),
419
519
GTK_WIDGET_SET_FLAGS (button, GTK_CAN_DEFAULT);
420
520
label3 = gtk_label_new("00:00:00");
421
521
gtk_box_pack_start(GTK_BOX(hbox2), label3, TRUE, TRUE, 0);
522
#if GTK_CHECK_VERSION(2,6,0)
523
button = gtk_button_new_from_stock(GTK_STOCK_MEDIA_NEXT);
422
525
button = gtk_button_new();
423
526
hbox3 = gtk_hbox_new(FALSE, 0);
424
527
label = gtk_label_new(_("NEXT"));
427
530
gtk_box_pack_start(GTK_BOX(hbox3), arrow, TRUE, TRUE, 0);
428
531
gtk_widget_show(arrow);
429
532
gtk_container_add(GTK_CONTAINER(button), hbox3);
430
534
g_signal_connect_object(GTK_OBJECT(button),
432
536
G_CALLBACK(nextbutton_click),