Fmod studio latency

来源:互联网 发布:dubbo 视频教程 源码 编辑:程序博客网 时间:2024/04/26 20:30

the FMOD software mixer mixes to a ringbuffer. The size of this ringbuffer is determined here. It mixes a block of sound data every 'bufferlength' number of samples, and there are 'numbuffers' number of these blocks that make up the entire ringbuffer. Adjusting these values can lead to extremely low latency performance (smaller values), or greater stability in sound output (larger values).

fmod 使用软件混合时,计算延迟公式:

FMOD_RESULT result;

unsigned int blocksize;

int numblocks;

float ms;


result = system->getDSPBufferSize(&blocksize, &numblocks);

result = system->getSoftwareFormat(&frequency, 0, 0);


ms = (float)blocksize * 1000.0f / (float)frequency;


printf("Mixer blocksize = %.02f ms\n", ms);

printf("Mixer Total buffersize = %.02f ms\n", ms * numblocks);

printf("Mixer Average Latency = %.02f ms\n", ms * ((float)numblocks - 1.5f));

故使用:

System::setDSPBufferSize和System::setSoftwareFormat


可以提高响应的速度(减少延迟).不过,调整这两个接口的参数,亦有可能会引起声音的失真,如声音抖动的现象。在android 系统下面,尤其明显。如果android api在17以上,可以通过AudioManager.PROPERTY_OUTPUT_SAMPLE_RATE以及 AudioManager.PROPERTY_OUTPUT_FRAMES_PER_BUFFER接口,取得手机原始的处理的buffersize以及samplerate,以降低手机的延迟。


游戏技术骑士团 山顶的微风

20160905

游戏开发音效

0 0
原创粉丝点击