" -s, --streamtype stream type (0:media(default), 1:system, 2:notification, 3:voice-information, 4:solo)\n"
" -i, --iterate how many times to play\n"
" -q, --quickplay play quick\n"
+ " -o, --stopothers play after stopping others\n"
" -h, --help help\n");
}
return;
}
-void wav_play_test(const char *file_path, int iterate, int stream_type)
+void wav_play_test(const char *file_path, int iterate, int stream_type, bool stop_others)
{
int ret = 0;
sound_stream_info_h stream_info;
}
printf("Play Wav, File Path : %s, Iterate : %d\n", file_path, iterate);
- ret = wav_player_start_loop(file_path, stream_info, iterate, _player_stop_cb, (void*)stream_info, &gid);
- printf("wav_player_start_loop(id=%d) ret = %d\n", gid, ret);
+ if (stop_others) {
+ ret = wav_player_start_loop_stop_others(file_path, stream_info, iterate, _player_stop_cb, (void*)stream_info, &gid);
+ printf("wav_player_start_loop_stop_others(id=%d) ret = %d\n", gid, ret);
+ } else {
+ ret = wav_player_start_loop(file_path, stream_info, iterate, _player_stop_cb, (void*)stream_info, &gid);
+ printf("wav_player_start_loop(id=%d) ret = %d\n", gid, ret);
+ }
if (ret) {
sound_manager_destroy_stream_information(stream_info);
return;
int iterate = 1;
int stream_type = 0;
bool quickplay = false;
+ bool stop_others = false;
char file_path[FILE_PATH_MAX] = DEFAULT_FILE;
struct sigaction sig_action;
sig_action.sa_handler = __sig_handler;
{"file" , required_argument, 0, 'f'},
{"streamtype" , required_argument, 0, 's'},
{"quickplay" , no_argument, 0, 'q'},
+ {"stopothers" , no_argument, 0, 'o'},
+ {"help" , no_argument, 0, 'h'},
{ 0, 0, 0, 0 }
};
- if ((opt = getopt_long(argc, argv, "i:f:s:q", long_options, &opt_idx)) == -1)
+ if ((opt = getopt_long(argc, argv, "i:f:s:qoh", long_options, &opt_idx)) == -1)
break;
+ printf("opt = %d(%c), opt_idx = %d\n", opt, opt, opt_idx);
+
switch (opt) {
- case 'f':
- strncpy(file_path, optarg, FILE_PATH_MAX - 1);
- file_path[FILE_PATH_MAX - 1] = '\0';
- break;
case 'i':
iterate = atoi(optarg);
break;
+ case 'f':
+ snprintf(file_path, FILE_PATH_MAX, "%s", optarg);
+ break;
case 's':
stream_type = atoi(optarg);
break;
case 'q':
quickplay = true;
break;
+ case 'o':
+ stop_others = true;
+ break;
case 'h':
default:
help();
if (quickplay)
wav_play_test_quick(file_path);
else
- wav_play_test(file_path, iterate, stream_type);
+ wav_play_test(file_path, iterate, stream_type, stop_others);
return 0;
}