static void on_change_volume (GtkRange *range, gpointer data) { CD_APPLET_ENTER; int iNewVolume = (int) gtk_range_get_value (GTK_RANGE (range)); cd_debug ("%s (%d)", __func__, iNewVolume); cd_set_volume (iNewVolume); CD_APPLET_LEAVE(); }
/* * Description: Changes the volume settings. */ static void set_volume() { int lVol ; // left volume int rVol ; // right volume if ((lVol = valid_input_int( VOL_L , 1, 255 ) ) == -1 ) { show_error( CANCEL ) ; } else if ((rVol = valid_input_int( VOL_R , 1, 255 ) ) == -1 ) { show_error( CANCEL ) ; } else { cd_set_volume( lVol, rVol ) ; } }
int main() { char cmd[20]; int done = 0; int ret, trk, a, b; if (cd_init() < 0) { printf("Error initialising libcda (%s)\n", cd_error); return 1; } show_cmds(); do { printf(">>> "); fflush(stdout); scanf("%s", cmd); switch (cmd[0]) { case '?': show_cmds(); break; case 'p': trk = input_int("Track"); ret = cd_play(trk); if (ret != 0) printf("Error occurred (%s)\n", cd_error); break; case 'r': a = input_int("First track"); b = input_int("Last track"); ret = cd_play_range(a, b); if (ret != 0) printf("Error occurred (%s)\n", cd_error); break; case 'f': trk = input_int("Start track"); ret = cd_play_from(trk); if (ret != 0) printf("Error occurred (%s)\n", cd_error); break; case 'P': trk = cd_current_track(); if (trk) printf("Playing track %d\n", trk); else printf("Not playing\n"); break; case 'w': cd_pause(); break; case 'W': cd_resume(); break; case 'S': ret = cd_is_paused(); if (ret) printf("Paused\n"); else printf("Not paused\n"); break; case 's': cd_stop(); break; case 'i': ret = cd_get_tracks(&a, &b); if (ret != 0) printf("Error occurred (%s)\n", cd_error); else printf("First track: %d\nLast track: %d\n", a, b); break; case 'a': trk = input_int("Track"); ret = cd_is_audio(trk); if (ret < 0) printf("Error occurred (%s)\n", cd_error); else printf("Track %d is %s\n", trk, (ret ? "audio" : "data")); break; case 'v': a = input_int("Left (0-255)"); b = input_int("Right (0-255)"); cd_set_volume(a, b); break; case 'V': cd_get_volume(&a, &b); printf("Left volume: %d\nRight volume: %d\n", a, b); break; case 'e': cd_eject(); break; case 'c': cd_close(); break; case 'q': done = 1; break; default: printf("Unrecognised command: `%c'\n", cmd[0]); } } while (!done); cd_exit(); return 0; }