Definition at line 33 of file OOALSoundChannel.m.
◆ enqueueBuffer:
- (BOOL) enqueueBuffer: |
|
(OOSound *) | sound |
|
Extends class OOSoundChannel.
Definition at line 1 of file OOALSoundChannel.m.
225{
226
228
229 OOAL(alSourceQueueBuffers(_source, 1, &_buffer));
230 ALuint error;
231 if ((error = alGetError()) != AL_NO_ERROR)
232 {
233 OOLog(
@"ov.debug",
@"Error %u queueing buffers (_source: %u (%p), _buffer: %u (%p))",
234 error, _source, &_source, _buffer, &_buffer);
235 return NO;
236 }
237 ALint playing = 0;
238 OOAL(alGetSourcei(_source,AL_SOURCE_STATE,&playing));
239 if (playing != AL_PLAYING)
240 {
241 OOAL(alSourcePlay(_source));
242 if ((error = alGetError()) != AL_NO_ERROR)
243 {
244 OOLog(
@"ov.debug",
@"Error %d playing source",error);
245 return NO;
246 }
247 }
248 return YES;
249}
#define OOLog(class, format,...)
◆ getNextSoundBuffer
- (void) getNextSoundBuffer |
|
|
|
Extends class OOSoundChannel.
Definition at line 1 of file OOALSoundChannel.m.
102{
103 if (!_bigSound)
104 {
105
106 _bigSound = YES;
107 _lastBuffer = _buffer;
108 [self enqueueBuffer:_sound];
109 }
110 else
111 {
112
113
114 ALint processed = 0;
115 OOAL(alGetSourcei(_source, AL_BUFFERS_PROCESSED, &processed));
116 if (processed > 0)
117 {
118
119 ALuint buffer;
120 OOAL(alSourceUnqueueBuffers(_source, 1, &buffer));
121 assert(buffer == _lastBuffer);
122 OOAL(alDeleteBuffers(1,&_lastBuffer));
123
124 _lastBuffer = _buffer;
125 [self enqueueBuffer:_sound];
126 }
127 }
128}
◆ hasStopped
Extends class OOSoundChannel.
Definition at line 1 of file OOALSoundChannel.m.
194{
195 ALint queued;
196 OOAL(alGetSourcei(_source, AL_BUFFERS_QUEUED, &queued));
197
198 while (queued--)
199 {
200 ALuint buffer;
201 OOAL(alSourceUnqueueBuffers(_source, 1, &buffer));
202 }
203
204 OOAL(alDeleteBuffers(1,&_buffer));
205 if (_bigSound)
206 {
207
208 OOAL(alDeleteBuffers(1,&_lastBuffer));
209 }
210 _bigSound = NO;
211
212
215
216 if (
nil != _delegate && [_delegate respondsToSelector:
@selector(channel:didFinishPlayingSound:)])
217 {
218 [_delegate channel:self didFinishPlayingSound:sound];
219 }
220 [sound release];
221}
The documentation for this category was generated from the following file: