Oolite 1.91.0.7665-250419-c535bfe
All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Macros Modules Pages
OOMusic Class Reference

#include <OOALMusic.h>

+ Inheritance diagram for OOMusic:
+ Collaboration diagram for OOMusic:

Instance Methods

(void) - playLooped:
 
(void) - stop
 
(BOOL) - isPlaying
 
(void) - setMusicGain:
 
(float) - musicGain
 
(OOSoundSource *) - musicSoundSource
 
(void) - dealloc [implementation]
 
(id) - initWithContentsOfFile: [implementation]
 
(NSString *) - name [implementation]
 
- Instance Methods inherited from OOSound
(ALuint) - soundBuffer
 
(BOOL) - soundIncomplete
 
(void) - rewind
 
(id) - init [implementation]
 
(id) - initWithDecoder: [implementation]
 
(id) - initWithCustomSoundKey:
 
(jsval) - oo_jsValueInContext: [implementation]
 
(NSString *) - oo_jsDescription [implementation]
 
(NSString *) - oo_jsClassName [implementation]
 

Class Methods

(id) + allocWithZone: [implementation]
 
- Class Methods inherited from OOSound
(BOOL) + setUp
 
(void) + update
 
(void) + setMasterVolume:
 
(float) + masterVolume
 
(BOOL) + isSoundOK
 
(id) + soundWithCustomSoundKey:
 

Private Attributes

OOSoundsound
 

Detailed Description

Definition at line 37 of file OOALMusic.h.

Method Documentation

◆ allocWithZone:

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

Definition at line 37 of file OOALMusic.m.

37 :(NSZone *)inZone
38{
39 return NSAllocateObject([OOMusic class], 0, inZone);
40}

◆ dealloc

- (void) dealloc
implementation

Definition at line 43 of file OOALMusic.m.

44{
45 if (sPlayingMusic == self) [self stop];
46 [sound release];
47
48 [super dealloc];
49}
static OOMusic * sPlayingMusic
Definition OOALMusic.m:31

References dealloc, sPlayingMusic, and stop.

Referenced by dealloc.

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

◆ initWithContentsOfFile:

- (id) initWithContentsOfFile: (NSString *) inPath
implementation

Reimplemented from OOSound.

Definition at line 51 of file OOALMusic.m.

51 :(NSString *)inPath
52{
53 self = [super init];
54 if (nil != self)
55 {
56 sound = [[OOSound alloc] initWithContentsOfFile:inPath];
57 if (nil == sound)
58 {
59 [self release];
60 self = nil;
61 }
62 }
63
64 return self;
65}
return nil
OOSound * sound
Definition OOALMusic.h:40

References OOSound::init, nil, and sound.

+ Here is the call graph for this function:

◆ isPlaying

- (BOOL) isPlaying

Definition at line 114 of file OOALMusic.m.

115{
116 return sPlayingMusic == self && [sMusicSource isPlaying];
117}

References isPlaying, OOSoundSource::isPlaying, and sPlayingMusic.

Referenced by isPlaying, and OOMusicController::isPlaying.

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

◆ musicGain

- (float) musicGain

Definition at line 83 of file OOALMusic.m.

84{
85 if (nil == sMusicSource) return 0.0f;
86 return [sMusicSource gain];
87}
static OOSoundSource * sMusicSource
Definition OOALMusic.m:32

References OOSoundSource::gain, musicGain, nil, and sMusicSource.

Referenced by musicGain.

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

◆ musicSoundSource

- (OOSoundSource *) musicSoundSource

Definition at line 108 of file OOALMusic.m.

109{
110 return sMusicSource;
111}

References musicSoundSource, and sMusicSource.

Referenced by musicSoundSource, and OOMusicController::soundSource.

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

◆ name

- (NSString *) name
implementation

Reimplemented from OOSound.

Definition at line 68 of file OOALMusic.m.

69{
70 return [sound name];
71}

References name, and OOSound::name.

Referenced by name, and OOMusicController::playingMusic.

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

◆ playLooped:

- (void) playLooped: (BOOL) looped

Definition at line 90 of file OOALMusic.m.

90 :(BOOL)inLoop
91{
92 if (sPlayingMusic != self)
93 {
94 if (nil == sMusicSource)
95 {
96 sMusicSource = [[OOSoundSource alloc] init];
97 }
99 [sMusicSource setLoop:inLoop];
100 [sMusicSource setSound:sound];
102
103 sPlayingMusic = self;
104 }
105}
void setLoop:(BOOL inLoop)
void setSound:(OOSound *inSound)

References nil, OOSoundSource::play, OOSoundSource::setLoop:, OOSoundSource::setSound:, sMusicSource, sPlayingMusic, and OOSoundSource::stop.

Referenced by OOMusicController::playMusicNamed:loop:gain:.

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

◆ setMusicGain:

- (void) setMusicGain: (float) newValue

Definition at line 74 of file OOALMusic.m.

74 :(float)newValue
75{
76 if (nil != sMusicSource)
77 {
78 [sMusicSource setGain:newValue];
79 }
80}
void setGain:(float gain)

References nil, OOSoundSource::setGain:, and sMusicSource.

Referenced by OOMusicController::playMusicNamed:loop:gain:.

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

◆ stop

- (void) stop

Definition at line 120 of file OOALMusic.m.

121{
122 if (sPlayingMusic == self)
123 {
127 }
128}

References nil, OOSoundSource::setSound:, sPlayingMusic, stop, and OOSoundSource::stop.

Referenced by dealloc, OOMusicController::justStop, OOMusicController::playMusicNamed:loop:gain:, and stop.

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

Member Data Documentation

◆ sound

- (OOSound*) sound
private

Definition at line 40 of file OOALMusic.h.

Referenced by initWithContentsOfFile:.


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