Definition at line 33 of file OOALSoundChannel.m.
◆ enqueueBuffer:
| - (BOOL) enqueueBuffer: |
|
(OOSound *) | sound |
|
Extends class OOSoundChannel.
Definition at line 194 of file OOALSoundChannel.m.
194 :(OOSound*)sound
195{
196
198
199 OOAL(alSourceQueueBuffers(_source, 1, &_buffer));
200 ALuint error;
201 if ((error = alGetError()) != AL_NO_ERROR) {
202 OOLog(
@"ov.debug",
@"Error %u queueing buffers (_source: %u (%p), _buffer: %u (%p))",
203 error, _source, &_source, _buffer, &_buffer);
204 return NO;
205 }
206 ALint playing = 0;
207 OOAL(alGetSourcei(_source, AL_SOURCE_STATE, &playing));
208 if (playing != AL_PLAYING) {
209 OOAL(alSourcePlay(_source));
210 if ((error = alGetError()) != AL_NO_ERROR) {
211 OOLog(
@"ov.debug",
@"Error %d playing source", error);
212 return NO;
213 }
214 }
215 return YES;
216}
#define OOLog(class, format,...)
References OOAL, OOLog, and OOSound::soundBuffer.
Referenced by getNextSoundBuffer.
◆ getNextSoundBuffer
| - (void) getNextSoundBuffer |
|
|
|
Extends class OOSoundChannel.
Definition at line 89 of file OOALSoundChannel.m.
90{
91 if (!_bigSound) {
92
93 _bigSound = YES;
94 _lastBuffer = _buffer;
95 [self enqueueBuffer:_sound];
96 } else {
97
98
99 ALint processed = 0;
100 OOAL(alGetSourcei(_source, AL_BUFFERS_PROCESSED, &processed));
101 if (processed > 0)
102 {
103
104 ALuint buffer;
105 OOAL(alSourceUnqueueBuffers(_source, 1, &buffer));
106 assert(buffer == _lastBuffer);
107 OOAL(alDeleteBuffers(1, &_lastBuffer));
108
109 _lastBuffer = _buffer;
110 [self enqueueBuffer:_sound];
111 }
112 }
113}
References OOSoundChannel::enqueueBuffer:, getNextSoundBuffer, and OOAL.
Referenced by getNextSoundBuffer, and OOSoundChannel::update.
◆ hasStopped
Extends class OOSoundChannel.
Definition at line 168 of file OOALSoundChannel.m.
169{
170 ALint queued;
171 OOAL(alGetSourcei(_source, AL_BUFFERS_QUEUED, &queued));
172
173 while (queued--) {
174 ALuint buffer;
175 OOAL(alSourceUnqueueBuffers(_source, 1, &buffer));
176 }
177
178 OOAL(alDeleteBuffers(1, &_buffer));
179 if (_bigSound) {
180
181 OOAL(alDeleteBuffers(1, &_lastBuffer));
182 }
183 _bigSound = NO;
184
185 OOSound* sound = _sound;
187
188 if (
nil != _delegate && [_delegate respondsToSelector:
@selector(channel:didFinishPlayingSound:)]) {
189 [_delegate channel:self didFinishPlayingSound:sound];
190 }
191 [sound release];
192}
References hasStopped, nil, and OOAL.
Referenced by OOSoundChannel::dealloc, hasStopped, OOSoundChannel::stop, and OOSoundChannel::update.
The documentation for this category was generated from the following file: