Skip to content

Commit fcf7293

Browse files
committed
fix(audio-context): sink
1 parent b2e583b commit fcf7293

5 files changed

Lines changed: 8 additions & 8 deletions

File tree

packages/audio-context/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@nativescript/audio-context",
3-
"version": "1.1.1",
3+
"version": "1.1.2",
44
"description": "Web Audio API for NativeScript",
55
"main": "index",
66
"types": "index.d.ts",
-324 Bytes
Binary file not shown.

packages/audio-context/src-native/android/audiocontext/src/main/cpp/audio_context.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -321,14 +321,14 @@ class NativeEngine {
321321
getIIRCoefficients(const std::string &iirId);
322322

323323
#ifdef HAS_OBOE
324-
oboe::AudioStream *stream_ = nullptr;
324+
std::shared_ptr<oboe::AudioStream> stream_;
325325
oboe::AudioStreamCallback *callback_ = nullptr;
326326
int streamSampleRate_ = 48000;
327327
int streamChannels_ = 2;
328328
#endif
329329
int desiredSampleRate_ = 0;
330330
double desiredLatencyHintSec_ = 0.0;
331-
int desiredDeviceId_ = -1; // oboe::kUnspecified
331+
int desiredDeviceId_ = 0; // oboe::kUnspecified
332332

333333
std::unordered_map<std::string, BiquadCoeffs> biquads_;
334334
std::unordered_map<std::string, std::unordered_map<int, std::string>> voiceGainByOutput_;

packages/audio-context/src-native/android/audiocontext/src/main/cpp/audio_render.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,13 @@ void NativeEngine::ensureStream() {
6161
callback_ = new EngineCallback(this);
6262
builder.setCallback(callback_);
6363

64-
oboe::Result r = builder.openStream(&stream_);
65-
if (r != oboe::Result::OK || stream_ == nullptr) {
64+
oboe::Result r = builder.openStream(stream_);
65+
if (r != oboe::Result::OK || !stream_) {
6666
__android_log_print(ANDROID_LOG_WARN, TAG, "Oboe openStream failed: %d",
6767
static_cast<int>(r));
6868
if (stream_) {
6969
stream_->close();
70-
stream_ = nullptr;
70+
stream_.reset();
7171
}
7272
delete callback_;
7373
callback_ = nullptr;
@@ -86,7 +86,7 @@ void NativeEngine::stopStream() {
8686
if (!stream_) return;
8787
stream_->requestStop();
8888
stream_->close();
89-
stream_ = nullptr;
89+
stream_.reset();
9090
if (callback_) {
9191
delete callback_;
9292
callback_ = nullptr;

packages/audio-context/src-native/android/audiocontext/src/main/java/org/nativescript/audiocontext/AudioContext.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -599,7 +599,7 @@ private void handleNativeBufferReleased(String id) {
599599
private native void nativeSetOutputDeviceId(int deviceId);
600600

601601
public boolean setSinkId(String deviceId) {
602-
int id = -1; // oboe::kUnspecified
602+
int id = 0; // oboe::kUnspecified
603603
if (deviceId != null && !deviceId.isEmpty() && !"default".equals(deviceId)) {
604604
try {
605605
id = Integer.parseInt(deviceId);

0 commit comments

Comments
 (0)