SimpleAudioEngine

SimpleAudioEngine,第1张

概述说明 引擎版本:cocos2d-x 3.4    编译器:visual studio 2013    UI编辑器:Cocos Studio v1.6.0.0 SimpleAudioEngine(/cocosdension模块下) 头文件、命名空间 #include "audio/include/SimpleAu 说明 引擎版本:cocos2d-x 3.4 编译器:visual studio 2013 UI编辑器:Cocos Studio v1.6.0.0 SimpleAudioEngine(/cocosdension模块下) 头文件、命名空间
                                    #include "audio/include/SimpleAudioEngine.h"using namespace CocosDenshion;

主要播放两类声音:背景音乐、音效 不同平台,声音的格式不一定相同,下面是推荐的在各平台播放的声音格式:

背景音乐 音效
Win32 MP3、MID、WAV MID、WAV
AndroID OGG
IOS MP3、CAF CAF
这个类内容不多,用法也很简单: class EXPORT_DLL SimpleAudioEngine{public:static SimpleAudioEngine* getInstance(); /** @brIEf Release the shared Engine object @warning It must be called before the application exit,or a memory leak will be casued.(程序关闭前,记得释放,以防内存泄漏) */voID end();protectedvirtual ~SimpleAudioEngine @brIEf Preload background music @param pszfilePath The path of the background music file. * @Js preloadMusic * @lua preloadMusic preloadBackgroundMusic(constchar pszfilePath); @brIEf Play background music @param pszfilePath The path of the background music file,or the filename of T_SoundResInfo @param bLoop Whether the background music loop or not * @Js playMusic * @lua playMusic playBackgroundMusic,bool bLoop =false @brIEf Stop playing background music @param bReleaseData If release the background music data or not.As default value is false * @Js stopMusic * @lua stopMusic stopBackgroundMusic bReleaseData @brIEf Pause playing background music * @Js pauseMusic * @lua pauseMusic pauseBackgroundMusic @brIEf Resume playing background music * @Js resumeMusic * @lua resumeMusic resumeBackgroundMusic @brIEf Rewind playing background music * @Js rewindMusic * @lua rewindMusic rewindBackgroundMusic @brIEf Indicates whether any background music can be played or not. @return <i>true</i> if background music can be played,otherwise <i>false</i>. * @Js willPlayMusic * @lua willPlayMusic willPlayBackgroundMusic @brIEf Indicates whether the background music is playing @return <i>true</i> if the background music is playing,otherwise <i>false</i> * @Js isMusicPlaying * @lua isMusicPlaying isBackgroundMusicPlaying @brIEf The volume of the background music within the range of 0.0 as the minimum and 1.0 as the maximum. * @Js getMusicVolume * @lua getMusicVolume float getBackgroundMusicVolume @brIEf Set the volume of background music @param volume must be within the range of 0.0 as the minimum and 1.0 as the maximum. * @Js setMusicVolume * @lua setMusicVolume setBackgroundMusicVolume(float volume// // 音效模块 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @brIEf The volume of the effects within the range of 0.0 as the minimum and 1.0 as the maximum. getEffectsVolume @brIEf Set the volume of sound effects setEffectsVolume @brIEf Play sound effect with a file path,pitch,pan and gain @param pszfilePath The path of the effect file. @param bLoop 是否循环播放,默认为false @param pitch 频率,normal value is 1.0. Will also change effect play time. @param pan 声道,in the range of [-1..1] where -1 enables only left channel. @param gain 音量,in the range of [0..1]. The normal value is 1. @return the OpenAL source ID @note Full support is under development,Now there are limitations: - no pitch effect on Samsung galaxy S2 with OpenSL backend enabled; - no pitch/pan/gain on emscrippten,win32,marmalade.unsigned int playEffect pitch 1.0f pan 0.0f gain @brIEf Pause playing sound effect @param nSoundID The return value of function playEffect pauseEffect nSoundID @brIEf Pause all playing sound effect pauseAllEffects @brIEf Resume playing sound effect resumeEffect @brIEf Resume all playing sound effect resumeAllEffects @brIEf Stop playing sound effect stopEffect @brIEf Stop all playing sound effects stopAllEffects @brIEf preload a compressed audio file @details the compressed audio will be decoded to wave,then written into an internal buffer in SimpleAudioEngine @param pszfilePath The path of the effect file preloadEffect @brIEf unload the preloaded effect from internal buffer unloadEffect);}; 总结

以上是内存溢出为你收集整理的SimpleAudioEngine全部内容,希望文章能够帮你解决SimpleAudioEngine所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/web/1082173.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-05-27
下一篇 2022-05-27

发表评论

登录后才能评论

评论列表(0条)

保存