In this project I simply add 4 objects with their own sound.There is 4 different sound effects.
1,a speaker plays a background music on the ground.
2,a helicopter flies in air.
3,a car runs on the ground.
4,a F18 plane flies in air.
You can run to everywhere in this world to hear these sounds.
I use MITA for Audio Engine here.Because MITA is very simply and flexible to use.Even it is more simply and high performance-price ratio than fmod.With lossless timbre,it also high efficient.You can access to www.migantech.com to know more.
How to build a project like this:
0.Download a OgreSDK and MITA sdk package.Install OgreSDK.
1.Copy [mita.h] to project \include path.
2.Copy [mita.lib] and [mitaD.lib] under "library\VC" of the sdk package to the project \lib path.For example: I use ogre for my game engine,then I copy [mita.lib] to "OgreSDK_vc9_v1-7-2\lib\release" and copy [mitaD.lib] to "OgreSDK_vc9_v1-7-2\lib\debug".I use vs2008 to compile the project, so I add [mita.lib] and [mitaD.lib] to the linker.
3.Copy [mita.lib] and [mitaD.lib] to release and debug output path. For example:"OgreSDK_vc9_v1-7-2\bin"
4.Copy the plugins you want to use to the project plugins path. For example:"OgreSDK_vc9_v1-7-2\plugins".You can know their plugin type by their prefix. [cdc_mapl.dll] is used to make a playlist. dec_* is decode plugin. dev_* is audio device plugin. dsp_* is sound effect plugin. For example: I use two of them:[dec_ogg.dll] to play ogg music,[dev_mme.dll] to use mme device driver.
5.Copy the music or sound files to the right place.The format of the music files should be one of your decode plugins type. For example: I put [123.ogg] to "OgreSDK_vc9_v1-7-2\media",then I write in the code Param.lpPath = (MITA_LPCWSTR)L"../../media/123.ogg" to play it.
How to play the sound(Example for ogre):
1.Init the audio devices, see initMitaDevice() function.
2.For this 3D game, sounds have their own position and direction.The Listener should be the same place with our character even if our character moves around.You can handle it in the frameRenderingQueued() function.Our character update it's position and direction after 'evt.timeSinceLastFrame'.Now we let the Listener be updated by MITA_Input_Move3D() and MITA_Listener_SetDirection().See updateBody(Real deltaTime) function.
3.Play the sound.To play a static sound is very very simply.See playSpMusic() function.To play a movable sound also very simply.Just to use one more function MITA_Input_Move3D()! We also handle it in frameRenderingQueued() function. See f18addTime() and caraddTime().
Note:
1.I have 6 speakers, so I set MITA_GuessChannelMode(6, &ChannelMask). If you just use a headphone to play it, you should set MITA_GuessChannelMode(2, &ChannelMask).Because there is only two speakers.
2.MITA_Listener_SetPosition() and MITA_Listener_SetVelocity() usually are used together.So for the simple way, we can use MITA_Input_Move3D() as it is the same effect with the two functions mentioned before.
3.The minDis and maxDis in MITA_Input_SetDistance3D() is not the spread range of the sound.They are the min and max distence of change of the sound.Sound will never change if the distence between listener and sound source is smaller than the minDis or bigger than the maxDis.The maxDis should not be set smaller than 100.If you want to control the spread range of the sound, you can use MITA_Input_SetVolume(),MITA_Input_SetRollOff3D() and MITA_Input_SetStrength3D().Also you can stop to play the sound according to the distence(Usually used for a soundproof wall).
4.About MITA_Input_SetDirection3D(),"at" and "up" vectors must be of unit length and perpendicular to each other.If you got the degree of the character turned,you can just use MITA_Listener_SetDirectionAngle().See updateBody(Real deltaTime).
5.Don't forget to CloseHandle and RemoveSource.See mitademo::~mitademo(void).
6.dec_base.dll is used to play wma,tta and so on.
没有合适的资源?快使用搜索试试~ 我知道了~
ogre做图像引擎MITA做音频引擎做游戏的源代码
共65个文件
tga:8个
material:5个
mesh:5个
4星 · 超过85%的资源 需积分: 10 62 下载量 55 浏览量
2011-07-15
12:42:39
上传
评论 2
收藏 10.19MB 7Z 举报
温馨提示
用ogre做图像引擎,用MITA做音频引擎做游戏的源代码,docs目录下有详细说明。里面包含有所有的模型以及声音资源。
资源推荐
资源详情
资源评论
收起资源包目录
mitademo2011.5.21.7z (65个子文件)
mitademo
bin
Debug
mitaDemo.ncb 16.84MB
obj
Debug
BaseApplication.obj 2.41MB
mitatest2.exe.embed.manifest.res 728B
mitaDemo.exe.embed.manifest 663B
vc90.idb 4.09MB
BuildLog.htm 9KB
mitatest2.res 19KB
mt.dep 67B
mitademo.res 2KB
mitatest2.exe.embed.manifest 663B
vc90.pdb 9.13MB
mitaDemo.exe.intermediate.manifest 621B
mitademo.obj 1.31MB
mitatest2.exe.intermediate.manifest 621B
mitaDemo.exe.embed.manifest.res 728B
mitaDemo.suo 58KB
docs
ReadMe(TZH).txt 4KB
ReadMe(SZH).txt 4KB
ReadMe(EN).txt 4KB
mitatest2.vcproj 6KB
mitatest2.ncb 23.38MB
include
BaseApplication.h 3KB
mitademo.h 6KB
mita.h 432KB
src
mitademo.cpp 28KB
BaseApplication.cpp 10KB
mitatest2.vcproj.PC-201005021046.Administrator.user 2KB
media
frozen-mainzik-1p-full.ogg 3.08MB
models
carbody.mesh 18KB
apache.mesh 308KB
mitamm.mesh 224KB
yx.mesh 4KB
mitamm.mesh.skeleton 344KB
f18.mesh 115KB
f18.ogg 36KB
DeferredShadingMedia
Shaders.program 5KB
materials
textures
mmhead.tga 175KB
mmbody.tga 216KB
f18.jpg 125KB
carwheel.tga 256KB
yinxiang.jpg 27KB
car.tga 1.04MB
mmshoes.tga 146KB
mmcloths.tga 111KB
yinxiang2.jpg 45KB
mmhair.tga 222KB
mmhairtop.tga 117KB
scripts
yx.material 469B
mitamm.mesh.material 1KB
carbody.mesh.material 1KB
f18.material 218B
apache.material 1KB
programs
Blinn.cg 17KB
helicopter.ogg 508KB
car.ogg 29KB
plugins
dev_mme.dll 38KB
dec_ogg.dll 75KB
res
mitademo.aps 56KB
mitatest2.aps 73KB
mitademo.ico 1KB
mitademo.rc 2KB
Resource.h 498B
mitaDemo.sln 883B
lib
release
mita.lib 133KB
debug
mitaD.lib 135KB
共 65 条
- 1
Debug_Today
- 粉丝: 31
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 单相桥式全控整流MATALB Simulink仿真文件
- Dolby Vision安装包(解决杜比视界版本高清片源颜色不正问题)
- Python实现的简单二叉堆(最小堆)示例
- 嵌入式基础学习资料0000
- content_1714465331721.xls
- HM3401-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- Chainbase+Web3+APi+Data warehouse
- HM3401D-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
- GEE案例-1990-2023年计算某个区域的NDVI时序变化轨迹(以徐州市为例)含全部代码.pdf
- HM3401C-VB一款P-Channel沟道SOT23的MOSFET晶体管参数介绍与应用说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功
- 1
- 2
前往页