OpenAl笔记(7)

2021-04-05 08:45

介绍了openal的基本用法

ALCfloatsourceTwoPos[] = {-2,0,-2}; ALCfloatsourceTwoVel[] = {1,1,1}; alSourcefv(sourceTwoIndex,AL_POSITION,sourceTwoPos); alSourcefv(sourceTwoIndex,AL_VELOCITY,sourceTwoVel); alSourcei(sourceTwoIndex,AL_LOOPING,AL_TRUE); alSourcef(sourceTwoIndex,AL_GAIN,1); alSourcef(sourceTwoIndex,AL_PITCH,1); // 设置听者的信息 ALCfloatlistenerPos[] = {0,0,-1}; ALCfloatlistenerVel[] = {0,0,0}; ALCfloatlistenerOri[] = {0,0,-1,0,1,0}; alListenerfv(AL_POSITION,listenerPos); alListenerfv(AL_VELOCITY,listenerVel); alListenerfv(AL_ORIENTATION,listenerOri); charchoose = '0'; alSourcePlay(sourceIndex); alSourcePlay(sourceTwoIndex); while (choose != 'q') { choose = getchar(); switch(choose) { case'w': sourcePos[0] -= sourceVel[0]; sourcePos[1] -= sourceVel[1]; sourcePos[2] -= sourceVel[2]; alSourcefv(sourceIndex,AL_POSITION,sourcePos); if (alGetError() != AL_NO_ERROR) { } alSourcei(sourceIndex, AL_SOURCE_RELATIVE, AL_FALSE); break; sourcePos[0] += sourceVel[0]; sourcePos[1] += sourceVel[1]; sourcePos[2] += sourceVel[2]; alSourcefv(sourceIndex,AL_POSITION,sourcePos); if (alGetError() != AL_NO_ERROR) { // 出错 exit(0); case's':


OpenAl笔记(7).doc 将本文的Word文档下载到电脑 下载失败或者文档不完整,请联系客服人员解决!

下一篇:从实践中启迪智慧

相关阅读
本类排行
× 注册会员免费下载(下载后可以自由复制和排版)

马上注册会员

注:下载文档有可能“只有目录或者内容不全”等情况,请下载之前注意辨别,如果您已付费且无法下载或内容有问题,请联系我们协助你处理。
微信: QQ: