AEBlockScheduler.h
Go to the documentation of this file.
1 //
2 // AEBlockScheduler.h
3 // TheAmazingAudioEngine
4 //
5 // Created by Michael Tyson on 22/03/2013.
6 // Copyright (c) 2013 A Tasty Pixel. All rights reserved.
7 //
8 
9 #ifdef __cplusplus
10 extern "C" {
11 #endif
12 
13 #import <Foundation/Foundation.h>
14 #import "AEAudioController.h"
15 
19 extern NSString const * AEBlockSchedulerKeyBlock;
20 extern NSString const * AEBlockSchedulerKeyTimestampInHostTicks;
21 extern NSString const * AEBlockSchedulerKeyResponseBlock;
22 extern NSString const * AEBlockSchedulerKeyIdentifier;
23 extern NSString const * AEBlockSchedulerKeyTimingContext;
24 
34 typedef void (^AEBlockSchedulerBlock)(const AudioTimeStamp *intervalStartTime, UInt32 offsetInFrames);
35 
42 
54 @interface AEBlockScheduler : NSObject <AEAudioTimingReceiver>
55 
59 + (uint64_t)now;
60 
64 + (uint64_t)hostTicksFromSeconds:(NSTimeInterval)seconds;
65 
69 + (NSTimeInterval)secondsFromHostTicks:(uint64_t)ticks;
70 
74 + (uint64_t)timestampWithSecondsFromNow:(NSTimeInterval)seconds;
75 
79 + (uint64_t)timestampWithSeconds:(NSTimeInterval)seconds fromTimestamp:(uint64_t)timeStamp;
80 
84 + (NSTimeInterval)secondsUntilTimestamp:(uint64_t)timestamp;
85 
91 - (id)initWithAudioController:(AEAudioController*)audioController;
92 
116 - (void)scheduleBlock:(AEBlockSchedulerBlock)block atTime:(uint64_t)time timingContext:(AEAudioTimingContext)context identifier:(id<NSCopying>)identifier;
117 
144 - (void)scheduleBlock:(AEBlockSchedulerBlock)block atTime:(uint64_t)time timingContext:(AEAudioTimingContext)context identifier:(id<NSCopying>)identifier mainThreadResponseBlock:(AEBlockSchedulerResponseBlock)response;
145 
154 - (NSArray*)schedules;
155 
162 - (NSDictionary*)infoForScheduleWithIdentifier:(id<NSCopying>)identifier;
163 
172 - (void)cancelScheduleWithIdentifier:(id<NSCopying>)identifier;
173 
174 @end
175 
176 #ifdef __cplusplus
177 }
178 #endif