Skip to content
Igor Zinken edited this page Dec 26, 2019 · 3 revisions

See <utilities/bufferpool.h>

The BufferPool provides static methods to retrieve cached instances of audio buffers. This is in used by the Synthesizer for BaseSynthEvents to improve performance of repeated actions, or by oscillators to generate their waveforms cycles. Basically, bufferpool is a SampleManager for waveforms.

Public methods

SAMPLE_TYPE* getSilentBuffer( int bufferSize )

Attempts to retrieve a SAMPLE_TYPE buffer of given bufferSize in length from the pool. If it didn't exist, it will be created and added to the pool prior to returning. You can use this silent buffer to provide fast memcpy operations instead of loop based reassignments when silencing buffers.

RingBuffer* getRingBufferForEvent( BaseSynthEvent* event, float frequency )

Attempts to retrieve a RingBuffer for given event at given frequency. If it didn't exist, it will be created and added to the pool prior to returning. RingBuffers are used by the Synthesizer together with pitch modulators (such as the Arpeggiator) for waveforms that require RingBuffers (e.g. Karplus Strong synthesis).

bool destroyRingBuffersForEvent( BaseSynthEvent* event )

Destroys all cached ring buffers associated with given event to free up allocated memory resources.

Clone this wiki locally