离线
我放歌是正常的,那个数据格式改成16bit了,效果好像好了点但只限热血格斗,超级玛丽还会声音滞后,太难了
//16bit PCM 数据
if(0 > snd_pcm_hw_params_set_format(playback_handle, hw_params, SND_PCM_FORMAT_U16_LE))
{
printf("snd_pcm_hw_params_set_format err\n");
return -1;
}
//单声道 非立体声
if(0 > snd_pcm_hw_params_set_channels(playback_handle, hw_params, 1))
{
printf("snd_pcm_hw_params_set_channels err\n");
return -1;
}
void nes_apu_fill_buffer(int samples,u16* wavebuf)
{
//audio_pcm_play((unsigned char*)wavebuf,APU_PCMBUF_SIZE*2);
#if 1
int ret;
ret = snd_pcm_writei(playback_handle, (u8*)wavebuf, samples);
#endif
}
离线