Skip to content

Upgrade napaudio with internal SafePtr validity checks#127

Draft
stijnvanbeek wants to merge 2 commits intomainfrom
safeptr-stability
Draft

Upgrade napaudio with internal SafePtr validity checks#127
stijnvanbeek wants to merge 2 commits intomainfrom
safeptr-stability

Conversation

@stijnvanbeek
Copy link
Copy Markdown
Contributor

@stijnvanbeek stijnvanbeek commented Mar 26, 2026

Breaking change: Nodes (and all audio::Processes) cannot register themselves as root process from their ctors. This has to be done after a NodeManager::make_safe() call.

This branch is meant for testing the reported problem of the wrong nodes/pins being connected after a hotload.

@stijnvanbeek stijnvanbeek requested a review from cklosters March 26, 2026 09:18
@stijnvanbeek stijnvanbeek marked this pull request as draft March 26, 2026 10:05
@cklosters
Copy link
Copy Markdown
Member

Thanks for this PR, unfortunately the build fails on Windows, so I can't check if your solution works:

13:55:08   C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napsequenceaudio\src\sequenceplayeraudioclock.cpp(46,26): error C2664: 'void nap::audio::NodeManager::registerRootProcess(nap::audio::SafePtr<nap::audio::Process>)': cannot convert argument 1 from 'nap::SequencePlayerAudioClockProcess' to 'nap::audio::SafePtr<nap::audio::Process>' [C:\BuildAgent\work\a62e0057f2f90802\nap\packaging_build\system_modules\napsequenceaudio\napsequenceaudio.vcxproj]
13:55:08         C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napsequenceaudio\src\sequenceplayeraudioclock.cpp(46,46):
13:55:08         No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
13:55:08         C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napaudio\src\audio\core\audionodemanager.h(143,9):
13:55:08         see declaration of 'nap::audio::NodeManager::registerRootProcess'
13:55:08         C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napsequenceaudio\src\sequenceplayeraudioclock.cpp(46,26):
13:55:08         while trying to match the argument list '(nap::SequencePlayerAudioClockProcess)'
13:55:08   
13:55:08   C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napsequenceaudio\src\sequenceplayeraudioclock.cpp(52,26): error C2664: 'void nap::audio::NodeManager::unregisterRootProcess(nap::audio::SafePtr<nap::audio::Process>)': cannot convert argument 1 from 'nap::SequencePlayerAudioClockProcess' to 'nap::audio::SafePtr<nap::audio::Process>' [C:\BuildAgent\work\a62e0057f2f90802\nap\packaging_build\system_modules\napsequenceaudio\napsequenceaudio.vcxproj]
13:55:08         C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napsequenceaudio\src\sequenceplayeraudioclock.cpp(52,48):
13:55:08         No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
13:55:08         C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napaudio\src\audio\core\audionodemanager.h(152,9):
13:55:08         see declaration of 'nap::audio::NodeManager::unregisterRootProcess'
13:55:08         C:\BuildAgent\work\a62e0057f2f90802\nap\system_modules\napsequenceaudio\src\sequenceplayeraudioclock.cpp(52,26):
13:55:08         while trying to match the argument list '(nap::SequencePlayerAudioClockProcess)'

@cklosters
Copy link
Copy Markdown
Member

Also fails on Linux:

14:00:59   /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napsequenceaudio/src/sequenceplayeraudioclock.cpp: In constructor ‘nap::SequencePlayerAudioClockProcess::SequencePlayerAudioClockProcess(nap::audio::NodeManager&)’:
14:00:59   /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napsequenceaudio/src/sequenceplayeraudioclock.cpp:46:46: error: cannot convert ‘nap::SequencePlayerAudioClockProcess’ to ‘nap::audio::SafePtr<nap::audio::Process>’
14:00:59      46 |         getNodeManager().registerRootProcess(*this);
14:00:59         |                                              ^~~~~
14:00:59         |                                              |
14:00:59         |                                              nap::SequencePlayerAudioClockProcess
14:00:59   In file included from /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napaudio/src/audio/service/audioservice.h:8,
14:00:59                    from /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napsequenceaudio/src/sequenceplayeraudioclock.cpp:4:
14:00:59   /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napaudio/src/audio/core/audionodemanager.h:143:67: note:   initializing argument 1 of ‘void nap::audio::NodeManager::registerRootProcess(nap::audio::SafePtr<nap::audio::Process>)’
14:00:59     143 |                         void registerRootProcess(SafePtr<Process> rootProcess);
14:00:59         |                                                  ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
14:00:59   /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napsequenceaudio/src/sequenceplayeraudioclock.cpp: In destructor ‘virtual nap::SequencePlayerAudioClockProcess::~SequencePlayerAudioClockProcess()’:
14:00:59   /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napsequenceaudio/src/sequenceplayeraudioclock.cpp:52:48: error: cannot convert ‘nap::SequencePlayerAudioClockProcess’ to ‘nap::audio::SafePtr<nap::audio::Process>’
14:00:59      52 |         getNodeManager().unregisterRootProcess(*this);
14:00:59         |                                                ^~~~~
14:00:59         |                                                |
14:00:59         |                                                nap::SequencePlayerAudioClockProcess
14:00:59   /home/cklosters/agent/work/a62e0057f2f90802/nap/system_modules/napaudio/src/audio/core/audionodemanager.h:152:69: note:   initializing argument 1 of ‘void nap::audio::NodeManager::unregisterRootProcess(nap::audio::SafePtr<nap::audio::Process>)’
14:00:59     152 |                         void unregisterRootProcess(SafePtr<Process> rootProcess);
14:00:59         |                                                    ~~~~~~~~~~~~~~~~~^~~~~~~~~~~
14:01:01   gmake[2]: *** [system_modules/napsequenceaudio/CMakeFiles/napsequenceaudio.dir/build.make:132: system_modules/napsequenceaudio/CMakeFiles/napsequenceaudio.dir/src/sequenceplayeraudioclock.cpp.o] Error 1
14:01:01   gmake[2]: *** Waiting for unfinished jobs....

…and can't register themselves from their ctors.
@stijnvanbeek
Copy link
Copy Markdown
Contributor Author

OK fixed this: as I wrote in the description there is a breaking change so you might need to update your client code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants