Can I play any buffer only once at a specific time?

From the OpenAL documentation:

The main objects of OpenAL are Listener, source and buffer. There may be a large number of buffers containing audio data. Each buffer may be attached to one or more sources.

My problem is that I have one sound file that I need to play several times per second at the same time. The sound lasts 2 seconds. Therefore, it will overlap.

Will I need a few full buffers for this (= several times this sound in memory)?

If I linked one buffer to several sources, can I play the sound 10 times, overlapping myself, having only one copy in memory? Or will I still have to deal with 10 copies of this sound in memory?

+3
source share
1 answer

you can, the buffer is independent of the source, you can have several sources pointing to the same buffer, causing alSourcePlay()you to play the source, not the buffer.

how they control the buffer while playing multiple sources pointing to the same buffer is a black box for the programmer controlled by the openAL driver.

, openAL () , , openAL - , openAL, . , alBuferData, OpenAL, openAL, , OpenAL.

+4

Source: https://habr.com/ru/post/1743905/


All Articles