Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
OOSoundSourcePool.h
Go to the documentation of this file.
1/*
2
3OOSoundSourcePool.h
4
5Manages a fixed number of sound sources and distributes sounds between them.
6Each sound has a priority and an expiry time. When a new sound is played, it
7replaces (if possible) a sound of lower priority that has expired, a sound of
8the same priority that has expired, or a sound of lower priority that has not
9expired.
10
11All sounds are specified by customsounds.plist key.
12
13
14Copyright (C) 2008-2013 Jens Ayton
15
16Permission is hereby granted, free of charge, to any person obtaining a copy
17of this software and associated documentation files (the "Software"), to deal
18in the Software without restriction, including without limitation the rights
19to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20copies of the Software, and to permit persons to whom the Software is
21furnished to do so, subject to the following conditions:
22
23The above copyright notice and this permission notice shall be included in all
24copies or substantial portions of the Software.
25
26THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
32SOFTWARE.
33
34*/
35
36#import <Foundation/Foundation.h>
37#import "OOTypes.h"
38#import "OOMaths.h"
39
40@interface OOSoundSourcePool: NSObject
41{
42@private
44 uint8_t _count;
45 uint8_t _latest;
46 uint8_t _reserved;
49 NSString *_lastKey;
50}
51
52+ (instancetype) poolWithCount:(uint8_t)count minRepeatTime:(OOTimeDelta)minRepeat;
53- (id) initWithCount:(uint8_t)count minRepeatTime:(OOTimeDelta)minRepeat;
54
55- (void) playSoundWithKey:(NSString *)key
56 priority:(float)priority
57 expiryTime:(OOTimeDelta)expiryTime
58 overlap:(BOOL)overlap
59 position:(Vector)position;
60
61- (void) playSoundWithKey:(NSString *)key
62 priority:(float)priority
63 expiryTime:(OOTimeDelta)expiryTime;
64
65- (void) playSoundWithKey:(NSString *)key
66 priority:(float)priority; // expiryTime:0.1 +/- 0.5
67
68- (void) playSoundWithKey:(NSString *)key
69 priority:(float)priority
70 position:(Vector)position; // expiryTime:0.1 +/- 0.5
71
72- (void) playSoundWithKey:(NSString *)key
73 position:(Vector)position; // expiryTime:0.1 +/- 0.5
74
75- (void) playSoundWithKey:(NSString *)key; // priority: 1.0, expiryTime:0.1 +/- 0.5
76
77- (void) playSoundWithKey:(NSString *)key overlap:(BOOL)overlap; // if overlap == NO it waits for key to finish before playing key again
78- (void) playSoundWithKey:(NSString *)key overlap:(BOOL)overlap position:(Vector)position;
79
80
81@end
double OOTimeDelta
Definition OOTypes.h:224
double OOTimeAbsolute
Definition OOTypes.h:223
struct OOSoundSourcePoolElement * _sources
OOTimeAbsolute _nextRepeat