#include <OOALSoundChannel.h>
Definition at line 40 of file OOALSoundChannel.h.
◆ dealloc
Definition at line 1 of file OOALSoundChannel.m.
68{
69 [self hasStopped];
71 [super dealloc];
72}
◆ enqueueBuffer:
- (BOOL) enqueueBuffer: |
|
(OOSound *) | sound |
|
|
implementation |
Provided by category OOSoundChannel(Private).
Definition at line 1 of file OOALSoundChannel.m.
225{
226
228
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))",
235 return NO;
236 }
237 ALint playing = 0;
238 OOAL(alGetSourcei(
_source,AL_SOURCE_STATE,&playing));
239 if (playing != AL_PLAYING)
240 {
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 |
|
|
|
|
implementation |
Provided by category OOSoundChannel(Private).
Definition at line 1 of file OOALSoundChannel.m.
102{
104 {
105
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;
123
125 [self enqueueBuffer:_sound];
126 }
127 }
128}
◆ hasStopped
Provided by category OOSoundChannel(Private).
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;
202 }
203
206 {
207
209 }
211
212
215
217 {
218 [_delegate channel:self didFinishPlayingSound:sound];
219 }
220 [sound release];
221}
◆ init
Definition at line 1 of file OOALSoundChannel.m.
45{
46 if ((
self = [super
init]))
47 {
48 ALuint error;
50 if ((error = alGetError()) != AL_NO_ERROR)
51 {
53 [self release];
55 }
56 else
57 {
58
59 OOAL(alSourcei(
_source, AL_SOURCE_RELATIVE, AL_TRUE));
60 OOAL(alSource3f(
_source, AL_POSITION, 0.0f, 0.0f, 0.0f));
61 }
62 }
63 return self;
64}
static NSString *const kOOLogSoundInitError
◆ next
◆ playSound:looped:
- (BOOL) playSound: |
|
(OOSound *) | sound |
looped: |
|
(BOOL) | loop |
Definition at line 1 of file OOALSoundChannel.m.
162{
164
166
170 if ([
self enqueueBuffer:
sound])
171 {
173 return YES;
174 }
175 else
176 {
177 return NO;
178 }
179}
◆ setDelegate:
- (void) setDelegate: |
|
(id) | delegate |
|
◆ setGain:
- (void) setGain: |
|
(float) | gain |
|
◆ setNext:
◆ setPosition:
- (void) setPosition: |
|
(Vector) | vector |
|
Definition at line 1 of file OOALSoundChannel.m.
149 :(Vector) vector
150{
151 OOAL(alSource3f(
_source, AL_POSITION, vector.x, vector.y, vector.z));
152}
◆ sound
◆ stop
◆ update
Definition at line 1 of file OOALSoundChannel.m.
75{
76
78 {
79 ALint check;
81 if (check == AL_STOPPED)
82 {
83 [self hasStopped];
84 }
85 else if ([
_sound soundIncomplete])
86 {
87 OOLog(
@"sound.buffer",
@"Incomplete, trying next for %@", [
_sound name]);
88 [self getNextSoundBuffer];
89 }
91 {
92 OOLog(
@"sound.buffer",
@"Looping, trying restart for %@", [
_sound name]);
93
94 [_sound rewind];
95 [self getNextSoundBuffer];
96 }
97 }
98}
◆ _bigSound
◆ _buffer
◆ _delegate
◆ _lastBuffer
◆ _loop
◆ _next
◆ _playing
◆ _sound
◆ _source
The documentation for this class was generated from the following files: