LMMS
Loading...
Searching...
No Matches
DSSIaudiooutput Class Reference

#include <DSSIaudiooutput.h>

Classes

struct  ProgramDescriptor

Public Member Functions

void connectPort (unsigned long port, LADSPA_Data *data)
void activate ()
void run (unsigned long sample_count)
void deactivate ()
void cleanup ()
const DSSI_Program_DescriptorgetProgram (unsigned long Index)
void selectProgram (unsigned long bank, unsigned long program)
int getMidiControllerForPort (unsigned long port)
void runSynth (unsigned long sample_count, snd_seq_event_t *events, unsigned long event_count)

Static Public Member Functions

static void stub_connectPort (LADSPA_Handle instance, unsigned long port, LADSPA_Data *data)
static void stub_activate (LADSPA_Handle instance)
static void stub_run (LADSPA_Handle instance, unsigned long sample_count)
static void stub_deactivate (LADSPA_Handle Instance)
static void stub_cleanup (LADSPA_Handle instance)
static const DSSI_Program_Descriptorstub_getProgram (LADSPA_Handle instance, unsigned long Index)
static void stub_selectProgram (LADSPA_Handle instance, unsigned long bank, unsigned long program)
static int stub_getMidiControllerForPort (LADSPA_Handle instance, unsigned long port)
static void stub_runSynth (LADSPA_Handle instance, unsigned long sample_count, snd_seq_event_t *events, unsigned long event_count)
static LADSPA_Handle instantiate (const LADSPA_Descriptor *descriptor, unsigned long s_rate)
static const LADSPA_DescriptorgetLadspaDescriptor (unsigned long index)
static const DSSI_DescriptorgetDssiDescriptor (unsigned long index)

Private Member Functions

 DSSIaudiooutput (unsigned long sampleRate)
 ~DSSIaudiooutput ()
void initBanks ()
bool mapNextBank ()

Static Private Member Functions

static DSSI_DescriptorinitDssiDescriptor ()
static DSSIaudiooutputgetInstance (LADSPA_Handle instance)

Private Attributes

LADSPA_Dataoutl
LADSPA_Dataoutr
long sampleRate
Mastermaster
bool banksInited

Static Private Attributes

static DSSI_DescriptordssiDescriptor
static std::string bankDirNames []
static std::vector< ProgramDescriptorprogramMap
static long bankNoToMap = 1

Constructor & Destructor Documentation

◆ DSSIaudiooutput()

DSSIaudiooutput::DSSIaudiooutput ( unsigned long sampleRate)
private

The private sole constructor for the DSSIaudiooutput class.

Only ever called via instantiate().

Parameters
sampleRate[in] the sample rate to be used by the synth.
Returns

◆ ~DSSIaudiooutput()

DSSIaudiooutput::~DSSIaudiooutput ( )
private

The destructor for the DSSIaudiooutput class

Returns

Member Function Documentation

◆ activate()

void DSSIaudiooutput::activate ( )

Initialises a plug-in instance and activates it for use.

This LADSPA member function initialises a plug-in instance and activates it for use. This is separated from instantiate() to aid real-time support and so that hosts can reinitialise a plug-in instance by calling deactivate() and then activate(). In this case the plug-in instance must reset all state information dependent on the history of the plug-in instance except for any data locations provided by connect_port() and any gain set by set_run_adding_gain().

Zyn Implementation

Currently this does nothing; Care must be taken as to code placed here as too much code here seems to cause time-out problems in jack-dssi-host.

◆ cleanup()

void DSSIaudiooutput::cleanup ( )

Deletes a plug-in instance that is no longer required.

LADSPA member function; once an instance of a plug-in has been finished with it can be deleted using this function. The instance handle ceases to be valid after this call.

If activate() was called for a plug-in instance then a corresponding call to deactivate() must be made before cleanup() is called.

Zyn Implementation

Currently cleanup is deferred to the destructor that is invoked after cleanup()

◆ connectPort()

void DSSIaudiooutput::connectPort ( unsigned long port,
LADSPA_Data * data )

Connects a port on an instantiated plug-in.

This LADSPA member function connects a port on an instantiated plug-in to a memory location at which a block of data for the port will be read/written. The data location is expected to be an array of LADSPA_Data for audio ports or a single LADSPA_Data value for control ports. Memory issues will be managed by the host. The plug-in must read/write the data at these locations every time run() or run_adding() is called and the data present at the time of this connection call should not be considered meaningful.

Zyn Implementation

The buffer pointers are stored as member variables

Parameters
port[in] the port to be connected
data[in] the data buffer to write to / read from

◆ deactivate()

void DSSIaudiooutput::deactivate ( )

Counterpart to activate().

This LADSPA member function is the counterpart to activate() (see above). Deactivation is not similar to pausing as the plug-in instance will be reinitialised when activate() is called to reuse it.

Zyn Implementation

Currently this function does nothing.

◆ getDssiDescriptor()

const DSSI_Descriptor * DSSIaudiooutput::getDssiDescriptor ( unsigned long index)
static

Initial entry point for the DSSI plug-in library.

This DSSI function is the initial entry point for the plug-in library. The DSSI host looks for this entry point in each shared library object it finds and then calls the function to enumerate the plug-ins within the library.

Zyn Implementation

The descriptor is created statically by DSSIaudiooutput::initDssiDescriptor() when the plug-in library is loaded. This function merely returns a pointer to that descriptor.

Parameters
index[in] the index number of the plug-in within the library.
Returns
if index is in range, a pointer to the plug-in descriptor is returned, else NULL

◆ getInstance()

DSSIaudiooutput * DSSIaudiooutput::getInstance ( LADSPA_Handle instance)
staticprivate

Converts a LADSPA / DSSI handle into a DSSIaudiooutput instance.

Parameters
instance[in]
Returns
the instance

◆ getLadspaDescriptor()

const LADSPA_Descriptor * DSSIaudiooutput::getLadspaDescriptor ( unsigned long index)
static

Initial entry point for the LADSPA plug-in library.

This LADSPA function is the initial entry point for the plug-in library. The LADSPA host looks for this entry point in each shared library object it finds and then calls the function to enumerate the plug-ins within the library.

Zyn Implementation

As the Zyn plug-in is a DSSI plug-in, the LADSPA descriptor is embedded inside the DSSI descriptor, which is created by DSSIaudiooutput::initDssiDescriptor() statically when the library is loaded. This function then merely returns a pointer to that embedded descriptor.

Parameters
index[in] the index number of the plug-in within the library.
Returns
if index is in range, a pointer to the plug-in descriptor is returned, else NULL

◆ getMidiControllerForPort()

int DSSIaudiooutput::getMidiControllerForPort ( unsigned long port)

Returns the MIDI controller number or NRPN for a input control port

This DSSI member function returns the MIDI controller number or NRPN that should be mapped to the given input control port. If the given port should not have any MIDI controller mapped to it, the function will return DSSI_NONE. The behaviour of this function is undefined if the given port number does not correspond to an input control port.

Zyn Implementation

Currently Zyn does not define any controller ports, but may do in the future.

Parameters
port[in] the input controller port
Returns
the CC and NRPN values shifted and ORed together.

◆ getProgram()

const DSSI_Program_Descriptor * DSSIaudiooutput::getProgram ( unsigned long index)

Provides a description of a program available on this synth.

This DSSI member function pointer provides a description of a program (named preset sound) available on this synth.

Zyn Implementation

The instruments in all Zyn's bank directories, as shown by the instrument -> show instrument bank command, are enumerated to the host by this function, allowing access to all those instruments. The first time an instrument is requested, the bank it is in and any unmapped ones preceding that are mapped; all the instruments names and filenames from those banks are stored in the programMap member variable for later use. This is done on demand in this way, rather than up front in one go because loading all the instrument names in one go can lead to timeouts and zombies.

Parameters
index[in] index into the plug-in's list of programs, not a program number as represented by the Program field of the DSSI_Program_Descriptor. (This distinction is needed to support synths that use non-contiguous program or bank numbers.)
Returns
a DSSI_Program_Descriptor pointer that is guaranteed to be valid only until the next call to get_program, deactivate, or configure, on the same plug-in instance, or NULL if index is out of range.

◆ initBanks()

void DSSIaudiooutput::initBanks ( void )
private

Ensures the list of bank (directories) has been initialised.

◆ initDssiDescriptor()

DSSI_Descriptor * DSSIaudiooutput::initDssiDescriptor ( )
staticprivate

Initializes the DSSI (and LADSPA) descriptor, returning it is an object.

◆ instantiate()

LADSPA_Handle DSSIaudiooutput::instantiate ( const LADSPA_Descriptor * descriptor,
unsigned long s_rate )
static

Instantiates a plug-in.

This LADSPA member function instantiates a plug-in. Note that instance initialisation should generally occur in activate() rather than here.

Zyn Implementation

This implementation creates a C++ class object and hides its pointer in the handle by type casting.

Parameters
descriptor[in] the descriptor for this plug-in
s_rate[in] the sample rate
Returns
the plug-in instance handle if successful else NULL

◆ mapNextBank()

bool DSSIaudiooutput::mapNextBank ( )
private

Queries and maps the next available bank of instruments.

If the program index requested to getProgram() lies beyond the banks mapped to date, this member function is called to map the next one.

Returns
true if a new bank has been found and mapped, else false.

◆ run()

void DSSIaudiooutput::run ( unsigned long sample_count)

Runs an instance of a plug-in for a block.

This LADSPA member function runs an instance of a plug-in for a block. Note that if an activate() function exists then it must be called before run() or run_adding(). If deactivate() is called for a plug-in instance then the plug-in instance may not be reused until activate() has been called again.

Zyn Implementation

This is a LADSPA function that does not process any MIDI events; it is hence implemented by simply calling runSynth() with an empty event list.

Parameters
sample_count[in] the block size (in samples) for which the plug-in instance may run

◆ runSynth()

void DSSIaudiooutput::runSynth ( unsigned long sample_count,
snd_seq_event_t * events,
unsigned long event_count )

Runs the synth for a block.

This DSSI member function runs the synth for a block. This is identical in function to the LADSPA run() function, except that it also supplies events to the synth.

Zyn Implementation

Zyn implements synthesis in Master::GetAudioOutSamples; runSynth calls this function in chunks delimited by the sample_count and the frame indexes in the events block, calling the appropriate NoteOn, NoteOff and SetController members of Master to process the events supplied between each chunk.

Parameters
sample_count[in] the block size (in samples) for which the synth instance may run.
Events[in] The Events pointer points to a block of ALSA sequencer events, used to communicate MIDI and related events to the synth. Each event must be timestamped relative to the start of the block, (mis)using the ALSA "tick time" field as a frame count. The host is responsible for ensuring that events with differing timestamps are already ordered by time. Must not include NOTE (only NOTE_ON / NOTE_OFF), LSB or MSB events.
event_count[in] the number of entries in the Events block

◆ selectProgram()

void DSSIaudiooutput::selectProgram ( unsigned long bank,
unsigned long program )

Selects a new program for this synth.

This DSSI member function selects a new program for this synth. The program change will take effect immediately at the start of the next run_synth() call. An invalid bank / instrument combination is ignored.

Zyn Implementation

the banks and instruments are as shown in the instrument -> show instrument bank command in Zyn. The bank no is a 1-based index into the list of banks Zyn loads and shows in the drop down and the program number is the instrument within that bank.

Parameters
bank[in] the bank number to select
program[in] the program number within the bank to select

◆ stub_activate()

void DSSIaudiooutput::stub_activate ( LADSPA_Handle instance)
static

◆ stub_cleanup()

void DSSIaudiooutput::stub_cleanup ( LADSPA_Handle instance)
static

◆ stub_connectPort()

void DSSIaudiooutput::stub_connectPort ( LADSPA_Handle instance,
unsigned long port,
LADSPA_Data * data )
static

◆ stub_deactivate()

void DSSIaudiooutput::stub_deactivate ( LADSPA_Handle Instance)
static

◆ stub_getMidiControllerForPort()

int DSSIaudiooutput::stub_getMidiControllerForPort ( LADSPA_Handle instance,
unsigned long port )
static

◆ stub_getProgram()

const DSSI_Program_Descriptor * DSSIaudiooutput::stub_getProgram ( LADSPA_Handle instance,
unsigned long Index )
static

◆ stub_run()

void DSSIaudiooutput::stub_run ( LADSPA_Handle instance,
unsigned long sample_count )
static

◆ stub_runSynth()

void DSSIaudiooutput::stub_runSynth ( LADSPA_Handle instance,
unsigned long sample_count,
snd_seq_event_t * events,
unsigned long event_count )
static

◆ stub_selectProgram()

void DSSIaudiooutput::stub_selectProgram ( LADSPA_Handle instance,
unsigned long bank,
unsigned long program )
static

Member Data Documentation

◆ bankDirNames

std::string DSSIaudiooutput::bankDirNames[]
staticprivate

◆ bankNoToMap

long DSSIaudiooutput::bankNoToMap = 1
staticprivate

Index controlling the map of banks

◆ banksInited

bool DSSIaudiooutput::banksInited
private

Flag controlling the list of bank directories

◆ dssiDescriptor

DSSI_Descriptor * DSSIaudiooutput::dssiDescriptor
staticprivate
Initial value:
=
static DSSI_Descriptor * initDssiDescriptor()
Definition DSSIaudiooutput.cpp:533

◆ master

Master* DSSIaudiooutput::master
private

◆ outl

LADSPA_Data* DSSIaudiooutput::outl
private

◆ outr

LADSPA_Data* DSSIaudiooutput::outr
private

◆ programMap

vector< DSSIaudiooutput::ProgramDescriptor > DSSIaudiooutput::programMap
staticprivate
Initial value:

The map of programs available; held as a single shared statically allocated object.

◆ sampleRate

long DSSIaudiooutput::sampleRate
private

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