summary refs log tree commit diff stats
path: root/libs/CocosDenshion/SimpleAudioEngine.h
diff options
context:
space:
mode:
Diffstat (limited to 'libs/CocosDenshion/SimpleAudioEngine.h')
-rwxr-xr-xlibs/CocosDenshion/SimpleAudioEngine.h90
1 files changed, 90 insertions, 0 deletions
diff --git a/libs/CocosDenshion/SimpleAudioEngine.h b/libs/CocosDenshion/SimpleAudioEngine.h new file mode 100755 index 0000000..35396c6 --- /dev/null +++ b/libs/CocosDenshion/SimpleAudioEngine.h
@@ -0,0 +1,90 @@
1/*
2 Copyright (c) 2010 Steve Oldmeadow
3
4 Permission is hereby granted, free of charge, to any person obtaining a copy
5 of this software and associated documentation files (the "Software"), to deal
6 in the Software without restriction, including without limitation the rights
7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 copies of the Software, and to permit persons to whom the Software is
9 furnished to do so, subject to the following conditions:
10
11 The above copyright notice and this permission notice shall be included in
12 all copies or substantial portions of the Software.
13
14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 THE SOFTWARE.
21
22 $Id$
23 */
24
25
26#import "CDAudioManager.h"
27
28/**
29 A wrapper to the CDAudioManager object.
30 This is recommended for basic audio requirements. If you just want to play some sound fx
31 and some background music and have no interest in learning the lower level workings then
32 this is the interface to use.
33
34 Requirements:
35 - Firmware: OS 2.2 or greater
36 - Files: SimpleAudioEngine.*, CocosDenshion.*
37 - Frameworks: OpenAL, AudioToolbox, AVFoundation
38 @since v0.8
39 */
40@interface SimpleAudioEngine : NSObject <CDAudioInterruptProtocol> {
41
42 BOOL mute_;
43 BOOL enabled_;
44}
45
46/** Background music volume. Range is 0.0f to 1.0f. This will only have an effect if willPlayBackgroundMusic returns YES */
47@property (readwrite) float backgroundMusicVolume;
48/** Effects volume. Range is 0.0f to 1.0f */
49@property (readwrite) float effectsVolume;
50/** If NO it indicates background music will not be played either because no background music is loaded or the audio session does not permit it.*/
51@property (readonly) BOOL willPlayBackgroundMusic;
52
53/** returns the shared instance of the SimpleAudioEngine object */
54+ (SimpleAudioEngine*) sharedEngine;
55
56/** Preloads a music file so it will be ready to play as background music */
57-(void) preloadBackgroundMusic:(NSString*) filePath;
58
59/** plays background music in a loop*/
60-(void) playBackgroundMusic:(NSString*) filePath;
61/** plays background music, if loop is true the music will repeat otherwise it will be played once */
62-(void) playBackgroundMusic:(NSString*) filePath loop:(BOOL) loop;
63/** stops playing background music */
64-(void) stopBackgroundMusic;
65/** pauses the background music */
66-(void) pauseBackgroundMusic;
67/** resume background music that has been paused */
68-(void) resumeBackgroundMusic;
69/** rewind the background music */
70-(void) rewindBackgroundMusic;
71/** returns whether or not the background music is playing */
72-(BOOL) isBackgroundMusicPlaying;
73
74/** plays an audio effect with a file path*/
75-(ALuint) playEffect:(NSString*) filePath;
76/** stop a sound that is playing, note you must pass in the soundId that is returned when you started playing the sound with playEffect */
77-(void) stopEffect:(ALuint) soundId;
78/** plays an audio effect with a file path, pitch, pan and gain */
79-(ALuint) playEffect:(NSString*) filePath pitch:(Float32) pitch pan:(Float32) pan gain:(Float32) gain;
80/** preloads an audio effect */
81-(void) preloadEffect:(NSString*) filePath;
82/** unloads an audio effect from memory */
83-(void) unloadEffect:(NSString*) filePath;
84/** Gets a CDSoundSource object set up to play the specified file. */
85-(CDSoundSource *) soundSourceForFile:(NSString*) filePath;
86
87/** Shuts down the shared audio engine instance so that it can be reinitialised */
88+(void) end;
89
90@end