Issue
In my Android app, I'm using the Oboe library to redirect audio samples to the audio output.
According to my tests, in the oboe::AudioStreamCallback::onAudioReady()
function, it seems that most of the time, the float
format is used for the audio stream format. But sometimes, the int16_t
format is used.
Since the float
format is much more convenient to use than the int16_t
format, I have some questions about it:
- When are the
float
and theint16_t
format used? Does it depend on the device? Or maybe on the Android version? - Is the
int16_t
format still used on recent devices, or is it something that tends to disappear and only used for retrocompatibility purpose? - If the format depends on the Android version, what is the min Android API version that uses only the
float
format?
Thanks for your help.
Solution
If you do not specify a format in the AudioStreamBuilder then you could get either float or int16_t. Oboe and AAudio will choose a format that is optimal for that platform. Generally float is preferred. But, for example, on some platforms you can only get a LOW_LATENCY input stream if you use int16_t. So it will choose int16_t.
You can determine the format by calling AudioStream::getFormat().
If you do specify a format then you will get that format when you open the stream, if it is supported. OpenSL ES before L (21) does not support float so Oboe on a pre-L device will not open a stream with float format.
The int16_t format will not disappear. We will continue to support it.
Answered By - philburk
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.