volume option
This commit is contained in:
parent
7d8f53c3b4
commit
55ae1d8729
@ -3,7 +3,7 @@
|
||||
Summary: Advanced Linux Sound Architecture (ALSA) utilities
|
||||
Name: alsa-utils
|
||||
Version: 1.0.11
|
||||
Release: 1.rc2
|
||||
Release: 2.rc2
|
||||
License: GPL
|
||||
Group: Applications/Multimedia
|
||||
URL: http://www.alsa-project.org/
|
||||
@ -69,6 +69,9 @@ install -m 755 alsacard %{buildroot}/bin
|
||||
/usr/share/locale/*
|
||||
|
||||
%changelog
|
||||
* Wed Jan 25 2006 Martin Stransky <stransky@redhat.com> 1.0.11-2.rc2
|
||||
- added volume option to alsaunmute utility (for s-c-s)
|
||||
|
||||
* Thu Jan 12 2006 Martin Stransky <stransky@redhat.com> 1.0.11-1.rc2
|
||||
- new upstream
|
||||
|
||||
|
42
alsaunmute.c
42
alsaunmute.c
@ -16,6 +16,8 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#define VERSION "0.2"
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
@ -259,6 +261,16 @@ const char * get_card_driver(int index)
|
||||
return(NULL);
|
||||
}
|
||||
|
||||
void set_volume(int volume)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < sizeof(channels) / sizeof(channels[0]); i++) {
|
||||
if (channels[i].play_volume > 1)
|
||||
channels[i].play_volume = volume;
|
||||
}
|
||||
}
|
||||
|
||||
void check_data(void)
|
||||
{
|
||||
char *p_tmp;
|
||||
@ -272,13 +284,15 @@ void check_data(void)
|
||||
|
||||
void usage(char *p_name)
|
||||
{
|
||||
printf("Alsa Unmute utility, Copyright 2005 Red Hat, Inc.\n");
|
||||
printf("Alsa Unmute utility, Version %s, Copyright 2005 Red Hat, Inc.\n",VERSION);
|
||||
printf("This software may be freely redistributed under the terms of the GNU\n");
|
||||
printf("public license.\n\n");
|
||||
|
||||
printf("usage: %s card_number [-v]\n\n", p_name);
|
||||
printf(" card_number - number of unmuted card\n");
|
||||
printf(" [-v] - verbose mode\n\n");
|
||||
printf("Usage: alsaunmute card_number [-v] [-s volume]\n\n", p_name);
|
||||
printf(" card_number - number of unmuted card\n");
|
||||
printf(" [-v] - verbose mode\n");
|
||||
printf(" [-s volume] - set this volume level instead of the default (75%)\n");
|
||||
printf(" the volume is number from 0 to 100\n\n");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
@ -290,6 +304,8 @@ int main(int argc, char **argv)
|
||||
{
|
||||
const char *p_driver;
|
||||
int index;
|
||||
int volume = 75;
|
||||
int param;
|
||||
|
||||
if (argc < 2) {
|
||||
usage(argv[0]);
|
||||
@ -298,10 +314,19 @@ int main(int argc, char **argv)
|
||||
|
||||
index = atoi(argv[1]);
|
||||
p_driver = get_card_driver(index);
|
||||
|
||||
for(param = 2; param < argc; param++) {
|
||||
if (!strcmp(argv[param],"-v") || !strcmp(argv[param],"-V")) {
|
||||
verbose = TRUE;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (argc == 3 && (!strcmp(argv[2],"-v") || !strcmp(argv[2],"-V"))) {
|
||||
verbose = TRUE;
|
||||
if (param+1 < argc && (!strcmp(argv[param],"-s") || !strcmp(argv[param],"-S"))) {
|
||||
param++;
|
||||
volume = atoi(argv[param]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(!p_driver) {
|
||||
fprintf(stderr,"Wrong card index %d...\n",index);
|
||||
@ -309,11 +334,14 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if(verbose) {
|
||||
fprintf(stderr,"Card %d Driver %s...\n",index,p_driver);
|
||||
fprintf(stderr,"Card %d Driver %s Volume %d%%...\n",index,p_driver,volume);
|
||||
}
|
||||
|
||||
check_data();
|
||||
|
||||
// setting volume
|
||||
set_volume(volume);
|
||||
|
||||
// default settings for all cards
|
||||
unmute_card(index,"");
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user