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

#include <OOALBufferedSound.h>

Inheritance diagram for OOALBufferedSound:
Collaboration diagram for OOALBufferedSound:

Instance Methods

(id) - initWithDecoder:
(void) - dealloc [implementation]
(NSString *) - name [implementation]
(ALuint) - soundBuffer [implementation]
Instance Methods inherited from OOSound
(id) - initWithContentsOfFile:
(BOOL) - soundIncomplete
(void) - rewind
(id) - init [implementation]
(id) - initWithCustomSoundKey:
(jsval) - oo_jsValueInContext: [implementation]
(NSString *) - oo_jsDescription [implementation]
(NSString *) - oo_jsClassName [implementation]

Private Attributes

char * _buffer
size_t _size
double _sampleRate
NSString * _name
BOOL _stereo

Additional Inherited Members

Class Methods inherited from OOSound
(BOOL) + setUp
(void) + update
(void) + setMasterVolume:
(float) + masterVolume
(BOOL) + isSoundOK
(id) + soundWithCustomSoundKey:

Detailed Description

Definition at line 30 of file OOALBufferedSound.h.

Method Documentation

◆ dealloc

- (void) dealloc
implementation

Definition at line 34 of file OOALBufferedSound.m.

35{
36 free(_buffer);
37 _buffer = NULL;
39
40 [super dealloc];
41}
#define DESTROY(x)

References _buffer, _name, dealloc, and DESTROY.

Referenced by dealloc.

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

◆ initWithDecoder:

- (id) initWithDecoder: (OOALSoundDecoder*) inDecoder

Reimplemented from OOSound.

Definition at line 48 of file OOALBufferedSound.m.

48 :(OOALSoundDecoder*)inDecoder
49{
50 BOOL OK = YES;
51
52 [OOSound setUp];
53 if (![OOSound isSoundOK] || nil == inDecoder)
54 OK = NO;
55
56 if (OK) {
57 self = [super init];
58 if (nil == self)
59 OK = NO;
60 }
61
62 if (OK) {
63 _name = [[inDecoder name] copy];
64 _sampleRate = [inDecoder sampleRate];
65 OK = [inDecoder readCreatingBuffer:&_buffer withFrameCount:&_size];
66 _stereo = [inDecoder isStereo];
67 }
68
69 if (!OK) {
70 [self release];
71 self = nil;
72 }
73 return self;
74}
return nil
BOOL readCreatingBuffer:withFrameCount:(char **outBuffer,[withFrameCount] size_t *outSize)
BOOL isSoundOK()
Definition OOALSound.m:143
BOOL setUp()
Definition OOALSound.m:46

References _name, _sampleRate, _stereo, OOSound::init, OOSound::isSoundOK, OOALSoundDecoder::isStereo, OOALSoundDecoder::name, nil, OOALSoundDecoder::readCreatingBuffer:withFrameCount:, OOALSoundDecoder::sampleRate, and OOSound::setUp.

Here is the call graph for this function:

◆ name

- (NSString *) name
implementation

Reimplemented from OOSound.

Definition at line 43 of file OOALBufferedSound.m.

44{
45 return _name;
46}

References _name, and name.

Referenced by name.

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

◆ soundBuffer

- (ALuint) soundBuffer
implementation

Reimplemented from OOSound.

Definition at line 76 of file OOALBufferedSound.m.

77{
78 ALuint buffer;
79 ALint error;
80 OOAL(alGenBuffers(1, &buffer));
81 if ((error = alGetError()) != AL_NO_ERROR) {
82 OOLog(kOOLogSoundLoadingError, @"%@", @"Could not create OpenAL buffer");
83 return 0;
84 } else {
85 if (!_stereo) {
86 alBufferData(buffer, AL_FORMAT_MONO16, _buffer, (ALsizei)_size, _sampleRate);
87 } else {
88 alBufferData(buffer, AL_FORMAT_STEREO16, _buffer, (ALsizei)_size, _sampleRate);
89 }
90 return buffer;
91 }
92}
#define OOLog(class, format,...)
Definition OOLogging.h:84
static NSString *const kOOLogSoundLoadingError
#define OOAL(cmd)
Definition OOOpenAL.h:40

References _buffer, _sampleRate, _size, _stereo, kOOLogSoundLoadingError, OOAL, OOLog, and soundBuffer.

Referenced by soundBuffer.

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

Member Data Documentation

◆ _buffer

- (char*) _buffer
private

Definition at line 32 of file OOALBufferedSound.h.

Referenced by dealloc, and soundBuffer.

◆ _name

- (NSString*) _name
private

Definition at line 35 of file OOALBufferedSound.h.

Referenced by dealloc, initWithDecoder:, and name.

◆ _sampleRate

- (double) _sampleRate
private

Definition at line 34 of file OOALBufferedSound.h.

Referenced by initWithDecoder:, and soundBuffer.

◆ _size

- (size_t) _size
private

Definition at line 33 of file OOALBufferedSound.h.

Referenced by soundBuffer.

◆ _stereo

- (BOOL) _stereo
private

Definition at line 36 of file OOALBufferedSound.h.

Referenced by initWithDecoder:, and soundBuffer.


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