Opening an API Buffer Channel
Up to maxApiBufferChannel API buffer channels can independently store and execute API functions.
After starting the WMX3 engine, buffer memory to store API function call data must be allocated to an API channel before that channel can be used. The CreateApiBuffer function allocates buffer memory to an API channel. This function should be called during the initialization of the application, as allocation of memory can fail. All memory that a API buffer channel uses will be pre-allocated with this function, and the API buffer channel will not dynamically request any additional memory. This guarantees that the memory usage of the API buffer channel will be determinsitic. For additional information, see Function Calls Related to Memory Allocation.
The amount of buffer memory space required to store the data of one API function depends on the function. A simple StartPos function might require less than 200 bytes, whereas the SetParam function that sets all parameters might require over 80KB. If there is insufficient space in the buffer, the CommandQueueIsFull error is returned. The amount of buffer space that is required by an API function can be approximated by the size of the function arguments.
Opening a Channel Example
The following code allocates 3MB of buffer memory for API buffer channel 0.
wmxlib_ApiBuffer->CreateApiBuffer(0, 3, SizeUnit::Megabyte);