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