OpenAL:如何同时播放多种声音并将它们混合?
我以前使用过 SDL_Mixer,它正确地完成了这项工作:当我使用一个函数调用按顺序播放一种声音 10 次时,所有声音都会混合在一起。但是在 OpenAL 中,当我使用 alSourcePlay() 播放声音时,它只播放一种声音,而不混合到之前的声音中。
那么,如何同时播放超过 1 个声音呢?
I have used SDL_Mixer before, and it does this job correctly: when i play one sound with one single function call 10 times in sequence, all the sounds will get mixed together. But in OpenAL when i play a sound with alSourcePlay(), it just plays one sound without mixing into the previous sounds.
So, how can i play more than 1 sound at the same time?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
每种声音都需要一个来源。
缓冲器保存原始声音样本,并且可以馈送一个或多个源(一次并且同时)。听众定义了你的“耳朵”在哪里(只有一个!)。源是声音的单个实例,给定空间位置、音量、从中提取样本的缓冲区等。
因此,要同时播放 2 个声音,您需要 2 个源。
You need one source per sound.
A buffer holds the raw sound samples, and can feed one or several sources (at a time and simultaneously). A listener defines where your "ear" is (there is only ever one!). A source is a single instance of a sound, given a location in space, a volume, a buffer to pull samples from, and so on.
So, for 2 sounds to play simultaneously, you need 2 sources.