printf("-r\t\trouting\n");
printf("\t\trouting 0 : following policy\n");
printf("\t\trouting 1 : forced set to alsa\n");
+ printf("-v\t\volume type\n");
+ printf("\t\tvolume type 0 : system\n");
+ printf("\t\tvolume type 1 : notification\n");
+ printf("\t\tvolume type 2 : alarm\n");
+ printf("\t\tvolume type 3 : ringtone\n");
+ printf("\t\tvolume type 4 : media\n");
+ printf("\t\tvolume type 5 : call\n");
printf("\n");
return;
}
static struct sigaction sigterm_action; /* Backup pointer of SIGTERM signal handler */
int g_interrupted;
-int __make_param(int op, int mode, int routing, avsys_audio_param_t *param)
+int __make_param(int op, int mode, int routing, int voltyp, avsys_audio_param_t *param)
{
if (!param)
return -1;
return -1;
param->priority = AVSYS_AUDIO_PRIORITY_NORMAL;
- param->vol_type = AVSYS_AUDIO_VOLUME_TYPE_SYSTEM;
+ param->vol_type = voltyp;
param->handle_route = routing;
switch (mode) {
}
return 0;
}
-int _playback(int mode, int routing, char *filename)
+int _playback(int mode, int routing, int voltyp, char *filename)
{
int res = 0;
avsys_audio_param_t param;
memset(¶m, sizeof(avsys_audio_param_t), '\0');
- if (__make_param(OP_PLAYBACK, mode, routing, ¶m)) {
+ if (__make_param(OP_PLAYBACK, mode, routing, voltyp, ¶m)) {
printf("Can not make audio parameter\n");
return -1;
}
return res;
}
-int _capture(int mode, int routing, char *filename)
+int _capture(int mode, int routing, int voltyp, char *filename)
{
int res = 0;
avsys_audio_param_t param;
memset(¶m, sizeof(avsys_audio_param_t), '\0');
- if (__make_param(OP_CAPTURE, mode, routing, ¶m)) {
+ if (__make_param(OP_CAPTURE, mode, routing, voltyp, ¶m)) {
printf("Can not make audio parameter\n");
return -1;
}
int mode = 0;
int tmp = 0;
int routing = 0;
+ int voltyp = 4; /* media */
struct sigaction action;
- while ((opt = getopt(argc, argv, "hpcm:r:")) != -1) {
+ while ((opt = getopt(argc, argv, "hpcm:r:v:")) != -1) {
switch (opt) {
case 'h':
usage(argv[0]);
}
routing = tmp;
break;
+ case 'v':
+ tmp = atoi(optarg);
+ if (tmp < 0 || tmp > AVSYS_AUDIO_VOLUME_TYPE_NUM) {
+ usage(argv[0]);
+ printf("MESSAGE : invalid volume type\n");
+ return -1;
+ }
+ voltyp = tmp;
+ break;
default:
usage(argv[0]);
break;
} else if (operation == OP_PLAYBACK) {
char *name = NULL;
name = argv[optind++];
- printf("op %u, mode %u, routing %d, name %s\n", operation, mode, routing, name);
- _playback(mode, routing, name);
+ printf("op %u, mode %u, routing %d, voltyp %d, name %s\n", operation, mode, routing, voltyp, name);
+ _playback(mode, routing, voltyp, name);
} else if (operation == OP_CAPTURE) {
char *name = NULL;
name = argv[optind++];
printf("Insufficient filename length\n");
return -2;
}
- printf("op %u, mode %u, routing %d, name %s\n", operation, mode, routing, name);
- _capture(mode, routing, name);
+ printf("op %u, mode %u, routing %d, voltyp %d name %s\n", operation, mode, routing, voltyp, name);
+ _capture(mode, routing, voltyp, name);
}
return 0;