aaudio: change samplesPerFrame() to channelCount()
Both functions provided for now.
Will remove deprecated function in later CL.
Bug: 37646784
Test: write_sine.cpp and write_sine_callback.cpp
Change-Id: I1241aafa206112c526d6ca250ba5209489e1a46e
Signed-off-by: Phil Burk <philburk@google.com>
diff --git a/media/libaaudio/include/aaudio/AAudio.h b/media/libaaudio/include/aaudio/AAudio.h
index 4c1ea55..532c372 100644
--- a/media/libaaudio/include/aaudio/AAudio.h
+++ b/media/libaaudio/include/aaudio/AAudio.h
@@ -206,20 +206,28 @@
int32_t sampleRate);
/**
- * Request a number of samples per frame.
+ * Request a number of channels for the stream.
*
* The stream may be opened with a different value.
* So the application should query for the actual value after the stream is opened.
*
* The default, if you do not call this function, is AAUDIO_UNSPECIFIED.
*
- * Note, this quantity is sometimes referred to as "channel count".
+ * Note, this quantity is sometimes referred to as "samples per frame".
*
* @param builder reference provided by AAudio_createStreamBuilder()
- * @param samplesPerFrame Number of samples in one frame, ie. numChannels.
+ * @param channelCount Number of channels desired.
*/
+AAUDIO_API void AAudioStreamBuilder_setChannelCount(AAudioStreamBuilder* builder,
+ int32_t channelCount);
+
+/**
+ *
+ * @deprecated use AAudioStreamBuilder_setChannelCount()
+ */
+// TODO remove as soon as the NDK and OS are in sync, before RC1
AAUDIO_API void AAudioStreamBuilder_setSamplesPerFrame(AAudioStreamBuilder* builder,
- int32_t samplesPerFrame);
+ int32_t samplesPerFrame);
/**
* Request a sample data format, for example AAUDIO_FORMAT_PCM_I16.
@@ -677,8 +685,18 @@
AAUDIO_API int32_t AAudioStream_getSampleRate(AAudioStream* stream);
/**
+ * A stream has one or more channels of data.
+ * A frame will contain one sample for each channel.
+ *
+ * @param stream reference provided by AAudioStreamBuilder_openStream()
+ * @return actual number of channels
+ */
+AAUDIO_API int32_t AAudioStream_getChannelCount(AAudioStream* stream);
+
+/**
* The samplesPerFrame is also known as channelCount.
*
+ * @deprecated use AAudioStream_getChannelCount()
* @param stream reference provided by AAudioStreamBuilder_openStream()
* @return actual samples per frame
*/