37+ (instancetype) sourceWithSound:(
OOSound *)inSound
39 return [[[
self alloc] initWithSound:inSound] autorelease];
46 if (!
self)
return nil;
50 _gain = OO_DEFAULT_SOUNDSOURCE_GAIN;
55- (id) initWithSound:(
OOSound *)inSound
58 if (!
self)
return nil;
60 [
self setSound:inSound];
79 return [NSString stringWithFormat:@"sound=%@, loop=%s, repeatCount=%u, playing on channel %@", _sound, [
self loop] ? "YES" : "NO", [
self repeatCount], _channel];
83 return [NSString stringWithFormat:@"sound=%@, loop=%s, repeatCount=%u, not playing", _sound, [
self loop] ? "YES" : "NO", [
self repeatCount]];
94- (void) setSound:(
OOSound *)sound
111- (void) setLoop:(BOOL)loop
123- (void) setRepeatCount:(uint8_t)count
147 [_channel setDelegate:self];
148 [_channel setPosition:_position];
149 [_channel setGain:_gain];
150 [_channel playSound:[
self sound] looped:[
self loop]];
158 [sPlayingSoundSources addObject:self];
177 [_channel setDelegate:[
self class]];
181 [sPlayingSoundSources removeObject:self];
199 [playing makeObjectsPerformSelector:@selector(stop)];
204- (void) playSound:(
OOSound *)sound
206 [
self playSound:sound repeatCount:_repeatCount];
210- (void) playSound:(
OOSound *)sound repeatCount:(uint8_t)count
213 [
self setSound:sound];
214 [
self setRepeatCount:count];
219- (void) playOrRepeatSound:(
OOSound *)sound
222 else [
self playOrRepeat];
226- (void) setPositional:(BOOL)inPositional
238 [
self setPosition:kZeroVector];
249- (void) setPosition:(Vector)inPosition
252 if (inPosition.x != 0.0 || inPosition.y != 0.0 || inPosition.z != 0.0)
258 [_channel setPosition:_position];
269- (void) setGain:(
float)gain
274 [_channel setGain:_gain];
286- (void) setVelocity:(Vector)inVelocity
292- (void) setOrientation:(Vector)inOrientation
298- (void) setConeAngle:(
float)inAngle
304- (void) setGainInsideCone:(
float)inInside outsideCone:(
float)inOutside
325 [_channel playSound:[
self sound] looped:NO];
329 [_channel setDelegate:nil];