Oolite 1.91.0.7644-241112-7f5034b
Loading...
Searching...
No Matches
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 32 of file OOALMusic.m.

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

◆ dealloc

- (void) dealloc
implementation

Definition at line 32 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

◆ initWithContentsOfFile:

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

Reimplemented from OOSound.

Definition at line 32 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

◆ isPlaying

- (BOOL) isPlaying

Definition at line 32 of file OOALMusic.m.

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

◆ musicGain

- (float) musicGain

Definition at line 32 of file OOALMusic.m.

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

◆ musicSoundSource

- (OOSoundSource *) musicSoundSource

Definition at line 32 of file OOALMusic.m.

109{
110 return sMusicSource;
111}

◆ name

- (NSString *) name
implementation

Reimplemented from OOSound.

Definition at line 32 of file OOALMusic.m.

69{
70 return [sound name];
71}

◆ playLooped:

- (void) playLooped: (BOOL) looped

Definition at line 32 of file OOALMusic.m.

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

◆ setMusicGain:

- (void) setMusicGain: (float) newValue

Definition at line 32 of file OOALMusic.m.

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

◆ stop

- (void) stop

Definition at line 32 of file OOALMusic.m.

121{
122 if (sPlayingMusic == self)
123 {
125 [sMusicSource stop];
126 [sMusicSource setSound:nil];
127 }
128}

Member Data Documentation

◆ sound

- (OOSound*) sound
private

Definition at line 40 of file OOALMusic.h.


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