Skip to content

Commit e7caffb

Browse files
committed
internal/oboe: update to v1.8.1
1 parent a9a798c commit e7caffb

9 files changed

+47
-12
lines changed

internal/oboe/gen.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import (
2929
"strings"
3030
)
3131

32-
const oboeVersion = "1.8.0"
32+
const oboeVersion = "1.8.1"
3333

3434
func main() {
3535
if err := run(); err != nil {

internal/oboe/oboe_common_AudioStreamBuilder_android.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,11 @@ bool AudioStreamBuilder::isCompatible(AudioStreamBase &other) {
8989
}
9090

9191
Result AudioStreamBuilder::openStream(AudioStream **streamPP) {
92+
LOGW("Passing AudioStream pointer deprecated, Use openStream(std::shared_ptr<oboe::AudioStream> &stream) instead.");
93+
return openStreamInternal(streamPP);
94+
}
95+
96+
Result AudioStreamBuilder::openStreamInternal(AudioStream **streamPP) {
9297
auto result = isValidConfig();
9398
if (result != Result::OK) {
9499
LOGW("%s() invalid config %d", __func__, result);
@@ -202,6 +207,7 @@ Result AudioStreamBuilder::openStream(AudioStream **streamPP) {
202207
}
203208

204209
Result AudioStreamBuilder::openManagedStream(oboe::ManagedStream &stream) {
210+
LOGW("`openManagedStream` is deprecated. Use openStream(std::shared_ptr<oboe::AudioStream> &stream) instead.");
205211
stream.reset();
206212
AudioStream *streamptr;
207213
auto result = openStream(&streamptr);
@@ -212,7 +218,7 @@ Result AudioStreamBuilder::openManagedStream(oboe::ManagedStream &stream) {
212218
Result AudioStreamBuilder::openStream(std::shared_ptr<AudioStream> &sharedStream) {
213219
sharedStream.reset();
214220
AudioStream *streamptr;
215-
auto result = openStream(&streamptr);
221+
auto result = openStreamInternal(&streamptr);
216222
if (result == Result::OK) {
217223
sharedStream.reset(streamptr);
218224
// Save a weak_ptr in the stream for use with callbacks.

internal/oboe/oboe_flowgraph_FlowgraphUtilities_android.h

+15
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
#ifndef FLOWGRAPH_UTILITIES_H
1818
#define FLOWGRAPH_UTILITIES_H
1919

20+
#include <math.h>
2021
#include <unistd.h>
2122

2223
using namespace FLOWGRAPH_OUTER_NAMESPACE::flowgraph;
@@ -50,6 +51,20 @@ static int32_t clamp32FromFloat(float f)
5051
return f > 0 ? f + 0.5 : f - 0.5;
5152
}
5253

54+
/**
55+
* Convert a single-precision floating point value to a Q0.23 integer value, stored in a
56+
* 32 bit signed integer (technically stored as Q8.23, but clamped to Q0.23).
57+
*
58+
* Values outside the range [-1.0, 1.0) are properly clamped to -8388608 and 8388607,
59+
* including -Inf and +Inf. NaN values are considered undefined, and behavior may change
60+
* depending on hardware and future implementation of this function.
61+
*/
62+
static int32_t clamp24FromFloat(float f)
63+
{
64+
static const float scale = 1 << 23;
65+
return (int32_t) lroundf(fmaxf(fminf(f * scale, scale - 1.f), -scale));
66+
}
67+
5368
};
5469

5570
#endif // FLOWGRAPH_UTILITIES_H

internal/oboe/oboe_flowgraph_resampler_MultiChannelResampler_android.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ void MultiChannelResampler::writeFrame(const float *frame) {
120120
}
121121

122122
float MultiChannelResampler::sinc(float radians) {
123-
if (abs(radians) < 1.0e-9) return 1.0f; // avoid divide by zero
123+
if (fabsf(radians) < 1.0e-9f) return 1.0f; // avoid divide by zero
124124
return sinf(radians) / radians; // Sinc function
125125
}
126126

internal/oboe/oboe_oboe_AudioStreamBuilder_android.h

+8
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,14 @@ class AudioStreamBuilder : public AudioStreamBase {
647647

648648
private:
649649

650+
/**
651+
* Use this internally to implement opening with a shared_ptr.
652+
*
653+
* @param stream pointer to a variable to receive the stream address
654+
* @return OBOE_OK if successful or a negative error code.
655+
*/
656+
Result openStreamInternal(AudioStream **streamPP);
657+
650658
/**
651659
* @param other
652660
* @return true if channels, format and sample rate match

internal/oboe/oboe_oboe_AudioStreamCallback_android.h

+2-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,8 @@ class AudioStreamDataCallback {
4848
* write() on the stream that is making the callback.
4949
*
5050
* Note that numFrames can vary unless AudioStreamBuilder::setFramesPerCallback()
51-
* is called.
51+
* is called. If AudioStreamBuilder::setFramesPerCallback() is NOT called then
52+
* numFrames should always be <= AudioStream::getFramesPerBurst().
5253
*
5354
* Also note that this callback function should be considered a "real-time" function.
5455
* It must not do anything that could cause an unbounded delay because that can cause the

internal/oboe/oboe_oboe_AudioStream_android.h

+7
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,13 @@ class AudioStream : public AudioStreamBase {
194194
*
195195
* This cannot be set higher than getBufferCapacity().
196196
*
197+
* This should only be used with Output streams. It will
198+
* be ignored for Input streams because they are generally kept as empty as possible.
199+
*
200+
* For OpenSL ES, this method only has an effect on output stream that do NOT
201+
* use a callback. The blocking writes goes into a buffer in Oboe and the size of that
202+
* buffer is controlled by this method.
203+
*
197204
* @param requestedFrames requested number of frames that can be filled without blocking
198205
* @return the resulting buffer size in frames (obtained using value()) or an error (obtained
199206
* using error())

internal/oboe/oboe_oboe_Version_android.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
#define OBOE_VERSION_MINOR 8
3838

3939
// Type: 16-bit unsigned int. Min value: 0 Max value: 65535. See below for description.
40-
#define OBOE_VERSION_PATCH 0
40+
#define OBOE_VERSION_PATCH 1
4141

4242
#define OBOE_STRINGIFY(x) #x
4343
#define OBOE_TOSTRING(x) OBOE_STRINGIFY(x)

internal/oboe/oboe_opensles_AudioOutputStreamOpenSLES_android.cpp

+5-7
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@
3030
using namespace oboe;
3131

3232
static SLuint32 OpenSLES_convertOutputUsage(Usage oboeUsage) {
33-
SLuint32 openslStream = SL_ANDROID_STREAM_MEDIA;
33+
SLuint32 openslStream;
3434
switch(oboeUsage) {
3535
case Usage::Media:
36+
case Usage::Game:
3637
openslStream = SL_ANDROID_STREAM_MEDIA;
3738
break;
3839
case Usage::VoiceCommunication:
@@ -43,18 +44,15 @@ static SLuint32 OpenSLES_convertOutputUsage(Usage oboeUsage) {
4344
openslStream = SL_ANDROID_STREAM_ALARM;
4445
break;
4546
case Usage::Notification:
46-
case Usage::NotificationRingtone:
4747
case Usage::NotificationEvent:
4848
openslStream = SL_ANDROID_STREAM_NOTIFICATION;
4949
break;
50+
case Usage::NotificationRingtone:
51+
openslStream = SL_ANDROID_STREAM_RING;
52+
break;
5053
case Usage::AssistanceAccessibility:
5154
case Usage::AssistanceNavigationGuidance:
5255
case Usage::AssistanceSonification:
53-
openslStream = SL_ANDROID_STREAM_SYSTEM;
54-
break;
55-
case Usage::Game:
56-
openslStream = SL_ANDROID_STREAM_MEDIA;
57-
break;
5856
case Usage::Assistant:
5957
default:
6058
openslStream = SL_ANDROID_STREAM_SYSTEM;

0 commit comments

Comments
 (0)