Skip to content

Commit 7bc81ca

Browse files
committed
refactor: moved context to public scope
1 parent ce24d2d commit 7bc81ca

File tree

2 files changed

+8
-9
lines changed

2 files changed

+8
-9
lines changed

packages/react-native-audio-api/common/cpp/audioapi/HostObjects/BaseAudioContextHostObject.h

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,12 @@ class BaseAudioContextHostObject : public JsiHostObject {
106106
return jsi::Object::createFromHostObject(runtime, bufferSourceHostObject);
107107
}
108108

109-
JSI_HOST_FUNCTION(createBufferQueueSource) {
110-
auto bufferSource = context_->createBufferQueueSource();
111-
auto bufferStreamSourceHostObject =
112-
std::make_shared<AudioBufferQueueSourceNodeHostObject>(bufferSource);
113-
return jsi::Object::createFromHostObject(runtime, bufferStreamSourceHostObject);
114-
}
109+
JSI_HOST_FUNCTION(createBufferQueueSource) {
110+
auto bufferSource = context_->createBufferQueueSource();
111+
auto bufferStreamSourceHostObject =
112+
std::make_shared<AudioBufferQueueSourceNodeHostObject>(bufferSource);
113+
return jsi::Object::createFromHostObject(runtime, bufferStreamSourceHostObject);
114+
}
115115

116116
JSI_HOST_FUNCTION(createBuffer) {
117117
auto numberOfChannels = static_cast<int>(args[0].getNumber());
@@ -236,8 +236,7 @@ JSI_HOST_FUNCTION(createBufferQueueSource) {
236236
return promise;
237237
}
238238

239-
protected:
240-
std::shared_ptr<BaseAudioContext> context_;
239+
std::shared_ptr<BaseAudioContext> context_;
241240

242241
protected:
243242
std::shared_ptr<PromiseVendor> promiseVendor_;

packages/react-native-audio-api/src/core/BaseAudioContext.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { InvalidAccessError, NotSupportedError } from '../errors';
1919
export default class BaseAudioContext {
2020
readonly destination: AudioDestinationNode;
2121
readonly sampleRate: number;
22-
protected readonly context: IBaseAudioContext;
22+
readonly context: IBaseAudioContext;
2323

2424
constructor(context: IBaseAudioContext) {
2525
this.context = context;

0 commit comments

Comments
 (0)