OSDN Git Service

aaudio examples: Add deviceId option to examples
authorPhil Burk <philburk@google.com>
Wed, 23 Aug 2017 19:56:15 +0000 (12:56 -0700)
committerPhil Burk <philburk@google.com>
Tue, 29 Aug 2017 16:55:56 +0000 (09:55 -0700)
Note that this uses the -d option, which used to be for durationSeconds.
We now use the -s option for seconds.

Bug: 64981153
Test: this is a test
Change-Id: I9789a1f520dc93bfb26143582dacb9619650abf7

media/libaaudio/examples/input_monitor/src/input_monitor.cpp
media/libaaudio/examples/input_monitor/src/input_monitor_callback.cpp
media/libaaudio/examples/utils/AAudioArgsParser.h
media/libaaudio/examples/write_sine/src/write_sine.cpp
media/libaaudio/examples/write_sine/src/write_sine_callback.cpp

index 2dfd0a7..9feb118 100644 (file)
@@ -61,7 +61,7 @@ int main(int argc, const char **argv)
     // in a buffer if we hang or crash.
     setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
 
-    printf("%s - Monitor input level using AAudio V0.1.1\n", argv[0]);
+    printf("%s - Monitor input level using AAudio read, V0.1.2\n", argv[0]);
 
     argParser.setFormat(REQUIRED_FORMAT);
     if (argParser.parseArgs(argc, argv)) {
index 9de2eb0..893795b 100644 (file)
@@ -41,7 +41,7 @@ int main(int argc, char **argv)
     // Make printf print immediately so that debug info is not stuck
     // in a buffer if we hang or crash.
     setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
-    printf("%s - Display audio input using an AAudio callback\n", argv[0]);
+    printf("%s - Display audio input using an AAudio callback, V0.1.2\n", argv[0]);
 
     result = recorder.open(2, 48000, AAUDIO_FORMAT_PCM_I16,
                        SimpleRecorderDataCallbackProc, SimpleRecorderErrorCallbackProc, &myData);
index 30c3ccd..ada37e2 100644 (file)
@@ -150,6 +150,9 @@ public:
                     setChannelCount(atoi(&arg[2]));
                     break;
                 case 'd':
+                    setDeviceId(atoi(&arg[2]));
+                    break;
+                case 's':
                     mDurationSeconds = atoi(&arg[2]);
                     break;
                 case 'm': {
@@ -202,7 +205,8 @@ public:
         printf("      Default values are UNSPECIFIED unless otherwise stated.\n");
         printf("      -b{bufferCapacity} frames\n");
         printf("      -c{channels} for example 2 for stereo\n");
-        printf("      -d{duration} in seconds, default is %d\n", DEFAULT_DURATION_SECONDS);
+        printf("      -d{deviceId} default is %d\n", AAUDIO_UNSPECIFIED);
+        printf("      -s{duration} in seconds, default is %d\n", DEFAULT_DURATION_SECONDS);
         printf("      -m{0|1|2|3} set MMAP policy\n");
         printf("          0 = _UNSPECIFIED, default\n");
         printf("          1 = _NEVER\n");
index 87fb40b..677fb6c 100644 (file)
@@ -57,7 +57,7 @@ int main(int argc, const char **argv)
     // in a buffer if we hang or crash.
     setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
 
-    printf("%s - Play a sine wave using AAudio V0.1.1\n", argv[0]);
+    printf("%s - Play a sine wave using AAudio V0.1.2\n", argv[0]);
 
     if (argParser.parseArgs(argc, argv)) {
         return EXIT_FAILURE;
index b5602e9..071ca87 100644 (file)
@@ -40,7 +40,7 @@ int main(int argc, const char **argv)
     // in a buffer if we hang or crash.
     setvbuf(stdout, nullptr, _IONBF, (size_t) 0);
 
-    printf("%s - Play a sine sweep using an AAudio callback V0.1.2\n", argv[0]);
+    printf("%s - Play a sine sweep using an AAudio callback V0.1.3\n", argv[0]);
 
     myData.schedulerChecked = false;
     myData.forceUnderruns = false; // set true to test AAudioStream_getXRunCount()