Ardour  9.0-pre0-582-g084a23a80d
ARDOUR::DSP::DspShm Class Reference

#include <dsp_filter.h>

Public Member Functions

 DspShm (size_t s=0)
 
 ~DspShm ()
 
void allocate (size_t s)
 
void clear ()
 
float * to_float (size_t off)
 
int32_t * to_int (size_t off)
 
void atomic_set_int (size_t off, int32_t val)
 
int32_t atomic_get_int (size_t off)
 

Private Attributes

void * _data
 
size_t _size
 

Detailed Description

C/C++ Shared Memory

A convenience class representing a C array of float[] or int32_t[] data values. This is useful for lua scripts to perform DSP operations directly using C/C++ with CPU Hardware acceleration.

Access to this memory area is always 4 byte aligned. The data is interpreted either as float or as int.

This memory area can also be shared between different instances or the same lua plugin (DSP, GUI).

Since memory allocation is not realtime safe it should be allocated during dsp_init() or dsp_configure(). The memory is free()ed automatically when the lua instance is destroyed.

Definition at line 55 of file dsp_filter.h.

Constructor & Destructor Documentation

◆ DspShm()

ARDOUR::DSP::DspShm::DspShm ( size_t  s = 0)
inline

Definition at line 57 of file dsp_filter.h.

◆ ~DspShm()

ARDOUR::DSP::DspShm::~DspShm ( )
inline

Definition at line 66 of file dsp_filter.h.

Member Function Documentation

◆ allocate()

void ARDOUR::DSP::DspShm::allocate ( size_t  s)
inline

[re] allocate memory in host's memory space

Parameters
ssize, total number of float or integer elements to store.

Definition at line 74 of file dsp_filter.h.

◆ atomic_get_int()

int32_t ARDOUR::DSP::DspShm::atomic_get_int ( size_t  off)
inline

atomically read integer at offset

This involves a memory barrier. This call is intended for buffers which are shared with another instance.

Parameters
offoffset in shared memory region
Returns
value at offset

Definition at line 132 of file dsp_filter.h.

◆ atomic_set_int()

void ARDOUR::DSP::DspShm::atomic_set_int ( size_t  off,
int32_t  val 
)
inline

atomically set integer at offset

This involves a memory barrier. This call is intended for buffers which are shared with another instance.

Parameters
offoffset in shared memory region
valvalue to set

Definition at line 115 of file dsp_filter.h.

◆ clear()

void ARDOUR::DSP::DspShm::clear ( )
inline

clear memory (set to zero)

Definition at line 82 of file dsp_filter.h.

◆ to_float()

float* ARDOUR::DSP::DspShm::to_float ( size_t  off)
inline

access memory as float array

Parameters
offoffset in shared memory region
Returns
float[]

Definition at line 91 of file dsp_filter.h.

◆ to_int()

int32_t* ARDOUR::DSP::DspShm::to_int ( size_t  off)
inline

access memory as integer array

Parameters
offoffset in shared memory region
Returns
int_32_t[]

Definition at line 101 of file dsp_filter.h.

Member Data Documentation

◆ _data

void* ARDOUR::DSP::DspShm::_data
private

Definition at line 141 of file dsp_filter.h.

◆ _size

size_t ARDOUR::DSP::DspShm::_size
private

Definition at line 142 of file dsp_filter.h.


The documentation for this class was generated from the following file: