Compare commits
5 commits
03526aaa44
...
f7c6cd2900
Author | SHA1 | Date | |
---|---|---|---|
|
f7c6cd2900 | ||
|
db31f41105 | ||
|
01754e9072 | ||
|
b724187707 | ||
|
7774c17efa |
1 changed files with 3 additions and 2 deletions
|
@ -40,7 +40,7 @@ static simd_float4x4 convertMatrix(CMRotationMatrix r) {
|
|||
|
||||
static NSLock *motionManagerLock = nil;
|
||||
API_AVAILABLE(macos(14.0)) static CMHeadphoneMotionManager *motionManager = nil;
|
||||
static DSPHRTFNode *registeredMotionListener = nil;
|
||||
static DSPHRTFNode __weak *registeredMotionListener = nil;
|
||||
#endif
|
||||
|
||||
static void registerMotionListener(DSPHRTFNode *listener) {
|
||||
|
@ -55,7 +55,8 @@ static void registerMotionListener(DSPHRTFNode *listener) {
|
|||
[motionManager startDeviceMotionUpdatesToQueue:[NSOperationQueue mainQueue] withHandler:^(CMDeviceMotion * _Nullable motion, NSError * _Nullable error) {
|
||||
if(motion) {
|
||||
[motionManagerLock lock];
|
||||
[registeredMotionListener reportMotion:convertMatrix(motion.attitude.rotationMatrix)];
|
||||
if(registeredMotionListener)
|
||||
[registeredMotionListener reportMotion:convertMatrix(motion.attitude.rotationMatrix)];
|
||||
[motionManagerLock unlock];
|
||||
}
|
||||
}];
|
||||
|
|
Loading…
Reference in a new issue