AEAudioFilePlayerModule.h
Go to the documentation of this file.
1 //
2 // AEAudioFilePlayerModule.m
3 // The Amazing Audio Engine
4 //
5 // Created by Michael Tyson on 30/03/2016.
6 //
7 // Contributions by Ryan King and Jeremy Huff of Hello World Engineering, Inc on 7/15/15.
8 // Copyright (c) 2015 Hello World Engineering, Inc. All rights reserved.
9 // Contributions by Ryan Holmes
10 //
11 // This software is provided 'as-is', without any express or implied
12 // warranty. In no event will the authors be held liable for any damages
13 // arising from the use of this software.
14 //
15 // Permission is granted to anyone to use this software for any purpose,
16 // including commercial applications, and to alter it and redistribute it
17 // freely, subject to the following restrictions:
18 //
19 // 1. The origin of this software must not be misrepresented; you must not
20 // claim that you wrote the original software. If you use this software
21 // in a product, an acknowledgment in the product documentation would be
22 // appreciated but is not required.
23 //
24 // 2. Altered source versions must be plainly marked as such, and must not be
25 // misrepresented as being the original software.
26 //
27 // 3. This notice may not be removed or altered from any source distribution.
28 //
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #import "AEAudioUnitModule.h"
35 #import "AETime.h"
36 
38 typedef void (^AEAudioFilePlayerModuleBlock)();
39 
51 
59 - (instancetype _Nullable)initWithRenderer:(AERenderer * _Nullable)renderer
60  URL:(NSURL * _Nonnull)url
61  error:(NSError * _Nullable * _Nullable)error;
62 
75 - (void)playAtTime:(AudioTimeStamp)time;
76 
86 - (void)playAtTime:(AudioTimeStamp)time beginBlock:(AEAudioFilePlayerModuleBlock _Nullable)block;
87 
91 - (void)stop;
92 
102 AESeconds AEAudioFilePlayerModuleGetPlayhead(__unsafe_unretained AEAudioFilePlayerModule * _Nonnull filePlayer,
103  AEHostTicks time);
104 
111 BOOL AEAudioFilePlayerModuleGetPlaying(__unsafe_unretained AEAudioFilePlayerModule * _Nonnull filePlayer);
112 
114 @property (nonatomic, strong, readonly) NSURL * _Nullable url;
115 
117 @property (nonatomic, readonly) AESeconds duration;
118 
120 @property (nonatomic, assign) AESeconds regionStartTime;
121 
123 @property (nonatomic, assign) AESeconds regionDuration;
124 
126 @property (nonatomic, assign) AESeconds currentTime;
127 
129 @property (nonatomic, readonly) BOOL playing;
130 
132 @property (nonatomic, readwrite) BOOL loop;
133 
136 @property (nonatomic) UInt32 microfadeFrames;
137 
139 @property (nonatomic, copy) AEAudioFilePlayerModuleBlock _Nullable completionBlock;
140 
141 @end
142 
143 #ifdef __cplusplus
144 }
145 #endif