+
+ if (streamType != NULL) {
+ SLint32 streamTypeEnum;
+ if (strcmp("alarm", streamType) == 0) {
+ streamTypeEnum = SL_ANDROID_STREAM_ALARM;
+ } else if (strcmp("media", streamType) == 0) {
+ streamTypeEnum = SL_ANDROID_STREAM_MEDIA;
+ } else if (strcmp("notification", streamType) == 0) {
+ streamTypeEnum = SL_ANDROID_STREAM_NOTIFICATION;
+ } else if (strcmp("ring", streamType) == 0) {
+ streamTypeEnum = SL_ANDROID_STREAM_RING;
+ } else if (strcmp("system", streamType) == 0) {
+ streamTypeEnum = SL_ANDROID_STREAM_SYSTEM;
+ } else if (strcmp("voice", streamType) == 0) {
+ streamTypeEnum = SL_ANDROID_STREAM_VOICE;
+ } else {
+ fprintf(stderr, "play-audio: invalid streamtype '%s'\n", streamType);
+ return 1;
+ }
+ player.setStreamType(streamTypeEnum);
+ }
+
+ for (int i = optind; i < argc; i++) {
+ if (access(argv[i], R_OK) != 0) {
+ fprintf(stderr, "play-audio: '%s' is not a readable file\n", argv[i]);
+ return 1;
+ }
+ }
+
+ for (int i = optind; i < argc; i++) {
+ player.play(argv[i]);
+ }