Reputation: 3590
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:
float
and the int16_t
format used? Does it depend on the device? Or maybe on the Android version?int16_t
format still used on recent devices, or is it something that tends to disappear and only used for retrocompatibility purpose?float
format?Thanks for your help.
Upvotes: 1
Views: 368
Reputation: 711
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.
Upvotes: 3