#include <OOSoundSourcePool.h>
Definition at line 40 of file OOSoundSourcePool.h.
◆ dealloc
Definition at line 43 of file OOSoundSourcePool.m.
88{
89 uint8_t i;
90
91 for (i = 0; i !=
_count; i++)
92 {
93 [_sources[i].source release];
94 }
96
97 [_lastKey release];
98
99 [super dealloc];
100}
struct OOSoundSourcePoolElement * _sources
◆ initWithCount:minRepeatTime:
- (id) initWithCount: |
|
(uint8_t) | count |
minRepeatTime: |
|
(OOTimeDelta) | minRepeat |
Definition at line 43 of file OOSoundSourcePool.m.
63{
64 if ((self = [super init]))
65 {
66
71
72 if (minRepeat < 0.0) minRepeat = 0.0;
74
75
78 {
79 [self release];
81 }
82 }
83 return self;
84}
◆ playSoundWithKey:
- (void) playSoundWithKey: |
|
(NSString *) | key |
|
Definition at line 43 of file OOSoundSourcePool.m.
191 :(NSString *)key
192{
193 [self playSoundWithKey:key priority:1.0];
194}
◆ playSoundWithKey:overlap:
Definition at line 43 of file OOSoundSourcePool.m.
203 :(NSString *)key overlap:(BOOL)overlap
204{
205 [self playSoundWithKey:key
206 priority:1.0
207 expiryTime:0.5
208 overlap:overlap
209 position:kZeroVector];
210}
◆ playSoundWithKey:overlap:position:
- (void) playSoundWithKey: |
|
(NSString *) | key |
overlap: |
|
(BOOL) | overlap |
position: |
|
(Vector) | position |
Definition at line 43 of file OOSoundSourcePool.m.
213 :(NSString *)key overlap:(BOOL)overlap position:(Vector)position
214{
215 [self playSoundWithKey:key
216 priority:1.0
217 expiryTime:0.5
218 overlap:overlap
219 position:position];
220}
◆ playSoundWithKey:position:
Definition at line 43 of file OOSoundSourcePool.m.
197 :(NSString *)key position:(Vector)position
198{
199 [self playSoundWithKey:key priority:1.0 position:position];
200}
◆ playSoundWithKey:priority:
Definition at line 43 of file OOSoundSourcePool.m.
182 :(NSString *)key
183 priority:(float)priority
184{
185 [self playSoundWithKey:key
186 priority:priority
187 expiryTime:0.5 + randf() * 0.1];
188}
◆ playSoundWithKey:priority:expiryTime:
Definition at line 43 of file OOSoundSourcePool.m.
158 :(NSString *)key
159 priority:(float)priority
161{
162 [self playSoundWithKey:key
163 priority:priority
164 expiryTime:expiryTime
165 overlap:YES
166 position:kZeroVector];
167}
◆ playSoundWithKey:priority:expiryTime:overlap:position:
- (void) playSoundWithKey: |
|
(NSString *) | key |
priority: |
|
(float) | priority |
expiryTime: |
|
(OOTimeDelta) | expiryTime |
overlap: |
|
(BOOL) | overlap |
position: |
|
(Vector) | position |
Definition at line 43 of file OOSoundSourcePool.m.
103 :(NSString *)key
104 priority:(float)priority
106 overlap:(BOOL)overlap
107 position:(Vector)position
108{
109 uint8_t slot;
113
114
115 now = [UNIVERSE getTime];
116 absExpiryTime = expiryTime + now;
117
118
121
122
123 slot = [self selectSlotForPriority:priority];
126
127
129 if (sound ==
nil)
return;
130
131
133 else
134 {
135 element->source = [[OOSoundSource alloc] init];
136 if (element->source == nil) return;
137 }
140
141
142 [element->source setPosition:position];
143 [element->source playSound:sound];
147 {
149 [_lastKey release];
151 }
152
153
155}
OOTimeAbsolute _nextRepeat
id soundWithCustomSoundKey:(NSString *key)
OOTimeAbsolute expiryTime
◆ playSoundWithKey:priority:position:
- (void) playSoundWithKey: |
|
(NSString *) | key |
priority: |
|
(float) | priority |
position: |
|
(Vector) | position |
Definition at line 43 of file OOSoundSourcePool.m.
170 :(NSString *)key
171 priority:(float)priority
172 position:(Vector)position
173{
174 [self playSoundWithKey:key
175 priority:priority
176 expiryTime:0.5 + randf() * 0.1
177 overlap:YES
178 position:position];
179}
◆ poolWithCount:minRepeatTime:
+ (instancetype) poolWithCount: |
|
(uint8_t) | count |
minRepeatTime: |
|
(OOTimeDelta) | minRepeat |
Definition at line 43 of file OOSoundSourcePool.m.
57{
58 return [[[self alloc] initWithCount:count minRepeatTime:minRepeat] autorelease];
59}
◆ selectSlotForPriority:
- (uint8_t) selectSlotForPriority: |
|
(float) | priority |
|
|
implementation |
Provided by category OOSoundSourcePool(Private).
Definition at line 43 of file OOSoundSourcePool.m.
228 :(float)priority
229{
233
234#define NEXT(x) (((x) + 1) % _count)
235
236 curr = _latest;
238 do
239 {
241 element = &_sources[curr];
242
243 if (element->
source ==
nil || ![element->
source isPlaying])
return curr;
244 else if (element->
priority < priority)
245 {
246 if (element->
expiryTime <= now) expiredLower = curr;
247 else if (curr != _reserved) unexpiredLower = curr;
248 }
250 {
251 expiredEqual = curr;
252 }
254
255 if (expiredLower !=
kNoSlot)
return expiredLower;
256 if (unexpiredLower !=
kNoSlot)
return unexpiredLower;
257 return expiredEqual;
258}
◆ _count
◆ _lastKey
◆ _latest
◆ _minRepeat
◆ _nextRepeat
◆ _reserved
◆ _sources
The documentation for this class was generated from the following files: