1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
|
#include <stdio.h>
#include <sys/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <limits.h>
#include <libnjb.h>
extern int njb_error;
int main(int argc, char **argv)
{
njb_t njbs[NJB_MAX_DEVICES], *njb;
extern char *optarg;
int opt;
int i, n, debug;
eax_t *eax;
debug = 0;
while ((opt = getopt(argc, argv, "D:")) != -1) {
switch (opt) {
case 'D':
debug = atoi(optarg);
break;
default:
fprintf(stderr, "usage: dumpeax [ -D debuglvl ]\n");
return 1;
}
}
if (debug)
NJB_Set_Debug(debug);
if (NJB_Discover(njbs, 0, &n) == -1)
njb_error_dump(stderr);
if (n == 0) {
fprintf(stderr, "no NJB devices found\n");
return 0;
}
njb = njbs;
if (NJB_Open(njb) == -1) {
njb_error_dump(stderr);
return 1;
}
if (NJB_Capture(njb) == -1) {
njb_error_dump(stderr);
return 1;
}
eax = NJB_Get_EAX(njb);
/* Then the object can be refreshed repeatedly with this command,
* but it seems to be dangerous so don't use it. Create a new
* eax struct using NJB_Get_EAX() instead.
*/
/* NJB_Refresh_EAX(njb, eax); */
if (eax != NULL) {
printf("Volume: %u\n", eax->volume);
printf("Volume min: %u\n", eax->volumemin);
printf("Volume max: %u\n", eax->volumemax);
printf("Muted: %s\n", eax->muted ? "yes" : "no");
printf("EQ Active: %s\n", eax->eq_status ? "yes" : "no");
printf("Bass: %d\n", eax->bass);
printf("Bass min: %d\n", eax->bassmin);
printf("Bass max: %d\n", eax->bassmax);
printf("Midrange: %d\n", eax->midrange);
printf("Midrange min: %d\n", eax->midrangemin);
printf("Midrange max: %d\n", eax->midrangemax);
printf("Treble: %d\n", eax->treble);
printf("Treble min: %d\n", eax->treblemin);
printf("Treble max: %d\n", eax->treblemax);
printf("Number of Equalizer midrange frequencies: %u\n",
eax->nfreq);
printf("Midrange frequency setting: %u\n", eax->freqset);
printf("Midrange frequencies:\n");
for (i = 0; i < eax->nfreq; i++) {
printf("\t%u. %d\n", i, eax->frequencies[i]);
}
printf("Number of effects: %u\n", eax->neffects);
printf("Active effect: %u\n", eax->acteffect);
printf("Effects:\n");
for (i = 0; i < eax->neffects; i++) {
printf("\t%u. %s (amount: %u)\n", i,
eax->effects[i], eax->effamts[i]);
}
printf("Number of headphone modes: %u\n", eax->nphone);
printf("Active headphone mode: %u\n", eax->actphone);
printf("Headphone modes:\n");
for (i = 0; i < eax->nphone; i++) {
printf("\t%u. %s\n", i, eax->phonemodes[i]);
}
printf("Number of rear modes: %u\n", eax->nrear);
printf("Active rear mode: %u\n", eax->actrear);
printf("Rear modes:\n");
for (i = 0; i < eax->nrear; i++) {
printf("\t%u. %s\n", i, eax->rears[i]);
}
eax_destroy(eax);
}
if (njb_error != EO_EOM)
njb_error_dump(stderr);
NJB_Release(njb);
NJB_Close(njb);
return 0;
}
|