47@interface OOSoundSourcePool (Private)
49- (uint8_t) selectSlotForPriority:(
float)priority;
56+ (instancetype) poolWithCount:(uint8_t)count minRepeatTime:(
OOTimeDelta)minRepeat
58 return [[[
self alloc] initWithCount:count minRepeatTime:minRepeat] autorelease];
56+ (instancetype) poolWithCount:(uint8_t)count minRepeatTime:(
OOTimeDelta)minRepeat {
…}
62- (id) initWithCount:(uint8_t)count minRepeatTime:(
OOTimeDelta)minRepeat
64 if ((
self = [super init]))
72 if (minRepeat < 0.0) minRepeat = 0.0;
62- (id) initWithCount:(uint8_t)count minRepeatTime:(
OOTimeDelta)minRepeat {
…}
91 for (i = 0; i !=
_count; i++)
103- (void) playSoundWithKey:(NSString *)key
104 priority:(
float)priority
106 overlap:(BOOL)overlap
107 position:(Vector)position
115 now = [UNIVERSE getTime];
116 absExpiryTime = expiryTime + now;
129 if (sound ==
nil)
return;
142 [
element->source setPosition:position];
143 [
element->source playSound:sound];
103- (void) playSoundWithKey:(NSString *)key {
…}
158- (void) playSoundWithKey:(NSString *)key
159 priority:(
float)priority
158- (void) playSoundWithKey:(NSString *)key {
…}
170- (void) playSoundWithKey:(NSString *)key
171 priority:(
float)priority
172 position:(Vector)position
170- (void) playSoundWithKey:(NSString *)key {
…}
182- (void) playSoundWithKey:(NSString *)key
183 priority:(
float)priority
182- (void) playSoundWithKey:(NSString *)key {
…}
191- (void) playSoundWithKey:(NSString *)key
191- (void) playSoundWithKey:(NSString *)key {
…}
197- (void) playSoundWithKey:(NSString *)key position:(Vector)position
197- (void) playSoundWithKey:(NSString *)key position:(Vector)position {
…}
203- (void) playSoundWithKey:(NSString *)key overlap:(BOOL)overlap
203- (void) playSoundWithKey:(NSString *)key overlap:(BOOL)overlap {
…}
213- (void) playSoundWithKey:(NSString *)key overlap:(BOOL)overlap position:(Vector)position
213- (void) playSoundWithKey:(NSString *)key overlap:(BOOL)overlap position:(Vector)position {
…}
226@implementation OOSoundSourcePool (Private)
228- (uint8_t) selectSlotForPriority:(
float)priority
234#define NEXT(x) (((x) + 1) % _count)
241 element = &_sources[
curr];
243 if (element->
source ==
nil || ![element->
source isPlaying])
return curr;
244 else if (element->
priority < priority)
246 if (element->
expiryTime <= now) expiredLower = curr;
247 else if (curr != _reserved) unexpiredLower = curr;
255 if (expiredLower !=
kNoSlot)
return expiredLower;
256 if (unexpiredLower !=
kNoSlot)
return unexpiredLower;
228- (uint8_t) selectSlotForPriority:(
float)priority {
…}
struct OOSoundSourcePoolElement PoolElement
uint8_t selectSlotForPriority:(float priority)
void playSoundWithKey:priority:expiryTime:overlap:position:(NSString *key,[priority] float priority,[expiryTime] OOTimeDelta expiryTime,[overlap] BOOL overlap,[position] Vector position)
void playSoundWithKey:priority:position:(NSString *key,[priority] float priority,[position] Vector position)
void playSoundWithKey:priority:expiryTime:(NSString *key,[priority] float priority,[expiryTime] OOTimeDelta expiryTime)
struct OOSoundSourcePoolElement * _sources
OOTimeAbsolute _nextRepeat
void playSoundWithKey:priority:(NSString *key,[priority] float priority)
id soundWithCustomSoundKey:(NSString *key)
OOTimeAbsolute expiryTime