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