AF Volume and Key Speed

AFvolume

This is a callback function for a scale change.

void scale_value_changed_for_AF_Volume( GtkWidget *scale, gpointer   data ) {
  int outputcount = 9;
  static unsigned char command[9] = {0xfe, 0xfe, 0x80, 0xe0, 0x14, 0x01, 0x00, 0x32, 0xfd};
  int value, i100, i10, i1;
  value = gtk_range_get_value(GTK_RANGE (scale));
  i100 = value / 100;
  i10  = (value - 100*i100) / 10;
  i1   = value % 10;
  command[6] = i100;
  command[7] = 16*i10 + i1; /* BCD coded */
  write(fd, &command, outputcount);
}

And here is a main program.

    adj = gtk_adjustment_new(50.0, 0.0, 256.0, 1.0, 1.0, 1.0);
    scale = gtk_hscale_new(GTK_ADJUSTMENT (adj));
    gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_TOP);
    gtk_signal_connect (GTK_OBJECT (scale), "value_changed", GTK_SIGNAL_FUNC (scale_value_changed_for_AF_Volume), NULL);
    label = gtk_label_new_with_mnemonic ("AF Volume");
    box = gtk_vbox_new(FALSE, 0);
    gtk_box_pack_start(GTK_BOX (box), scale, TRUE, TRUE, 0);
    gtk_box_pack_start(GTK_BOX (box), label,  TRUE, TRUE, 0);

If you change the sliders, IC-7410 will respond perfectly, and it is much less frustrating to write a code yourself than deciphering the exiting ones.