> Is there some text tool to control de audio volumen in a Ultra - 1 :?
> Well, under X I can used audiotool, but I have remove de OW enviroment...
> Saludos
> Drizzt
> --
> ____________________________________________________________________________
> Drizzt Do'Urden Three rings for the Elves Kings under the Sky
> http://www.arrakis.es/~terron hall of stone
> FIDO 2:345/506.440 Nine for the Mortal Men doomed to die
Try this:
---
/*
* Simple app intended to be used from /usr/openwin/lib/speckeysd.map
*
* It allows the audio volume to be controlled via a type 5 or 6 keyboard
*
* Add the following lines to /usr/openwin/lib/speckeysd.map:
* SunAudioMute - /usr/local/bin/auctl -m
* SunAudioLowerVolume r /usr/local/bin/auctl -d 8 -k
* SunAudioRaiseVolume r /usr/local/bin/auctl -u 8 -k
* adjust the path to the binary.
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/audioio.h>
char audevbuf[100];
void
setau(int aufd, int muteflg, int incdec)
{
audio_info_t auinfo;
if (ioctl(aufd, AUDIO_GETINFO, &auinfo) < 0) {
perror("getinfo");
exit(1);
}
#if 0
printf("mute %d, gain %d\n",
auinfo.output_muted,
auinfo.play.gain);
#endif
auinfo.output_muted ^= muteflg;
/*
* auinfo.play.gain is unsigned, which makes the following if()
* catch both over and underflow
*/
if (incdec + auinfo.play.gain > 255)
auinfo.play.gain = incdec < 0 ? 0 : 255;
else
auinfo.play.gain += incdec;
if (ioctl(aufd, AUDIO_SETINFO, &auinfo) < 0) {
perror("setinfo");
exit(1);
}
Quote:}
int
main(int argc, char *argv[])
{
int aufd;
char *audev;
int muteflg = 0;
int kflag = 0;
int incdec= 0;
int c, errflg = 0;
extern char *optarg;
while ((c = getopt(argc, argv, "u:d:mk")) != EOF)
switch (c) {
case 'u':
incdec = atoi(optarg);
break;
case 'd':
incdec = -atoi(optarg);
break;
case 'm':
muteflg = 1;
break;
case 'k':
kflag = 1;
break;
case '?':
errflg = 1;
break;
}
if (errflg) {
fprintf(stderr, "Usage: %s [-u <n>] [-d <n>] [-m] [-k]\n", argv[0]);
exit(1);
}
if ((audev = getenv("AUDIODEV")) == 0)
audev = "/dev/audio";
snprintf(audevbuf, sizeof(audevbuf), "%sctl", audev);
if ((aufd = open(audevbuf, 0)) < 0) {
perror("open");
exit(1);
}
if (kflag) {
while (getchar() == 'k')
setau(aufd, muteflg, incdec);
} else {
setau(aufd, muteflg, incdec);
}
exit(0);
Quote:}
--
Sun Microsystems AB Fax: +46 8 623 9102