cocos2d-x 3.0 |
)
- 类列表 - 类索引 - 类继承关系 - 类成员
全部) 类) 命名空间) 文件) 函数) 变量) 类型定义) 枚举) 枚举值) 属性) 友元) 宏定义) 组) 页)
Instance Methods | Class Methods | Protected 属性 | 属性 | 所有成员列表
CDAudioManager类 参考
CDAudioManager 管理游戏的音频。它用于提供通过CDSoundEngine对象来播放音效的权限。CDAudioManager内部包含两个CDLongAudioSource 对象(左右声道),用来播放长间隔的音频比如背景音乐和叙述性的语音。另外,它来管理同其他app声音之间的切换和交互。 环境要求: 更多…
#import
类 CDAudioManager 继承关系图:
## Instance Methods | |
(id) | - init: |
同步的初始化引擎的模式,声道定义和声道数量 更多… | |
(void) | - audioSessionInterrupted |
(void) | - audioSessionResumed |
(void) | - setResignBehavior:autoHandle: |
(BOOL) | - isDeviceMuted |
返回音频是否硬件层的将设备设为静音 更多… | |
(BOOL) | - isOtherAudioPlaying |
返回是否有其他app在播放音频,比如iPod音乐播放程序 更多… | |
(void) | - setMode: |
设置音频管理同操作系统交互的方式,比如是否同其他app交互使用音频输出设备或者允许静音开关 更多… | |
(void) | - applicationWillResignActive |
如果你需要使用内置的挂起行为又想在挂起时执行一些自己的音频处理操作,实现这个方法 更多… | |
(void) | - applicationDidBecomeActive |
如果你需要使用内置的恢复行为又想在恢复时执行一些自己的音频处理操作,实现这个方法. 更多… | |
(CDLongAudioSource ) | - audioSourceLoad:channel: |
从指定音频文件中加载数据到声道的音频源中 更多… | |
(CDLongAudioSource ) | - audioSourceForChannel: |
恢复指定声道的音频源 更多… | |
(void) | - playBackgroundMusic:loop: |
播放背景音乐,可以循环也可以不循环 推荐使用.acc格式的背景音乐,因为这种格式文件可以硬件解码 更多… | |
(void) | - preloadBackgroundMusic: |
预加载背景音乐 更多… | |
(void) | - stopBackgroundMusic |
停止播放背景音乐 更多… | |
(void) | - pauseBackgroundMusic |
暂停背景音乐播放 更多… | |
(void) | - rewindBackgroundMusic |
倒序播放背景音乐 更多… | |
(void) | - resumeBackgroundMusic |
恢复播放背景音乐 更多… | |
(BOOL) | - isBackgroundMusicPlaying |
背景音乐是否正在播放中 更多… | |
(void) | - setBackgroundMusicCompletionListener:selector: |
(id) | - init: |
Initializes the engine synchronously with a mode, channel definition and a total number of channels. 更多… | |
(void) | - audioSessionInterrupted |
(void) | - audioSessionResumed |
(void) | - setResignBehavior:autoHandle: |
(BOOL) | - isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off. 更多… | |
(BOOL) | - isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player. 更多… | |
(void) | - setMode: |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch. 更多… | |
(void) | - applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active. 更多… | |
(void) | - applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active. 更多… | |
(CDLongAudioSource ) | - audioSourceLoad:channel: |
Loads the data from the specified file path to the channel's audio source. 更多… | |
(CDLongAudioSource ) | - audioSourceForChannel: |
Retrieves the audio source for the specified channel. 更多… | |
(void) | - playBackgroundMusic:loop: |
Plays music in background. 更多… | |
(void) | - preloadBackgroundMusic: |
Preloads a background music. 更多… | |
(void) | - stopBackgroundMusic |
Stops playing the background music. 更多… | |
(void) | - pauseBackgroundMusic |
Pauses the background music. 更多… | |
(void) | - rewindBackgroundMusic |
Rewinds the background music. 更多… | |
(void) | - resumeBackgroundMusic |
Resumes playing the background music. 更多… | |
(BOOL) | - isBackgroundMusicPlaying |
Returns whether or not the background music is playing. 更多… | |
(void) | - setBackgroundMusicCompletionListener:selector: |
Instance Methods 继承自 <CDLongAudioSourceDelegate> | |
(void) | - cdAudioSourceDidFinishPlaying: |
声道播放完成 更多… | |
(void) | - cdAudioSourceFileDidChange: |
声道播放的音频源有变化 更多… | |
(void) | - cdAudioSourceDidFinishPlaying: |
The audio source completed playing. 更多… | |
(void) | - cdAudioSourceFileDidChange: |
The file used to load the audio source has changed. 更多… | |
Instance Methods 继承自 <CDAudioInterruptProtocol> | |
(BOOL) | - mute |
Is audio mute. 更多… | |
(void) | - setMute: |
If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. 更多… | |
(BOOL) | - enabled |
Is audio enabled. 更多… | |
(void) | - setEnabled: |
If NO then all audio is stopped and any calls to start new audio will be ignored. 更多… | |
(BOOL) | - mute |
Is audio mute. 更多… | |
(void) | - setMute: |
If YES then audio is silenced but not stopped, calls to start new audio will proceed but silently. 更多… | |
(BOOL) | - enabled |
Is audio enabled. 更多… | |
(void) | - setEnabled: |
If NO then all audio is stopped and any calls to start new audio will be ignored. 更多… | |
## Class Methods | |
(CDAudioManager ) | + sharedManager |
返回共享的单例 更多… | |
(tAudioManagerState) | + sharedManagerState |
(void) | + configure: |
设置单例的模式 更多… | |
(void) | + initAsynchronously: |
异步的初始化音频引擎的模式 更多… | |
(void) | + end |
关闭音频管理对象,以便于重新初始化 更多… | |
(CDAudioManager ) | + sharedManager |
Returns the shared singleton. 更多… | |
(tAudioManagerState) | + sharedManagerState |
(void) | + configure: |
Configures the shared singleton with a mode. 更多… | |
(void) | + initAsynchronously: |
Initializes the engine asynchronously with a mode. 更多… | |
(void) | + end |
Shuts down the shared audio manager instance so that it can be reinitialised. 更多… | |
## Protected 属性 | |
NSMutableArray | audioSourceChannels |
NSString | _audioSessionCategory |
BOOL | _audioWasPlayingAtStartup |
tAudioManagerMode | _mode |
SEL | backgroundMusicCompletionSelector |
id | backgroundMusicCompletionListener |
BOOL | _mute |
BOOL | _resigned |
BOOL | _interrupted |
BOOL | _audioSessionActive |
BOOL | enabled_ |
BOOL | _isObservingAppEvents |
tAudioManagerResignBehavior | _resignBehavior |
## 属性 | |
CDSoundEngine | soundEngine |
CDLongAudioSource | backgroundMusic |
BOOL | willPlayBackgroundMusic |
详细描述
CDAudioManager 管理游戏的音频。它用于提供通过CDSoundEngine对象来播放音效的权限。CDAudioManager内部包含两个CDLongAudioSource 对象(左右声道),用来播放长间隔的音频比如背景音乐和叙述性的语音。另外,它来管理同其他app声音之间的切换和交互。 环境要求:
CDAudioManager manages audio requirements for a game.
- Firmware: OS 2.2 or greater
- Files: CDAudioManager., CocosDenshion.
- Frameworks: OpenAL, AudioToolbox, AVFoundation
- 自从
- v0.8 It provides access to a CDSoundEngine object for playing sound effects. It provides access to two CDLongAudioSource object (left and right channel) for playing long duration audio such as background music and narration tracks. Additionally it manages the audio session to take care of things like audio session interruption and interacting with the audio of other apps that are running on the device.
Requirements:
- Firmware: OS 2.2 or greater
- Files: CDAudioManager., CocosDenshion.
- Frameworks: OpenAL, AudioToolbox, AVFoundation
- 自从
- v0.8
Method Documentation
- (void) applicationDidBecomeActive |
如果你需要使用内置的恢复行为又想在恢复时执行一些自己的音频处理操作,实现这个方法.
- (void) applicationDidBecomeActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on become active.
- (void) applicationWillResignActive |
Call if you want to use built in resign behavior but need to do some additional audio processing on resign active.
- (void) applicationWillResignActive |
如果你需要使用内置的挂起行为又想在挂起时执行一些自己的音频处理操作,实现这个方法
- (void) audioSessionInterrupted |
- (void) audioSessionInterrupted |
- (void) audioSessionResumed |
- (void) audioSessionResumed |
- (CDLongAudioSource*) audioSourceForChannel: | (tAudioSourceChannel) | channel |
恢复指定声道的音频源
- (CDLongAudioSource*) audioSourceForChannel: | (tAudioSourceChannel) | channel |
Retrieves the audio source for the specified channel.
- (CDLongAudioSource) audioSourceLoad: | (NSString ) | filePath | |
channel: | (tAudioSourceChannel) | channel | |
Loads the data from the specified file path to the channel's audio source.
- (CDLongAudioSource) audioSourceLoad: | (NSString ) | filePath | |
channel: | (tAudioSourceChannel) | channel | |
从指定音频文件中加载数据到声道的音频源中
+ (void) configure: | (tAudioManagerMode) | mode |
Configures the shared singleton with a mode.
+ (void) configure: | (tAudioManagerMode) | mode |
设置单例的模式
+ (void) end |
Shuts down the shared audio manager instance so that it can be reinitialised.
+ (void) end |
关闭音频管理对象,以便于重新初始化
- (id) init: | (tAudioManagerMode) | mode |
同步的初始化引擎的模式,声道定义和声道数量
- (id) init: | (tAudioManagerMode) | mode |
Initializes the engine synchronously with a mode, channel definition and a total number of channels.
+ (void) initAsynchronously: | (tAudioManagerMode) | mode |
异步的初始化音频引擎的模式
+ (void) initAsynchronously: | (tAudioManagerMode) | mode |
Initializes the engine asynchronously with a mode.
- (BOOL) isBackgroundMusicPlaying |
背景音乐是否正在播放中
- (BOOL) isBackgroundMusicPlaying |
Returns whether or not the background music is playing.
- (BOOL) isDeviceMuted |
返回音频是否硬件层的将设备设为静音
- (BOOL) isDeviceMuted |
Returns true is audio is muted at a hardware level e.g user has ringer switch set to off.
- (BOOL) isOtherAudioPlaying |
Returns true if another app is playing audio such as the iPod music player.
- (BOOL) isOtherAudioPlaying |
返回是否有其他app在播放音频,比如iPod音乐播放程序
- (void) pauseBackgroundMusic |
暂停背景音乐播放
- (void) pauseBackgroundMusic |
Pauses the background music.
- (void) playBackgroundMusic: | (NSString *) | filePath | |
loop: | (BOOL) | loop | |
Plays music in background.
The music can be looped or not It is recommended to use .aac files as background music since they are decoded by the device (hardware).
- (void) playBackgroundMusic: | (NSString *) | filePath | |
loop: | (BOOL) | loop | |
播放背景音乐,可以循环也可以不循环 推荐使用.acc格式的背景音乐,因为这种格式文件可以硬件解码
- (void) preloadBackgroundMusic: | (NSString *) | filePath |
预加载背景音乐
- (void) preloadBackgroundMusic: | (NSString *) | filePath |
Preloads a background music.
- (void) resumeBackgroundMusic |
恢复播放背景音乐
- (void) resumeBackgroundMusic |
Resumes playing the background music.
- (void) rewindBackgroundMusic |
倒序播放背景音乐
- (void) rewindBackgroundMusic |
Rewinds the background music.
- (void) setBackgroundMusicCompletionListener: | (id) | listener | |
selector: | (SEL) | selector | |
- (void) setBackgroundMusicCompletionListener: | (id) | listener | |
selector: | (SEL) | selector | |
- (void) setMode: | (tAudioManagerMode) | mode |
Sets the way the audio manager interacts with the operating system such as whether it shares output with other apps or obeys the mute switch.
- (void) setMode: | (tAudioManagerMode) | mode |
设置音频管理同操作系统交互的方式,比如是否同其他app交互使用音频输出设备或者允许静音开关
- (void) setResignBehavior: | (tAudioManagerResignBehavior) | resignBehavior | |
autoHandle: | (BOOL) | autoHandle | |
- (void) setResignBehavior: | (tAudioManagerResignBehavior) | resignBehavior | |
autoHandle: | (BOOL) | autoHandle | |
+ (CDAudioManager *) sharedManager |
返回共享的单例
+ (CDAudioManager *) sharedManager |
Returns the shared singleton.
+ (tAudioManagerState) sharedManagerState |
+ (tAudioManagerState) sharedManagerState |
- (void) stopBackgroundMusic |
停止播放背景音乐
- (void) stopBackgroundMusic |
Stops playing the background music.
类成员变量说明
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
| protected |
属性说明
| readatomicassign |
| readatomicassign |
| readatomicassign |
该类的文档由以下文件生成:
- /Users/zeroyang/Documents/github/cocos2d-x/cocos/audio/ios/CDAudioManager.h
- CDAudioManager
- 生成于 2014年 五月 29日 星期四 09:41:42 , 为 cocos2d-x使用 1.8.6