00001 #include "common.h"
00002
00003 int main(int argc, char **argv)
00004 {
00005 njb_t njbs[NJB_MAX_DEVICES], *njb;
00006 extern char *optarg;
00007 int opt;
00008 int i, n, debug;
00009 njb_eax_t *eax;
00010
00011 debug = 0;
00012 while ((opt = getopt(argc, argv, "D:")) != -1) {
00013 switch (opt) {
00014 case 'D':
00015 debug = atoi(optarg);
00016 break;
00017 default:
00018 fprintf(stderr, "usage: dumpeax [ -D debuglvl ]\n");
00019 return 1;
00020 }
00021 }
00022
00023 if (debug)
00024 NJB_Set_Debug(debug);
00025
00026 if (NJB_Discover(njbs, 0, &n) == -1) {
00027 fprintf(stderr, "could not locate any jukeboxes\n");
00028 exit(1);
00029 }
00030
00031 if (n == 0) {
00032 fprintf(stderr, "no NJB devices found\n");
00033 return 0;
00034 }
00035
00036 njb = njbs;
00037
00038 if (NJB_Open(njb) == -1) {
00039 NJB_Error_Dump(njb, stderr);
00040 return 1;
00041 }
00042
00043 if (NJB_Capture(njb) == -1) {
00044 NJB_Error_Dump(njb, stderr);
00045 return 1;
00046 }
00047
00048 NJB_Reset_Get_EAX_Type (njb);
00049
00050 while ((eax = NJB_Get_EAX_Type (njb)) != NULL) {
00051 printf("------------------------------------------\n");
00052 printf("Effect number: %04X\n", eax->number);
00053 printf("Effect name: %s\n", eax->name);
00054 printf("Effect group %d\n", eax->group);
00055 if (eax->exclusive != 0x00) {
00056 printf("Effect is exclusive\n");
00057 }
00058 if (eax->type == NJB_EAX_FIXED_OPTION_CONTROL) {
00059 printf("Effect has fixed options:\n");
00060 printf(" Current selection: %d\n", eax->current_value);
00061 for(i = 0; i < eax->max_value - eax->min_value + 1; i++) {
00062 printf(" %d. %s\n", eax->min_value+i, eax->option_names[i]);
00063 }
00064 }
00065 if (eax->type == NJB_EAX_SLIDER_CONTROL) {
00066 printf("Effect is a slider:\n");
00067 printf(" Current value: %d\n", eax->current_value);
00068 printf(" Min value: %d\n", eax->min_value);
00069 printf(" Max value %d\n", eax->max_value);
00070 }
00071 NJB_Destroy_EAX_Type (eax);
00072 }
00073
00074
00075 NJB_Error_Dump(njb, stderr);
00076
00077 NJB_Release(njb);
00078
00079 NJB_Close(njb);
00080 return 0;
00081 }