mirror of
https://github.com/gryf/wmamixer.git
synced 2025-12-17 11:30:21 +01:00
Added couple of missing icons; fix for the control names, removed config file
This commit is contained in:
7
README
7
README
@@ -16,10 +16,9 @@ Changes
|
|||||||
|
|
||||||
Changes with comparison with wmsmixer:
|
Changes with comparison with wmsmixer:
|
||||||
|
|
||||||
- ALSA instead of OSS. This is real thing, using alsa-lib, not just emulation
|
- ALSA instead of OSS. This is the real thing, using alsa-lib, not just
|
||||||
of OSS.
|
emulation of OSS.
|
||||||
- Placement of configuration file changed to "$XDG_CONFIG_HOME/wmamixer.conf",
|
- Removed config file support, since it doesn't apply anymore
|
||||||
which usually translate to "$HOME/.config/wmamixer.conf"
|
|
||||||
|
|
||||||
Limitations
|
Limitations
|
||||||
-----------
|
-----------
|
||||||
|
|||||||
BIN
XPM/icons.xcf
BIN
XPM/icons.xcf
Binary file not shown.
@@ -1,35 +1,35 @@
|
|||||||
/* XPM */
|
/* XPM */
|
||||||
static char *icons_xpm[] = {
|
static char *icons_xpm[] = {
|
||||||
/* columns rows colors chars-per-pixel */
|
/* columns rows colors chars-per-pixel */
|
||||||
"234 24 4 1 ",
|
"416 24 4 1 ",
|
||||||
". c #202020 s back_color",
|
". c #202020 s back_color",
|
||||||
"+ c #00C9C1 s led_color_high",
|
"+ c #00C9C1 s led_color_high",
|
||||||
"@ c #0C8580 s led_color_med ",
|
"@ c #0C8580 s led_color_med ",
|
||||||
"# c #184A48 s led_color_low",
|
"# c #184A48 s led_color_low",
|
||||||
|
|
||||||
/* pixels */
|
/* pixels */
|
||||||
"..........................................................................................................................................................................................................................................",
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................",
|
||||||
"..........................................................................................................................................................................................................................................",
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................",
|
||||||
"..........................................................................................................................................................................................................................................",
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................",
|
||||||
"..........................................................................................................................................................................................................................................",
|
".................................................................................................................................................................................................................................................................................++..................................................................................................@......@...................................",
|
||||||
"....................................+...............................................#..........................#++..............................................#++#.............................##@@..##................#@++++@#.........",
|
"....................................+...............................................#..........................#++..............................................#++#.............................##@@..##................#@++++@#.................#######.......................+..+...................................................................#+++++++++++++#................@....@....................................",
|
||||||
"....................................+........................++...................#+++#.......................#++#+......................#++++++#...............+.#+............................#+@##@@@................#+@#..#@+#........",
|
"....................................+........................++...................#+++#.......................#++#+......................#++++++#...............+.#+............................#+@##@@@................#+@#..#@+#...............#++++++++#....................#+..+#............................................#++++++#............@+++++++++++++++++@...............@..@.................+++++++.............",
|
||||||
".................................+.++....+..+.+.............++#+..................+++++.......................++#+#+....................#++++++++++++#+............+...........................#+......................#+#......#+#.......",
|
".................................+.++....+..+.+.............++#+..................+++++.......................++#+#+....................#++++++++++++#+............+...........................#+......................#+#......#+#.............#++@#..@+++@...................#+..+#..........................................#++###+++++#.........+++++++++++++++++++++...............@@..................+#####+#............",
|
||||||
".................................+.++....+..+.+............+#+.+.......+.........#+++++#......................+#+#++...................#+++++++....+.+.+.........#+#...........................#+......................+#........#+.......",
|
".................................+.++....+..+.+............+#+.+.......+.........#+++++#......................+#+#++...................#+++++++....+.+.+.........#+#...........................#+......................+#........#+.............+++.....#+++@..++...............+..+...........................................++####++++++.........+++++@#.......#@+++++........#++++++++++++++#...........+#....+#............",
|
||||||
"............................+.+.++.++...++..+.++..........+#+.###......#+.........+++++........................+#++.+..................+#++++++++++++#+..........+#.............................#+....................#+..........+#......",
|
"............................+.+.++.++...++..+.++..........+#+.###......#+.........+++++........................+#++.+..................+#++++++++++++#+..........+#.............................#+....................#+..........+#...........#++#......#+++#.++................++................+++++++++++++++............#+++###++++@+#........++++@..++...++..@++++........++++++++++++++++...........+#....+#............",
|
||||||
"...................#+.......+.+.+++++.+.++.++.++.........+##+#.#+..+....+.........#+++#..........#+.............++##.+.................+.#++++++#................#.............#+................#+...................@+..........+@......",
|
"...................#+.......+.+.+++++.+.++.++.++.........+##+#.#+..+....+.........#+++#..........#+.............++##.+.................+.#++++++#................#.............#+................#+...................@+..........+@...........#+++#......+++#..................#+#................+#+#+#+#+#+#+#+#...........+##+###+++@+++.........++#...++...++...#++.........+++####..#...+++...........+#....+#............",
|
||||||
".................#+++.......+++.+++++++.+++++++++........###++#.+..#+.#.#+..........#..........#+++...............+##.+................+.........................+#..........#+++..........#++++++++++++++#..........@++#........#++@.....",
|
".................#+++.......+++.+++++++.+++++++++........###++#.+..#+.#.#+..........#..........#+++...............+##.+................+.........................+#..........#+++..........#++++++++++++++#..........@++#........#++@...........++++......+++#.................++++#...............+#+#+#+#+#+#+#+#...........+#####+++@++++..............+++++++++..............++#######.#...++...........+#....+#............",
|
||||||
"...............#+++++.......+++++++++++++++++++++........###+#+.#.+.+.+..+...................#+++++................+##.+...............#+..................................#+++++..........+##..#..#..#.@#+.........@++++........++++@....",
|
"...............#+++++.......+++++++++++++++++++++........###+#+.#.+.+.+..+...................#+++++................+##.+...............#+..................................#+++++..........+##..#..#..#.@#+.........@++++........++++@..........#++#......+++#.++.............#+#.++...............+#+#+#+#+#+#+#+#...........+####+..+####+............++#########++............++##@@####..#.++.......+++++#....+#....+++++...",
|
||||||
".............#+++++++.......@@@@@@@@@@@@@@@@@@@@@........#.#+#+.+.#.+.#..+.................#+++++++.................+##.+...............#+...............................#+++++++.........#+#@.#@.#@.#@.#.+#........+@+++........+++@+....",
|
".............#+++++++.......@@@@@@@@@@@@@@@@@@@@@........#.#+#+.+.#.+.#..+.................#+++++++.................+##.+...............#+...............................#+++++++.........#+#@.#@.#@.#@.#.+#........+@+++........+++@+...................#+++#.++............++#.++++..............+#.#.#.#.#.#.#+#...........+####+..+####+...........+###+@#+@#+@##+...........++##@@@##.#...++........#####....+#....+#####..",
|
||||||
"...........#+++++++++.......+++++++++++++++++++++.........#.++..+..#+....+...............#+++++++++..................+##.+...............+.............................#+++++++++.........+#..#..#..#..#.##+........+#+++........+++#+....",
|
"...........#+++++++++.......+++++++++++++++++++++.........#.++..+..#+....+...............#+++++++++..................+##.+...............+.............................#+++++++++.........+#..#..#..#..#.##+........+#+++........+++#+...................++++...............#+#.+.+..+.............+#.#.#.#.#.#.#+#...........++++@+++#####+..........+####@@#@@#@@###+..........++###@#####.#.++.................+#....+#......",
|
||||||
".........#+++++++++++.......+.+++++++++++++++++++........+.#+...+..+....+..............#+++++++++++...................+##+...............+...........................#+++++++++++........#+@.#@.#@.#@.#@.@#+#.......+#+++........+++#+....",
|
".........#+++++++++++.......+.+++++++++++++++++++........+.#+...+..+....+..............#+++++++++++...................+##+...............+...........................#+++++++++++........#+@.#@.#@.#@.#@.@#+#.......+#+++........+++#+..................++++................#+..+..+.+.............+++++++++++++++#...........+++@+++##++##+..........+####+@#+@#+@###+..........++########.#..++.................+#....+#......",
|
||||||
".......#+++++++++++++.......+.++++.++++.++++++++..........+#+..##......#+............#+++++++++++++....................+++...............+.........................#+++++++++++++........+#.#..#..#..#..#..#+.......+@+++........+++@+....",
|
".......#+++++++++++++.......+.++++.++++.++++++++..........+#+..##......#+............#+++++++++++++....................+++...............+.........................#+++++++++++++........+#.#..#..#..#..#..#+.......+@+++........+++@+................#++++.................#+.....+.+..............###############...........#+@++++###+++#..........+####@@#@@#@@###+..........++########.#.#++.................+#....+#......",
|
||||||
".....#+++++++++++++++.........++.+.++++..+.+++.+...........+.+.+.......+...........#+++++++++++++++.......................+.............++.......................#+++++++++++++++........++++++++++++++++++++.......@++++........++++@....",
|
".....#+++++++++++++++.........++.+.++++..+.+++.+...........+.+.+.......+...........#+++++++++++++++.......................+.............++.......................#+++++++++++++++........++++++++++++++++++++.......@++++........++++@..............@++++#...................#+...#+#+.........................................++++++####++...........+####+@#+@#+@###+..........+++#.#.#.#...+++.................+#....+#......",
|
||||||
"....+++++++++++++++++..........+.+.++.+..+.++..+............++#+..................+++++++++++++++++................#+++...+#...........++.......................+++++++++++++++++........++++++++++++++++++++........@++#........#++@.....",
|
"....+++++++++++++++++..........+.+.++.+..+.++..+............++#+..................+++++++++++++++++................#+++...+#...........++.......................+++++++++++++++++........++++++++++++++++++++........@++#........#++@..............++++#......................#++++++..........................................#+++++###++#...........+####@@#@@#@@###+..........++++++++++++++++.................+++++++#......",
|
||||||
"...............................+.+..+.+....+.................++....................................................+...+++#...........++..................................................................................................",
|
"...............................+.+..+.+....+.................++....................................................+...+++#...........++...........................................................................................................@+#.............................+#............................................#++++++#.............+###############+..........#++++++++++++++#..................#######......",
|
||||||
".................................+..+.................................................................................................+...................................................................................................",
|
".................................+..+.................................................................................................+.........................................................................................................................................+++#...................................................................+++++++++++++++..........................................................",
|
||||||
"..........................................................................................................................................................................................................................................",
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................",
|
||||||
"..........................................................................................................................................................................................................................................",
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................",
|
||||||
"..........................................................................................................................................................................................................................................",
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................",
|
||||||
".........................................................................................................................................................................................................................................."
|
"................................................................................................................................................................................................................................................................................................................................................................................................................................"
|
||||||
};
|
};
|
||||||
|
|||||||
295
wmamixer.c
295
wmamixer.c
@@ -1,4 +1,4 @@
|
|||||||
// wmamixer - An alsa mixer designed for WindowMaker with scrollwheel support
|
// wmamixer - An ALSA mixer designed for WindowMaker with scrollwheel support
|
||||||
// Copyright (C) 2015 Roman Dobosz <gryf@vimja.com>
|
// Copyright (C) 2015 Roman Dobosz <gryf@vimja.com>
|
||||||
// Copyright (C) 2003 Damian Kramer <psiren@hibernaculum.net>
|
// Copyright (C) 2003 Damian Kramer <psiren@hibernaculum.net>
|
||||||
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
|
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
|
||||||
@@ -10,9 +10,6 @@
|
|||||||
|
|
||||||
#include "wmamixer.h"
|
#include "wmamixer.h"
|
||||||
|
|
||||||
// global mixer struct
|
|
||||||
struct Mixer *mix;
|
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
XGCValues gcv;
|
XGCValues gcv;
|
||||||
unsigned long gcm;
|
unsigned long gcm;
|
||||||
@@ -69,8 +66,6 @@ int main(int argc, char **argv) {
|
|||||||
|
|
||||||
mix = Mixer_create();
|
mix = Mixer_create();
|
||||||
|
|
||||||
readFile();
|
|
||||||
|
|
||||||
if (mix->devices_no == 0)
|
if (mix->devices_no == 0)
|
||||||
fprintf(stderr,"%s: Sorry, no supported channels found.\n", NAME);
|
fprintf(stderr,"%s: Sorry, no supported channels found.\n", NAME);
|
||||||
else {
|
else {
|
||||||
@@ -146,6 +141,7 @@ int main(int argc, char **argv) {
|
|||||||
XFreePixmap(d_display, pm_digits);
|
XFreePixmap(d_display, pm_digits);
|
||||||
XFreePixmap(d_display, pm_chars);
|
XFreePixmap(d_display, pm_chars);
|
||||||
freeXWin();
|
freeXWin();
|
||||||
|
Selem_destroy();
|
||||||
Mixer_destroy(mix);
|
Mixer_destroy(mix);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -220,87 +216,113 @@ struct Mixer *Mixer_create() {
|
|||||||
return mixer;
|
return mixer;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Guess and return short name for the mixer simple element */
|
|
||||||
void Mixer_set_selem_props(struct Selem *selem, const char *name) {
|
void Mixer_set_selem_props(struct Selem *selem, const char *name) {
|
||||||
const char *pcm = "PCM",
|
const char *pcm = "PCM",
|
||||||
*mic = "Mic",
|
*mic = "Mic",
|
||||||
*cap = "Capture",
|
*cap = "Capture",
|
||||||
*boost = "Boost",
|
*boost = "Boost",
|
||||||
*line = "Line";
|
*line = "Line",
|
||||||
char variable[5];
|
*aux = "Aux";
|
||||||
|
|
||||||
// Get the name. Simple match.
|
|
||||||
if (strcmp("Master", name) == 0) {
|
if (strcmp("Master", name) == 0) {
|
||||||
selem->name = "mstr";
|
selem->name = "mstr";
|
||||||
selem->iconIndex = 0;
|
selem->iconIndex = 0;
|
||||||
} else if (strstr(pcm, name)) {
|
} else if (strstr(pcm, name)) {
|
||||||
selem->iconIndex = 1;
|
selem->iconIndex = 1;
|
||||||
if (strcmp(pcm, name) == 0) {
|
if (strcmp(pcm, name) == 0)
|
||||||
selem->name = "pcm ";
|
selem->name = "pcm ";
|
||||||
} else {
|
else
|
||||||
sprintf(variable, "pcm%d", namesCount.pcm);
|
Selem_set_name(selem, "pcm", &namesCount.pcm);
|
||||||
selem->name = variable;
|
|
||||||
namesCount.pcm++;
|
|
||||||
}
|
|
||||||
} else if (strstr("Headphone", name)) {
|
} else if (strstr("Headphone", name)) {
|
||||||
selem->name = "hdph";
|
selem->name = "hdph";
|
||||||
selem->iconIndex = 8;
|
selem->iconIndex = 8;
|
||||||
} else if (strstr("Beep", name)) {
|
} else if (strstr("Beep", name) || strstr("PC Speaker", name)) {
|
||||||
selem->name = "beep";
|
selem->name = "beep";
|
||||||
selem->iconIndex = 7;
|
selem->iconIndex = 7;
|
||||||
} else if (strstr("Digital", name)) {
|
} else if (strstr("Digital", name)) {
|
||||||
selem->iconIndex = selem->capture ? 3 : 6;
|
selem->iconIndex = selem->capture ? 3 : 15;
|
||||||
selem->name = "digt";
|
selem->name = "digt";
|
||||||
|
} else if (strstr("Bass", name)) {
|
||||||
|
selem->name = "bass";
|
||||||
|
selem->iconIndex = 9;
|
||||||
|
} else if (strstr("Treble", name)) {
|
||||||
|
selem->name = "trbl";
|
||||||
|
selem->iconIndex = 10;
|
||||||
|
} else if (strstr("Synth", name)) {
|
||||||
|
selem->name = "synt";
|
||||||
|
selem->iconIndex = 11;
|
||||||
|
} else if (strstr("CD", name)) {
|
||||||
|
selem->name = " cd ";
|
||||||
|
selem->iconIndex = 12;
|
||||||
|
} else if (strstr("Phone", name)) {
|
||||||
|
selem->name = "phne";
|
||||||
|
selem->iconIndex = 13;
|
||||||
|
} else if (strstr("Video", name)) {
|
||||||
|
selem->name = "vdeo";
|
||||||
|
selem->iconIndex = 14;
|
||||||
} else if (strstr(mic, name)) {
|
} else if (strstr(mic, name)) {
|
||||||
if (strcmp(mic, name) == 0) {
|
if (strcmp(mic, name) == 0) {
|
||||||
selem->name = "mic ";
|
selem->name = "mic ";
|
||||||
} else {
|
} else {
|
||||||
if (strstr(boost, name)) {
|
if (strstr(boost, name))
|
||||||
sprintf(variable, "mib%d", namesCount.micb);
|
Selem_set_name(selem, "mib", &namesCount.micb);
|
||||||
namesCount.micb++;
|
else
|
||||||
} else {
|
Selem_set_name(selem, "mic", &namesCount.mic);
|
||||||
sprintf(variable, "mib%d", namesCount.mic);
|
|
||||||
namesCount.mic++;
|
|
||||||
}
|
|
||||||
selem->name = variable;
|
|
||||||
}
|
}
|
||||||
selem->iconIndex = 4;
|
selem->iconIndex = 4;
|
||||||
|
} else if (strstr(aux, name)) {
|
||||||
|
if (strcmp(aux, name) == 0) {
|
||||||
|
selem->name = "aux ";
|
||||||
|
} else {
|
||||||
|
Selem_set_name(selem, "aux", &namesCount.aux);
|
||||||
|
}
|
||||||
|
selem->iconIndex = 5;
|
||||||
} else if (strstr(line, name)) {
|
} else if (strstr(line, name)) {
|
||||||
if (strcmp(line, name) == 0) {
|
if (strcmp(line, name) == 0) {
|
||||||
selem->name = "line";
|
selem->name = "line";
|
||||||
} else {
|
} else {
|
||||||
if (strstr(boost, name)) {
|
if (strstr(boost, name))
|
||||||
sprintf(variable, "lnb%d", namesCount.lineb);
|
Selem_set_name(selem, "lnb", &namesCount.lineb);
|
||||||
namesCount.lineb++;
|
else
|
||||||
} else {
|
Selem_set_name(selem, "lin", &namesCount.line);
|
||||||
sprintf(variable, "lin%d", namesCount.line);
|
|
||||||
namesCount.line++;
|
|
||||||
}
|
|
||||||
selem->name = variable;
|
|
||||||
}
|
}
|
||||||
selem->iconIndex = 5;
|
selem->iconIndex = 5;
|
||||||
} else if (strstr(cap, name)) {
|
} else if (strstr(cap, name)) {
|
||||||
if (strcmp(cap, name) == 0) {
|
if (strcmp(cap, name) == 0) {
|
||||||
selem->name = "cap ";
|
selem->name = "cap ";
|
||||||
} else {
|
} else {
|
||||||
sprintf(variable, "cap%d", namesCount.capt);
|
Selem_set_name(selem, "cap", &namesCount.capt);
|
||||||
selem->name = variable;
|
|
||||||
namesCount.capt++;
|
|
||||||
}
|
}
|
||||||
selem->iconIndex = 3;
|
selem->iconIndex = 3;
|
||||||
} else {
|
} else {
|
||||||
/* defaults */
|
|
||||||
printf("defaults\n");
|
|
||||||
sprintf(variable, "vol%d", namesCount.vol);
|
|
||||||
namesCount.vol++;
|
namesCount.vol++;
|
||||||
selem->iconIndex = 6;
|
selem->iconIndex = 6;
|
||||||
|
Selem_set_name(selem, name, &namesCount.vol);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Selem_set_name(struct Selem *selem, const char *name, short int *count) {
|
||||||
|
char new_name[5], buf[5];
|
||||||
|
|
||||||
|
if (*count > 10)
|
||||||
|
snprintf(new_name, 5, "%s", name);
|
||||||
|
else {
|
||||||
|
snprintf(buf, 4, "%s", name);
|
||||||
|
printf("%s: %s\n", name, buf);
|
||||||
|
snprintf(new_name, 5, "%s%d", buf, *count);
|
||||||
|
}
|
||||||
|
|
||||||
|
selem->name = new_name;
|
||||||
|
*count = *count + 1;
|
||||||
|
}
|
||||||
|
|
||||||
void Mixer_set_channels(struct Selem *selem) {
|
void Mixer_set_channels(struct Selem *selem) {
|
||||||
int idx;
|
int idx;
|
||||||
snd_mixer_selem_channel_id_t chn;
|
snd_mixer_selem_channel_id_t chn;
|
||||||
|
|
||||||
|
selem->stereo = true;
|
||||||
|
|
||||||
if (snd_mixer_selem_has_playback_volume(selem->elem)) {
|
if (snd_mixer_selem_has_playback_volume(selem->elem)) {
|
||||||
if (snd_mixer_selem_is_playback_mono(selem->elem)) {
|
if (snd_mixer_selem_is_playback_mono(selem->elem)) {
|
||||||
selem->stereo = false;
|
selem->stereo = false;
|
||||||
@@ -452,26 +474,38 @@ void Mixer_destroy(struct Mixer *mixer) {
|
|||||||
free(mixer);
|
free(mixer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initXWin(int argc, char **argv)
|
void Selem_destroy() {
|
||||||
{
|
int i;
|
||||||
|
|
||||||
|
for (i = 0; i < mix->devices_no; i++) {
|
||||||
|
free(selems[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void initXWin(int argc, char **argv) {
|
||||||
|
bool pos;
|
||||||
winsize = astep ? ASTEPSIZE : NORMSIZE;
|
winsize = astep ? ASTEPSIZE : NORMSIZE;
|
||||||
|
XWMHints wmhints;
|
||||||
|
XSizeHints shints;
|
||||||
|
|
||||||
if ((d_display = XOpenDisplay(display)) == NULL) {
|
if ((d_display = XOpenDisplay(display)) == NULL) {
|
||||||
fprintf(stderr,"%s: Unable to open X display '%s'.\n", NAME, XDisplayName(display));
|
fprintf(stderr, "%s: Unable to open X display '%s'.\n", NAME,
|
||||||
|
XDisplayName(display));
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
_XA_GNUSTEP_WM_FUNC=XInternAtom(d_display, "_GNUSTEP_WM_FUNCTION", false);
|
_XA_GNUSTEP_WM_FUNC = XInternAtom(d_display, "_GNUSTEP_WM_FUNCTION",
|
||||||
|
false);
|
||||||
deleteWin = XInternAtom(d_display, "WM_DELETE_WINDOW", false);
|
deleteWin = XInternAtom(d_display, "WM_DELETE_WINDOW", false);
|
||||||
|
|
||||||
w_root=DefaultRootWindow(d_display);
|
w_root=DefaultRootWindow(d_display);
|
||||||
|
|
||||||
XWMHints wmhints;
|
|
||||||
XSizeHints shints;
|
|
||||||
shints.x = 0;
|
shints.x = 0;
|
||||||
shints.y = 0;
|
shints.y = 0;
|
||||||
shints.flags = 0;
|
shints.flags = 0;
|
||||||
bool pos=(XWMGeometry(d_display, DefaultScreen(d_display), position, NULL, 0, &shints, &shints.x, &shints.y,
|
pos = (XWMGeometry(d_display, DefaultScreen(d_display), position, NULL, 0,
|
||||||
&shints.width, &shints.height, &shints.win_gravity) & (XValue | YValue));
|
&shints, &shints.x, &shints.y, &shints.width, &shints.height,
|
||||||
|
&shints.win_gravity) & (XValue | YValue)) == 1;
|
||||||
shints.min_width = winsize;
|
shints.min_width = winsize;
|
||||||
shints.min_height = winsize;
|
shints.min_height = winsize;
|
||||||
shints.max_width = winsize;
|
shints.max_width = winsize;
|
||||||
@@ -490,8 +524,7 @@ void initXWin(int argc, char **argv)
|
|||||||
createWin(&w_icon, shints.x, shints.y);
|
createWin(&w_icon, shints.x, shints.y);
|
||||||
w_activewin = w_icon;
|
w_activewin = w_icon;
|
||||||
wmhints.icon_window = w_icon;
|
wmhints.icon_window = w_icon;
|
||||||
}
|
} else {
|
||||||
else{
|
|
||||||
wmhints.initial_state = NormalState;
|
wmhints.initial_state = NormalState;
|
||||||
wmhints.flags = WindowGroupHint | StateHint;
|
wmhints.flags = WindowGroupHint | StateHint;
|
||||||
w_activewin = w_main;
|
w_activewin = w_main;
|
||||||
@@ -505,25 +538,24 @@ void initXWin(int argc, char **argv)
|
|||||||
XSetWMProtocols(d_display, w_activewin, &deleteWin, 1);
|
XSetWMProtocols(d_display, w_activewin, &deleteWin, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void freeXWin()
|
void freeXWin() {
|
||||||
{
|
|
||||||
XDestroyWindow(d_display, w_main);
|
XDestroyWindow(d_display, w_main);
|
||||||
if (wmaker)
|
if (wmaker)
|
||||||
XDestroyWindow(d_display, w_icon);
|
XDestroyWindow(d_display, w_icon);
|
||||||
XCloseDisplay(d_display);
|
XCloseDisplay(d_display);
|
||||||
}
|
}
|
||||||
|
|
||||||
void createWin(Window *win, int x, int y)
|
void createWin(Window *win, int x, int y) {
|
||||||
{
|
|
||||||
XClassHint classHint;
|
XClassHint classHint;
|
||||||
*win=XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0, 0, 0);
|
*win = XCreateSimpleWindow(d_display, w_root, x, y, winsize, winsize, 0,
|
||||||
|
0, 0);
|
||||||
classHint.res_name = NAME;
|
classHint.res_name = NAME;
|
||||||
classHint.res_class = CLASS;
|
classHint.res_class = CLASS;
|
||||||
XSetClassHint(d_display, *win, &classHint);
|
XSetClassHint(d_display, *win, &classHint);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2)
|
unsigned long mixColor(char *colorname1, int prop1, char *colorname2,
|
||||||
{
|
int prop2) {
|
||||||
XColor color, color1, color2;
|
XColor color, color1, color2;
|
||||||
XWindowAttributes winattr;
|
XWindowAttributes winattr;
|
||||||
XGetWindowAttributes(d_display, w_root, &winattr);
|
XGetWindowAttributes(d_display, w_root, &winattr);
|
||||||
@@ -531,7 +563,8 @@ unsigned long mixColor(char *colorname1, int prop1, char *colorname2, int prop2)
|
|||||||
XParseColor(d_display, winattr.colormap, colorname2, &color2);
|
XParseColor(d_display, winattr.colormap, colorname2, &color2);
|
||||||
color.pixel = 0;
|
color.pixel = 0;
|
||||||
color.red = (color1.red * prop1 + color2.red * prop2) / (prop1 + prop2);
|
color.red = (color1.red * prop1 + color2.red * prop2) / (prop1 + prop2);
|
||||||
color.green=(color1.green*prop1+color2.green*prop2)/(prop1+prop2);
|
color.green = (color1.green * prop1 + color2.green * prop2) /
|
||||||
|
(prop1 + prop2);
|
||||||
color.blue = (color1.blue * prop1 + color2.blue * prop2) / (prop1 + prop2);
|
color.blue = (color1.blue * prop1 + color2.blue * prop2) / (prop1 + prop2);
|
||||||
color.flags = DoRed | DoGreen | DoBlue;
|
color.flags = DoRed | DoGreen | DoBlue;
|
||||||
XAllocColor(d_display, winattr.colormap, &color);
|
XAllocColor(d_display, winattr.colormap, &color);
|
||||||
@@ -627,87 +660,6 @@ void scanArgs(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void readFile() {
|
|
||||||
FILE *rcfile;
|
|
||||||
int done, current = -1;
|
|
||||||
char *confpath, buf[256];
|
|
||||||
|
|
||||||
if (getenv("XDG_CONFIG_HOME")) {
|
|
||||||
confpath = malloc(snprintf(NULL, 0, "%s%s", getenv("XDG_CONFIG_HOME"),
|
|
||||||
"/wmamixer.conf") + 1);
|
|
||||||
sprintf(confpath, "%s%s", getenv("XDG_CONFIG_HOME"), "/wmamixer.conf");
|
|
||||||
} else {
|
|
||||||
confpath = malloc(snprintf(NULL, 0, "%s%s", getenv("HOME"),
|
|
||||||
"/.config/wmamixer.conf") + 1);
|
|
||||||
sprintf(confpath, "%s%s", getenv("HOME"), "/.config/wmamixer.conf");
|
|
||||||
}
|
|
||||||
|
|
||||||
if(access(confpath, 0) != 0) {
|
|
||||||
fprintf(stderr, "%s: No config file found.\n", NAME);
|
|
||||||
free(confpath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((rcfile = fopen(confpath, "r")) == NULL) {
|
|
||||||
fprintf(stderr, "%s: Cannot open config file. Using defaults.\n",
|
|
||||||
NAME);
|
|
||||||
free(confpath);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
do {
|
|
||||||
fgets(buf, 250, rcfile);
|
|
||||||
if ((done=feof(rcfile)) == 0) {
|
|
||||||
buf[strlen(buf) - 1] = 0;
|
|
||||||
|
|
||||||
if (strncmp(buf, "setchannel ", strlen("setchannel ")) == 0) {
|
|
||||||
sscanf(buf, "setchannel %i", ¤t);
|
|
||||||
if (current >= mix->devices_no ) {
|
|
||||||
fprintf(stderr,"%s: Sorry, this channel (%i) is "
|
|
||||||
"not supported.\n", NAME, current);
|
|
||||||
current = -1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp(buf, "setmono ", strlen("setmono ")) == 0) {
|
|
||||||
if (current == -1) {
|
|
||||||
fprintf(stderr,"%s: Sorry, no current channel.\n",
|
|
||||||
NAME);
|
|
||||||
} else {
|
|
||||||
int value;
|
|
||||||
sscanf(buf, "setmono %i", &value);
|
|
||||||
Mixer_set_left(current, value);
|
|
||||||
Mixer_set_right(current, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp(buf, "setleft ", strlen("setleft ")) == 0 ) {
|
|
||||||
if (current == -1) {
|
|
||||||
fprintf(stderr, "%s: Sorry, no current channel.\n",
|
|
||||||
NAME);
|
|
||||||
} else {
|
|
||||||
int value;
|
|
||||||
sscanf(buf, "setleft %i", &value);
|
|
||||||
Mixer_set_left(current, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strncmp(buf, "setright ", strlen("setright ")) == 0 ) {
|
|
||||||
if (current == -1) {
|
|
||||||
fprintf(stderr, "%s: Sorry, no current channel.\n",
|
|
||||||
NAME);
|
|
||||||
} else{
|
|
||||||
int value;
|
|
||||||
sscanf(buf, "setleft %i", &value);
|
|
||||||
Mixer_set_right(current, value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} while (done == 0);
|
|
||||||
fclose(rcfile);
|
|
||||||
free(confpath);
|
|
||||||
}
|
|
||||||
|
|
||||||
void checkVol(bool forced) {
|
void checkVol(bool forced) {
|
||||||
int nl = Mixer_read_left(curchannel);
|
int nl = Mixer_read_left(curchannel);
|
||||||
int nr = Mixer_read_right(curchannel);
|
int nr = Mixer_read_right(curchannel);
|
||||||
@@ -721,14 +673,14 @@ void checkVol(bool forced) {
|
|||||||
if (nl != curleft) {
|
if (nl != curleft) {
|
||||||
curleft = nl;
|
curleft = nl;
|
||||||
if (selems[curchannel]->stereo)
|
if (selems[curchannel]->stereo)
|
||||||
drawLeft();
|
drawStereo(true);
|
||||||
else
|
else
|
||||||
drawMono();
|
drawMono();
|
||||||
}
|
}
|
||||||
if (nr != curright) {
|
if (nr != curright) {
|
||||||
curright = nr;
|
curright = nr;
|
||||||
if (selems[curchannel]->stereo)
|
if (selems[curchannel]->stereo)
|
||||||
drawRight();
|
drawStereo(false);
|
||||||
else
|
else
|
||||||
drawMono();
|
drawMono();
|
||||||
}
|
}
|
||||||
@@ -801,8 +753,7 @@ void releaseEvent() {
|
|||||||
repaint();
|
repaint();
|
||||||
}
|
}
|
||||||
|
|
||||||
void motionEvent(XMotionEvent *xev)
|
void motionEvent(XMotionEvent *xev) {
|
||||||
{
|
|
||||||
int x = xev->x - (winsize / 2 - 32);
|
int x = xev->x - (winsize / 2 - 32);
|
||||||
int y = xev->y - (winsize / 2 - 32);
|
int y = xev->y - (winsize / 2 - 32);
|
||||||
if (x >= 37 && x <= 56 && y >= 8 && dragging) {
|
if (x >= 37 && x <= 56 && y >= 8 && dragging) {
|
||||||
@@ -817,9 +768,9 @@ void motionEvent(XMotionEvent *xev)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void repaint()
|
void repaint() {
|
||||||
{
|
XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64,
|
||||||
XCopyArea(d_display, pm_disp, w_activewin, gc_gc, 0, 0, 64, 64, winsize/2-32, winsize/2-32);
|
winsize / 2 - 32, winsize / 2 - 32);
|
||||||
XEvent xev;
|
XEvent xev;
|
||||||
while(XCheckTypedEvent(d_display, Expose, &xev));
|
while(XCheckTypedEvent(d_display, Expose, &xev));
|
||||||
}
|
}
|
||||||
@@ -830,8 +781,8 @@ void update() {
|
|||||||
XCopyArea(d_display, pm_icon, pm_disp, gc_gc,
|
XCopyArea(d_display, pm_icon, pm_disp, gc_gc,
|
||||||
selems[curchannel]->iconIndex * 26, 0, 26, 24, 5, 19);
|
selems[curchannel]->iconIndex * 26, 0, 26, 24, 5, 19);
|
||||||
if (selems[curchannel]->stereo) {
|
if (selems[curchannel]->stereo) {
|
||||||
drawLeft();
|
drawStereo(true);
|
||||||
drawRight();
|
drawStereo(false);
|
||||||
} else {
|
} else {
|
||||||
drawMono();
|
drawMono();
|
||||||
}
|
}
|
||||||
@@ -878,35 +829,22 @@ void drawVolLevel() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawLeft() {
|
void drawStereo(bool left) {
|
||||||
int i;
|
int i;
|
||||||
|
short pos = left? 37 : 48;
|
||||||
|
|
||||||
XSetForeground(d_display, gc_gc, color[0]);
|
XSetForeground(d_display, gc_gc, color[0]);
|
||||||
XFillRectangle(d_display, pm_disp, gc_gc, 46, 7, 2, 49);
|
XFillRectangle(d_display, pm_disp, gc_gc, 46, 7, 2, 49);
|
||||||
|
|
||||||
XSetForeground(d_display, gc_gc, color[1]);
|
XSetForeground(d_display, gc_gc, color[1]);
|
||||||
for (i = 0; i < 25; i++) {
|
for (i = 0; i < 25; i++) {
|
||||||
if (i==(curleft*25)/100)
|
if (i == ((left ? curleft : curright) * 25) / 100)
|
||||||
XSetForeground(d_display, gc_gc, color[3]);
|
XSetForeground(d_display, gc_gc, color[3]);
|
||||||
XFillRectangle(d_display, pm_disp, gc_gc, 37, 55-2*i, 9, 1);
|
XFillRectangle(d_display, pm_disp, gc_gc, pos, 55 - 2 * i, 9, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawRight()
|
void drawMono() {
|
||||||
{
|
|
||||||
int i;
|
|
||||||
XSetForeground(d_display, gc_gc, color[0]);
|
|
||||||
XFillRectangle(d_display, pm_disp, gc_gc, 46, 7, 2, 49);
|
|
||||||
|
|
||||||
XSetForeground(d_display, gc_gc, color[1]);
|
|
||||||
for (i=0;i<25;i++) {
|
|
||||||
if (i==(curright*25)/100)
|
|
||||||
XSetForeground(d_display, gc_gc, color[3]);
|
|
||||||
XFillRectangle(d_display, pm_disp, gc_gc, 48, 55-2*i, 9, 1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void drawMono()
|
|
||||||
{
|
|
||||||
int i;
|
int i;
|
||||||
XSetForeground(d_display, gc_gc, color[1]);
|
XSetForeground(d_display, gc_gc, color[1]);
|
||||||
for (i = 0; i < 25; i++) {
|
for (i = 0; i < 25; i++) {
|
||||||
@@ -916,24 +854,25 @@ void drawMono()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void drawBtns(int btns) {
|
||||||
void drawBtns(int btns)
|
|
||||||
{
|
|
||||||
if (btns & BTNPREV)
|
if (btns & BTNPREV)
|
||||||
drawBtn(5, 47, 13, 11, (btnstate & BTNPREV));
|
drawBtn(5, 47, 13, 11, (btnstate & BTNPREV));
|
||||||
if (btns & BTNNEXT)
|
if (btns & BTNNEXT)
|
||||||
drawBtn(18, 47, 13, 11, (btnstate & BTNNEXT));
|
drawBtn(18, 47, 13, 11, (btnstate & BTNNEXT));
|
||||||
}
|
}
|
||||||
|
|
||||||
void drawBtn(int x, int y, int w, int h, bool down)
|
void drawBtn(int x, int y, int w, int h, bool down) {
|
||||||
{
|
if (!down) {
|
||||||
if (!down)
|
|
||||||
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w, h, x, y);
|
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w, h, x, y);
|
||||||
else {
|
} else {
|
||||||
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, 1, h-1, x+w-1, y+1);
|
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, 1, h - 1,
|
||||||
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+w-1, y+1, 1, h-1, x, y);
|
x + w - 1, y + 1);
|
||||||
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w-1, 1, x+1, y+h-1);
|
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x + w - 1, y + 1, 1,
|
||||||
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x+1, y+h-1, w-1, 1, x, y);
|
h - 1, x, y);
|
||||||
|
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x, y, w - 1, 1, x + 1,
|
||||||
|
y + h - 1);
|
||||||
|
XCopyArea(d_display, pm_main, pm_disp, gc_gc, x + 1, y + h - 1, w - 1,
|
||||||
|
1, x, y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,116 +0,0 @@
|
|||||||
# User config file
|
|
||||||
# Should be saved as $XDG_CONFIG_HOME/wmamixer.conf (XDG_CONFIG_HOME is
|
|
||||||
# usually accessible under ~/.config direcotry)
|
|
||||||
# Comments and blank lines mostly allowed
|
|
||||||
|
|
||||||
# The format of this file is a series of commands:
|
|
||||||
|
|
||||||
# addchannel %i
|
|
||||||
# Adds a channel to the sequence. %i specifies a channel.
|
|
||||||
# These are the values from my <linux/soundcard.h>:
|
|
||||||
#
|
|
||||||
# SOUND_MIXER_VOLUME 0
|
|
||||||
# SOUND_MIXER_BASS 1
|
|
||||||
# SOUND_MIXER_TREBLE 2
|
|
||||||
# SOUND_MIXER_SYNTH 3
|
|
||||||
# SOUND_MIXER_PCM 4
|
|
||||||
# SOUND_MIXER_SPEAKER 5
|
|
||||||
# SOUND_MIXER_LINE 6
|
|
||||||
# SOUND_MIXER_MIC 7
|
|
||||||
# SOUND_MIXER_CD 8
|
|
||||||
# SOUND_MIXER_IMIX 9 /* Recording monitor */
|
|
||||||
# SOUND_MIXER_ALTPCM 10
|
|
||||||
# SOUND_MIXER_RECLEV 11 /* Recording level */
|
|
||||||
# SOUND_MIXER_IGAIN 12 /* Input gain */
|
|
||||||
# SOUND_MIXER_OGAIN 13 /* Output gain */
|
|
||||||
# SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */
|
|
||||||
# SOUND_MIXER_LINE2 15 /* Input source 2 (aux2) */
|
|
||||||
# SOUND_MIXER_LINE3 16 /* Input source 3 (line) */
|
|
||||||
# SOUND_MIXER_DIGITAL1 17 /* Digital (input) 1 */
|
|
||||||
# SOUND_MIXER_DIGITAL2 18 /* Digital (input) 2 */
|
|
||||||
# SOUND_MIXER_DIGITAL3 19 /* Digital (input) 3 */
|
|
||||||
# SOUND_MIXER_PHONEIN 20 /* Phone input */
|
|
||||||
# SOUND_MIXER_PHONEOUT 21 /* Phone output */
|
|
||||||
# SOUND_MIXER_VIDEO 22 /* Video/TV (audio) in */
|
|
||||||
# SOUND_MIXER_RADIO 23 /* Radio in */
|
|
||||||
# SOUND_MIXER_MONITOR 24 /* Monitor (usually mic) volume */
|
|
||||||
#
|
|
||||||
# Ths channel added becomes the current channel for subsequent
|
|
||||||
# setmono, setleft, setright and setname commands.
|
|
||||||
|
|
||||||
# setchannel %i
|
|
||||||
# Similar to addchannel, except the channel is not actually added
|
|
||||||
# to the sequence, merely made the current channel for subsequent
|
|
||||||
# setmono, setleft, setright and setname commands.
|
|
||||||
|
|
||||||
# setmono %i
|
|
||||||
# Sets both left and right volumes for the current channel.
|
|
||||||
# The channel may be mono or stereo.
|
|
||||||
# The value specified must be an integer in the range 0 to 100.
|
|
||||||
|
|
||||||
# setleft %i
|
|
||||||
# Sets left volume for the current channel.
|
|
||||||
# Do not use on a mono channel.
|
|
||||||
# The value specified must be an integer in the range 0 to 100.
|
|
||||||
|
|
||||||
# setright %i
|
|
||||||
# Sets right volume for the current channel.
|
|
||||||
# Do not use on a mono channel.
|
|
||||||
# The value specified must be an integer in the range 0 to 100.
|
|
||||||
|
|
||||||
# setname <text>
|
|
||||||
# Set the name for this channel. This will be displayed briefly
|
|
||||||
# when you switch to this channel, or when you click on the
|
|
||||||
# icon. The program will only use the first 4 characters of this
|
|
||||||
# text.
|
|
||||||
|
|
||||||
# At least one channel must be added!
|
|
||||||
|
|
||||||
# VOLUME
|
|
||||||
addchannel 0
|
|
||||||
setmono 90
|
|
||||||
setname main
|
|
||||||
|
|
||||||
# PCM
|
|
||||||
addchannel 4
|
|
||||||
setmono 64
|
|
||||||
|
|
||||||
# SPEAKER
|
|
||||||
addchannel 5
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# LINE
|
|
||||||
addchannel 6
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# MIC
|
|
||||||
addchannel 7
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# CD
|
|
||||||
addchannel 8
|
|
||||||
setmono 90
|
|
||||||
|
|
||||||
# RECLEVEL
|
|
||||||
addchannel 11
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# OGAIN
|
|
||||||
addchannel 13
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# LINE1
|
|
||||||
addchannel 14
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# LINE2
|
|
||||||
addchannel 15
|
|
||||||
setmono 100
|
|
||||||
|
|
||||||
# DIGITAL1
|
|
||||||
addchannel 17
|
|
||||||
setmono 0
|
|
||||||
|
|
||||||
# PHONEIN
|
|
||||||
addchannel 20
|
|
||||||
setmono 0
|
|
||||||
22
wmamixer.h
22
wmamixer.h
@@ -1,4 +1,4 @@
|
|||||||
// wmamixer - An alsa mixer designed for WindowMaker with scrollwheel support
|
// wmamixer - An ALSA mixer designed for WindowMaker with scrollwheel support
|
||||||
// Copyright (C) 2015 Roman Dobosz <gryf@vimja.com>
|
// Copyright (C) 2015 Roman Dobosz <gryf@vimja.com>
|
||||||
// Copyright (C) 2003 Damian Kramer <psiren@hibernaculum.net>
|
// Copyright (C) 2003 Damian Kramer <psiren@hibernaculum.net>
|
||||||
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
|
// Copyright (C) 1998 Sam Hawker <shawkie@geocities.com>
|
||||||
@@ -121,7 +121,6 @@ int rpttimer = 0;
|
|||||||
bool dragging = false;
|
bool dragging = false;
|
||||||
|
|
||||||
int channel[32];
|
int channel[32];
|
||||||
int icon[9] = {0, 1, 2, 3, 4, 5, 6, 7, 8};
|
|
||||||
|
|
||||||
struct Selem {
|
struct Selem {
|
||||||
char *name;
|
char *name;
|
||||||
@@ -134,7 +133,6 @@ struct Selem {
|
|||||||
long max;
|
long max;
|
||||||
bool capture;
|
bool capture;
|
||||||
snd_mixer_selem_channel_id_t channels[2];
|
snd_mixer_selem_channel_id_t channels[2];
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
@@ -144,17 +142,20 @@ typedef struct {
|
|||||||
} slideCaptureMono;
|
} slideCaptureMono;
|
||||||
|
|
||||||
struct NamesCount {
|
struct NamesCount {
|
||||||
short int pcm, line, lineb, mic, micb, capt, vol;
|
short int pcm, line, lineb, mic, micb, capt, vol, aux;
|
||||||
} namesCount = {1, 1, 1, 1, 1, 1, 1};
|
} namesCount = {1, 1, 1, 1, 1, 1, 1, 1};
|
||||||
|
|
||||||
struct Selem *selems[32];
|
struct Selem *selems[32] = {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
|
||||||
|
NULL, NULL};
|
||||||
|
|
||||||
struct Mixer {
|
struct Mixer {
|
||||||
int devices_no;
|
int devices_no;
|
||||||
snd_mixer_t * handle;
|
snd_mixer_t * handle;
|
||||||
void *elems[32];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct Mixer *mix;
|
||||||
|
|
||||||
static int smixer_level = 0;
|
static int smixer_level = 0;
|
||||||
static struct snd_mixer_selem_regopt smixer_options;
|
static struct snd_mixer_selem_regopt smixer_options;
|
||||||
|
|
||||||
@@ -168,14 +169,12 @@ unsigned long mixColor(char *color1, int prop1, char *color2, int prop2);
|
|||||||
void checkVol(bool forced);
|
void checkVol(bool forced);
|
||||||
void drawBtn(int x, int y, int w, int h, bool down);
|
void drawBtn(int x, int y, int w, int h, bool down);
|
||||||
void drawBtns(int btns);
|
void drawBtns(int btns);
|
||||||
void drawLeft();
|
void drawStereo(bool left);
|
||||||
void drawMono();
|
void drawMono();
|
||||||
void drawRight();
|
|
||||||
void drawText(char *text);
|
void drawText(char *text);
|
||||||
void drawVolLevel();
|
void drawVolLevel();
|
||||||
void motionEvent(XMotionEvent *xev);
|
void motionEvent(XMotionEvent *xev);
|
||||||
void pressEvent(XButtonEvent *xev);
|
void pressEvent(XButtonEvent *xev);
|
||||||
void readFile();
|
|
||||||
void releaseEvent();
|
void releaseEvent();
|
||||||
void repaint();
|
void repaint();
|
||||||
void scanArgs(int argc, char **argv);
|
void scanArgs(int argc, char **argv);
|
||||||
@@ -195,4 +194,7 @@ void Mixer_set_right(int current, int value);
|
|||||||
void Mixer_set_limits(snd_mixer_elem_t *elem, struct Selem *selem);
|
void Mixer_set_limits(snd_mixer_elem_t *elem, struct Selem *selem);
|
||||||
void Mixer_set_volume(int current, int channelIndex, int value);
|
void Mixer_set_volume(int current, int channelIndex, int value);
|
||||||
|
|
||||||
|
void Selem_set_name(struct Selem *selem, const char *name, short int *count);
|
||||||
|
void Selem_destroy();
|
||||||
|
|
||||||
#endif /* WMAMIXER_H */
|
#endif /* WMAMIXER_H */
|
||||||
|
|||||||
Reference in New Issue
Block a user