Bela
|
Macros | |
#define | BELA_AUDIO_PRIORITY 95 |
Typedefs | |
typedef void * | AuxiliaryTask |
Functions | |
AuxiliaryTask | Bela_createAuxiliaryTask (void(*functionToCall)(void *), int priority, const char *name, void *args, bool autoSchedule=false) |
Create a new auxiliary task. More... | |
AuxiliaryTask | Bela_createAuxiliaryTask (void(*functionToCall)(void), int priority, const char *name, bool autoSchedule=false) |
void | Bela_scheduleAuxiliaryTask (AuxiliaryTask task) |
Run an auxiliary task which has previously been created. More... | |
void | Bela_autoScheduleAuxiliaryTasks () |
Detailed Description
These functions are used to create separate real-time tasks (threads) which run at lower priority than the audio processing. They can be used, for example, for large time-consuming calculations which would take more than one audio frame length to process, or they could be used to communicate with external hardware when that communication might block or be delayed.
All auxiliary tasks used by the program should be created in setup(). The tasks can then be scheduled at will within the render() function.
Macro Definition Documentation
#define BELA_AUDIO_PRIORITY 95 |
Xenomai priority level for audio processing. Maximum possible priority is 99. In general, all auxiliary tasks should have a level lower than this unless for\ special purposes where the task needs to interrupt audio processing.
Typedef Documentation
typedef void* AuxiliaryTask |
Auxiliary task variable. Auxiliary tasks are created using createAuxiliaryTask() and automatically cleaned up after cleanup() finishes.
Function Documentation
AuxiliaryTask Bela_createAuxiliaryTask | ( | void(*)(void *) | functionToCall, |
int | priority, | ||
const char * | name, | ||
void * | args, | ||
bool | autoSchedule = false |
||
) |
Create a new auxiliary task.
This function creates a new auxiliary task which, when scheduled, runs the function specified in the first argument. Note that the task does not run until scheduleAuxiliaryTask() is called. Auxiliary tasks should be created in setup() and never in render() itself.
The second argument specifies the real-time priority. Valid values are between 0 and 99, and usually should be lower than BELA_AUDIO_PRIORITY. Tasks with higher priority always preempt tasks with lower priority.
- Parameters
-
functionToCall Function which will run each time the auxiliary task is scheduled. priority Xenomai priority level at which the task should run. name Name for this task, which should be unique system-wide (no other running program should use this name).
void Bela_scheduleAuxiliaryTask | ( | AuxiliaryTask | task | ) |
Run an auxiliary task which has previously been created.
This function will schedule an auxiliary task to run. When the task runs, the function in the first argument of createAuxiliaryTaskLoop() will be called.
scheduleAuxiliaryTask() is typically called from render() to start a lower-priority task. The function will not run immediately, but only once any active higher priority tasks have finished.
- Parameters
-
task Task to schedule for running.
Generated on Fri Nov 22 2024 06:27:57 for Bela by 1.8.11