|
1 // MXAudioPlayerFadeOperation.h |
|
2 // |
|
3 // Created by Andrew Mackenzie-Ross on 30/11/10. |
|
4 // mackross.net |
|
5 // |
|
6 |
|
7 #import <Foundation/Foundation.h> |
|
8 |
|
9 @class AVAudioPlayer; |
|
10 @interface MXAudioPlayerFadeOperation : NSOperation { |
|
11 AVAudioPlayer *_audioPlayer; |
|
12 NSTimeInterval _fadeDuration; |
|
13 NSTimeInterval _delay; |
|
14 float _finishVolume; |
|
15 BOOL _pauseAfterFade; |
|
16 BOOL _stopAfterFade; |
|
17 BOOL _playBeforeFade; |
|
18 } |
|
19 |
|
20 // The AVAudioPlayer that the volume fade will be applied to. |
|
21 // Retained until the fade is completed. |
|
22 // Must be set with init method. |
|
23 @property (nonatomic, retain, readonly) AVAudioPlayer *audioPlayer; |
|
24 |
|
25 // The duration of the volume fade. |
|
26 // Default value is 1.0 |
|
27 @property (nonatomic, assign) NSTimeInterval fadeDuration; |
|
28 |
|
29 // The delay before the volume fade begins. |
|
30 // Default value is 0.0 |
|
31 @property (nonatomic, assign) NSTimeInterval delay; |
|
32 |
|
33 // The volume that will be faded to. |
|
34 // Default value is 0.0 |
|
35 @property (nonatomic, assign) float finishVolume; |
|
36 |
|
37 // If YES, audio player will be sent a pause message when the fade has completed. |
|
38 // Default value is NO, however, if finishVolume is 0.0, default is YES |
|
39 @property (nonatomic, assign) BOOL pauseAfterFade; |
|
40 |
|
41 // If YES, when the fade has completed the audio player will be sent a stop message. |
|
42 // Default value is NO. |
|
43 @property (nonatomic, assign) BOOL stopAfterFade; |
|
44 |
|
45 // If YES, audio player will be sent a play message after the delay. |
|
46 // Default value is YES. |
|
47 @property (nonatomic, assign) BOOL playBeforeFade; |
|
48 |
|
49 // Init Methods |
|
50 - (id)initFadeWithAudioPlayer:(AVAudioPlayer*)player toVolume:(float)volume overDuration:(NSTimeInterval)duration withDelay:(NSTimeInterval)timeDelay; |
|
51 - (id)initFadeWithAudioPlayer:(AVAudioPlayer*)player toVolume:(float)volume overDuration:(NSTimeInterval)duration; |
|
52 - (id)initFadeWithAudioPlayer:(AVAudioPlayer*)player toVolume:(float)volume; |
|
53 - (id)initFadeWithAudioPlayer:(AVAudioPlayer*)player; |
|
54 |
|
55 @end |