Oolite
Loading...
Searching...
No Matches
OOSoundMixer Class Reference

#include <OOALSoundMixer.h>

Inheritance diagram for OOSoundMixer:
Collaboration diagram for OOSoundMixer:

Instance Methods

(void) - update
(OOSoundChannel *) - popChannel
(void) - pushChannel:
(id) - init [implementation]
(void) - shutdown [implementation]
(id) - copyWithZone: [implementation]
(id) - retain [implementation]
(NSUInteger) - retainCount [implementation]
(void) - release [implementation]
(id) - autorelease [implementation]

Class Methods

(id) + sharedMixer
(id) + allocWithZone: [implementation]

Protected Attributes

OOSoundChannel * _channels [kMixerGeneralChannels]
OOSoundChannel * _freeList
uint32_t _maxChannels
uint32_t _playMask

Detailed Description

Definition at line 40 of file OOALSoundMixer.h.

Method Documentation

◆ allocWithZone:

+ (id) allocWithZone: (NSZone*) inZone
implementation

Provided by category OOSoundMixer(Singleton).

Definition at line 125 of file OOALSoundMixer.m.

125 :(NSZone*)inZone
126{
127 if (sSingleton == nil) {
128 sSingleton = [super allocWithZone:inZone];
129 return sSingleton;
130 }
131 return nil;
132}
static OONullTexture * sSingleton
return nil

◆ autorelease

- (id) autorelease
implementation

Provided by category OOSoundMixer(Singleton).

Definition at line 153 of file OOALSoundMixer.m.

154{
155 return self;
156}

◆ copyWithZone:

- (id) copyWithZone: (NSZone*) inZone
implementation

Provided by category OOSoundMixer(Singleton).

Definition at line 134 of file OOALSoundMixer.m.

134 :(NSZone*)inZone
135{
136 return self;
137}

◆ init

- (id) init
implementation

Definition at line 47 of file OOALSoundMixer.m.

48{
49 BOOL OK = YES;
50 uint32_t idx = 0, count = kMixerGeneralChannels;
51 OOSoundChannel* channel;
52
53 if (!(self = [super init]))
54 return nil;
55 if (![OOSound setUp])
56 OK = NO;
57
58 if (OK) {
59 // Allocate channels
60 do {
61 channel = [[OOSoundChannel alloc] init];
62 if (nil != channel) {
63 _channels[idx++] = channel;
64 [self pushChannel:channel];
65 }
66 } while (--count);
67 }
68
69 if (!OK) {
70 [super release];
71 // static analyser complains about this next line; probably nothing - CIM
72 self = nil;
73 } else {
74 sSingleton = self;
75 }
76
77 return sSingleton;
78}
@ kMixerGeneralChannels
unsigned count
OOSoundChannel * _channels[kMixerGeneralChannels]

References _channels, count, init, kMixerGeneralChannels, nil, pushChannel:, and sSingleton.

Referenced by init.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ popChannel

- (OOSoundChannel *) popChannel

Definition at line 97 of file OOALSoundMixer.m.

98{
99 OOSoundChannel* channel = _freeList;
100 _freeList = [channel next];
101 [channel setNext:nil];
102
103 return channel;
104}
OOSoundChannel * next()
void setNext:(OOSoundChannel *next)
OOSoundChannel * _freeList

References _freeList, OOSoundChannel::next, popChannel, and OOSoundChannel::setNext:.

Referenced by OOSoundSource::play, and popChannel.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ pushChannel:

- (void) pushChannel: (OOSoundChannel*) channel

Definition at line 106 of file OOALSoundMixer.m.

106 :(OOSoundChannel*)channel
107{
108 assert(channel != nil);
109
110 [channel setNext:_freeList];
111 _freeList = channel;
112}

References _freeList, nil, and OOSoundChannel::setNext:.

Referenced by OOSoundSource::channel:didFinishPlayingSound:, and init.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ release

- (void) release
implementation

Provided by category OOSoundMixer(Singleton).

Definition at line 149 of file OOALSoundMixer.m.

150{
151}

◆ retain

- (id) retain
implementation

Provided by category OOSoundMixer(Singleton).

Definition at line 139 of file OOALSoundMixer.m.

140{
141 return self;
142}

◆ retainCount

- (NSUInteger) retainCount
implementation

Provided by category OOSoundMixer(Singleton).

Definition at line 144 of file OOALSoundMixer.m.

145{
146 return UINT_MAX;
147}

◆ sharedMixer

+ (id) sharedMixer

Definition at line 39 of file OOALSoundMixer.m.

40{
41 if (nil == sSingleton) {
42 [[self alloc] init];
43 }
44 return sSingleton;
45}

References nil, sharedMixer, and sSingleton.

Referenced by OOSoundSource::channel:didFinishPlayingSound:, OOSoundSource::play, sharedMixer, OOOpenALController::shutdown, and OOSound::update.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ shutdown

- (void) shutdown
implementation

Definition at line 81 of file OOALSoundMixer.m.

82{
83 uint32_t i;
84 for (i = 0; i < kMixerGeneralChannels; ++i) {
86 }
87}
#define DESTROY(x)

References _channels, DESTROY, kMixerGeneralChannels, and shutdown.

Referenced by shutdown.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ update

- (void) update

Definition at line 89 of file OOALSoundMixer.m.

90{
91 uint32_t i;
92 for (i = 0; i < kMixerGeneralChannels; ++i) {
93 [_channels[i] update];
94 }
95}

References kMixerGeneralChannels, OOSoundChannel::update, and update.

Referenced by OOSound::update, and update.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ _channels

- (OOSoundChannel* _channels[kMixerGeneralChannels])
protected

Definition at line 41 of file OOALSoundMixer.h.

Referenced by init, and shutdown.

◆ _freeList

- (OOSoundChannel*) _freeList
protected

Definition at line 42 of file OOALSoundMixer.h.

Referenced by popChannel, and pushChannel:.

◆ _maxChannels

- (uint32_t) _maxChannels
protected

Definition at line 44 of file OOALSoundMixer.h.

◆ _playMask

- (uint32_t) _playMask
protected

Definition at line 45 of file OOALSoundMixer.h.


The documentation for this class was generated from the following files: