-
-
Notifications
You must be signed in to change notification settings - Fork 39
Refactor/communication between audio and js threads #864
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Refactor/communication between audio and js threads #864
Conversation
packages/react-native-audio-api/common/cpp/audioapi/core/utils/AudioEventScheduler.h
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/core/AudioNode.cpp
Outdated
Show resolved
Hide resolved
...t-native-audio-api/common/cpp/audioapi/HostObjects/sources/AudioBufferSourceNodeHostObject.h
Show resolved
Hide resolved
packages/react-native-audio-api/common/cpp/audioapi/core/utils/AudioEventScheduler.cpp
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp
Outdated
Show resolved
Hide resolved
packages/react-native-audio-api/android/src/main/cpp/audioapi/android/core/AudioPlayer.cpp
Outdated
Show resolved
Hide resolved
| audioBufferSourceNode->setLoop(value.getBool()); | ||
| auto loop = value.getBool(); | ||
|
|
||
| auto event = [audioBufferSourceNode, loop](BaseAudioContext &context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need reference to context here and in all of the lambdas that they do not use context inside it? if not change sfinae definition of a function so more types can be passed in event scheduler
| : nodeManager_(std::make_shared<AudioNodeManager>()), | ||
| : sampleRate_ {sampleRate}, | ||
| nodeManager_(std::make_shared<AudioNodeManager>()), | ||
| audioEventScheduler_(std::make_unique<CrossThreadEventScheduler<BaseAudioContext>>(1024)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
magic number, put it in some constant
Closes #
Introduced changes
CrossThreadEventSchedulerwrapper to be executed on Audio thread.HostObjectplays aShadowAudioNoderole - it stores a copy of node's state.Read: Simply read
HostObjectstateWrite: Schedule modification and modify
Shadow StateLock free approach!!!
TODO:
Checklist