AEMessageQueue.h
Go to the documentation of this file.
1 //
2 // AEMessageQueue.h
3 // Extracted and modified from AEAudioController of Michael Tysons 'TheAmazingAudioEngine'
4 //
5 // Created by Jonatan Liljedahl on 8/26/15.
6 // Copyright (c) 2015 Jonatan Liljedahl & Michael Tyson.
7 //
8 // This software is provided 'as-is', without any express or implied
9 // warranty. In no event will the authors be held liable for any damages
10 // arising from the use of this software.
11 //
12 // Permission is granted to anyone to use this software for any purpose,
13 // including commercial applications, and to alter it and redistribute it
14 // freely, subject to the following restrictions:
15 //
16 // 1. The origin of this software must not be misrepresented; you must not
17 // claim that you wrote the original software. If you use this software
18 // in a product, an acknowledgment in the product documentation would be
19 // appreciated but is not required.
20 //
21 // 2. Altered source versions must be plainly marked as such, and must not be
22 // misrepresented as being the original software.
23 //
24 // 3. This notice may not be removed or altered from any source distribution.
25 //
26 
27 #import <Foundation/Foundation.h>
28 
29 @class AEMessageQueue;
30 
45 typedef void (*AEMessageQueueMessageHandler)(void *userInfo, int userInfoLength);
46 
58 @interface AEMessageQueue : NSObject
59 
63 - (instancetype)init;
64 
72 - (instancetype)initWithMessageBufferLength:(int32_t)numBytes;
73 
82 - (void)startPolling;
83 
87 - (void)stopPolling;
88 
100 
121 - (void)performAsynchronousMessageExchangeWithBlock:(void (^)())block
122  responseBlock:(void (^)())responseBlock;
123 
144 - (BOOL)performSynchronousMessageExchangeWithBlock:(void (^)())block;
145 
186  void *userInfo,
187  int userInfoLength);
188 
196 
201 
202 
211 @property (nonatomic, assign) NSTimeInterval autoProcessTimeout;
212 
218 void AEMessageQueueProcessMessagesOnRealtimeThread(__unsafe_unretained AEMessageQueue *THIS);
219 
220 @end