expo-juce 0.2.17 → 0.2.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/JuceToneGenerator.mm +4 -3
- package/package.json +1 -1
package/ios/JuceToneGenerator.mm
CHANGED
|
@@ -370,10 +370,11 @@ private:
|
|
|
370
370
|
// Beat callback timer — polls at ~60Hz on main queue
|
|
371
371
|
self.beatTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, dispatch_get_main_queue());
|
|
372
372
|
dispatch_source_set_timer(self.beatTimer, DISPATCH_TIME_NOW, 16 * NSEC_PER_MSEC, 1 * NSEC_PER_MSEC);
|
|
373
|
-
__weak
|
|
373
|
+
__weak JuceToneGenerator *weakSelf = self;
|
|
374
374
|
dispatch_source_set_event_handler(self.beatTimer, ^{
|
|
375
|
-
|
|
376
|
-
|
|
375
|
+
BeatCallback cb = weakSelf.beatCallback;
|
|
376
|
+
if (beatState->crossed.exchange(false) && cb) {
|
|
377
|
+
cb(beatState->beat.load(), beatState->bpm.load());
|
|
377
378
|
}
|
|
378
379
|
});
|
|
379
380
|
dispatch_resume(self.beatTimer);
|