LinuxSampler::Sampler Class Reference

LinuxSampler main class. More...

#include <Sampler.h>

List of all members.

Classes

class  EventHandler

Public Member Functions

 Sampler ()
 Constructor.
virtual ~Sampler ()
 Destructor.
uint SamplerChannels ()
 Returns the number of sampler channels currently allocated.
SamplerChannelAddSamplerChannel ()
 Create and add a new sampler channel to this Sampler instance.
SamplerChannelGetSamplerChannel (uint uiSamplerChannel)
 Returns the sampler channel of the given sampler channel index.
std::map< uint, SamplerChannel * > GetSamplerChannels ()
 Returns all created sampler channels.
void RemoveSamplerChannel (SamplerChannel *pSamplerChannel)
 Destroy and remove the given sampler channel from this Sampler instance.
void RemoveSamplerChannel (uint uiSamplerChannel)
 Destroy and remove the given sampler channel from this Sampler instance.
void RemoveAllSamplerChannels ()
 Destroy and remove all sampler channels from this Sampler instance.
std::vector< StringAvailableAudioOutputDrivers ()
 Returns the names of all available audio output drivers.
std::vector< StringAvailableMidiInputDrivers ()
 Returns the names of all available MIDI input drivers.
std::vector< StringAvailableEngineTypes ()
 Returns the names of all available sampler engine types.
AudioOutputDeviceCreateAudioOutputDevice (String AudioDriver, std::map< String, String > Parameters) throw (Exception)
 Create an audio output device.
MidiInputDeviceCreateMidiInputDevice (String MidiDriver, std::map< String, String > Parameters) throw (Exception)
 Create a midi input device.
uint AudioOutputDevices ()
 Returns the number of all created audio output devices.
uint MidiInputDevices ()
 Returns the number of all created MIDI input devices.
std::map< uint,
AudioOutputDevice * > 
GetAudioOutputDevices ()
 Returns all created audio output devices.
std::map< uint, MidiInputDevice * > GetMidiInputDevices ()
 Returns all created MIDI input devices.
void DestroyAudioOutputDevice (AudioOutputDevice *pDevice) throw (Exception)
 Destroy the given audio output device and takes care if there are still sampler engines connected to this device, etc.
void DestroyAllAudioOutputDevices () throw (Exception)
 Destroy all audio output devices and takes care if there are still sampler engines connected to devices, etc.
void DestroyMidiInputDevice (MidiInputDevice *pDevice) throw (Exception)
 Destroy the given MIDI input device and takes care if there are still sampler engines connected to this device, etc.
void DestroyAllMidiInputDevices () throw (Exception)
 Destroy all MIDI input devices and take care if there are still sampler engines connected to device, etc.
int GetDiskStreamCount ()
 Gets the current number of all active streams.
int GetVoiceCount ()
 Gets the current number of all active voices.
void Reset ()
 Reset the whole sampler.
void AddChannelCountListener (ChannelCountListener *l)
 Registers the specified listener to be notified when the number of sampler chanels is changed.
void RemoveChannelCountListener (ChannelCountListener *l)
 Removes the specified listener.
void AddAudioDeviceCountListener (AudioDeviceCountListener *l)
 Registers the specified listener to be notified when the number of audio output devices is changed.
void RemoveAudioDeviceCountListener (AudioDeviceCountListener *l)
 Removes the specified listener.
void AddMidiDeviceCountListener (MidiDeviceCountListener *l)
 Registers the specified listener to be notified when the number of MIDI input devices is changed.
void RemoveMidiDeviceCountListener (MidiDeviceCountListener *l)
 Removes the specified listener.
void AddVoiceCountListener (VoiceCountListener *l)
 Registers the specified listener to be notified when the number of active voices in a particular sampler channel is changed.
void RemoveVoiceCountListener (VoiceCountListener *l)
 Removes the specified listener.
void fireVoiceCountChanged (int ChannelId, int NewCount)
 Notifies listeners that the number of active voices on the specified sampler channel is changed.
void AddStreamCountListener (StreamCountListener *l)
 Registers the specified listener to be notified when the number of active disk streams in a particular sampler channel is changed.
void RemoveStreamCountListener (StreamCountListener *l)
 Removes the specified listener.
void fireStreamCountChanged (int ChannelId, int NewCount)
 Notifies listeners that the number of active disk streams on the specified sampler channel is changed.
void AddBufferFillListener (BufferFillListener *l)
 Registers the specified listener to be notified when the fill state of the disk stream buffers on a specific sampler channel is changed.
void RemoveBufferFillListener (BufferFillListener *l)
 Removes the specified listener.
void fireBufferFillChanged (int ChannelId, String FillData)
 Notifies listeners that the fill state of the disk stream buffers on the specified sampler channel is changed.
void AddTotalVoiceCountListener (TotalVoiceCountListener *l)
 Registers the specified listener to be notified when total number of active voices is changed.
void RemoveTotalVoiceCountListener (TotalVoiceCountListener *l)
 Removes the specified listener.
void fireTotalVoiceCountChanged (int NewCount)
 Notifies listeners that the total number of active voices is changed.
void AddTotalStreamCountListener (TotalStreamCountListener *l)
 Registers the specified listener to be notified when the number of total streams is changed.
void RemoveTotalStreamCountListener (TotalStreamCountListener *l)
 Removes the specified listener.
void fireTotalStreamCountChanged (int NewCount)
 Notifies listeners that the total number of total streams changed.
void AddFxSendCountListener (FxSendCountListener *l)
 Registers the specified listener to be notified when the number of effect sends on a particular sampler channel is changed.
void RemoveFxSendCountListener (FxSendCountListener *l)
 Removes the specified listener.
void fireStatistics ()
 Notifies listeners about the current number of voices, streams and total voices, and the current fill state of the disk stream buffers.

Static Public Member Functions

static bool EnableDenormalsAreZeroMode ()
 Advise the FPU to treat denormal floating point numbers as zero, to avoid severe performance penalty when dealing with such extreme floating point values.

Protected Types

typedef std::map< uint,
SamplerChannel * > 
SamplerChannelMap

Protected Member Functions

void fireChannelCountChanged (int NewCount)
 Notifies listeners that the number of sampler channels has been changed.
void fireChannelAdded (SamplerChannel *pChannel)
 Notifies listeners that the specified sampler channel has just been added.
void fireChannelToBeRemoved (SamplerChannel *pChannel)
 Notifies listeners that the specified sampler channel is going to be removed soon.
void fireAudioDeviceCountChanged (int NewCount)
 Notifies listeners that the number of audio output devices has been changed.
void fireMidiDeviceCountChanged (int NewCount)
 Notifies listeners that the number of MIDI input devices has been changed.
void fireMidiDeviceToBeDestroyed (MidiInputDevice *pDevice)
 Notifies listeners that the supplied MIDI input device is going to be destroyed soon.
void fireMidiDeviceCreated (MidiInputDevice *pDevice)
 Notifies listeners that the supplied MIDI input device was just created.
void fireFxSendCountChanged (int ChannelId, int NewCount)
 Notifies listeners that the number of effect sends on a particular sampler channel is changed.

Protected Attributes

SamplerChannelMap mSamplerChannels
 contains all created sampler channels
uint uiOldTotalVoiceCount
uint uiOldTotalStreamCount
std::map< uint, uint > mOldVoiceCounts
std::map< uint, uint > mOldStreamCounts

Friends

class SamplerChannel


Detailed Description

LinuxSampler main class.

This is the toplevel class for a LinuxSampler instance.

LinuxSampler can have arbitrary numbers of sampler channels. Each sampler channel can individually be deployed with it's own sampler engine, connected to an arbitrary MIDI input device and connected to an arbitrary audio output device. Here an example setup:

 S.Channel    MIDI in    S.Engine         Audio out
 -------------------------------------------------------------------
   0          Alsa   ->  gig::Engine  ->  Jack
   1          VSTi   ->  Akai::Engine ->  VSTi
   2          Jack   ->  DLS::Engine  ->  Jack
   3          Jack   ->  SF::Engine   ->  Alsa

 ... (and so on) ...

Note that not all audio and MIDI backends and sampler engines listed in the example above might already been implemented!

As you can see in the example setup, LinuxSampler is capable to use several, different audio output and MIDI input systems simultaniously at the same time. Here the example setup shown in the aspect of MIDI input and audio output devices / drivers:

                      ######################### #########################
                      # AudioOutputDeviceJack # # AudioOutputDeviceVSTi #
                      ######################### #########################
                                        ^   ^           ^
  /------------>|Sampler Channel 0|-----/   |           |
  |  /--------->|Sampler Channel 1|---------------------/
  |  |  /------>|Sampler Channel 2|---------/
  |  |  |  /--->|Sampler Channel 3|------------>#########################
  |  |  |  |    ... (and so on) ...             # AudioOutputDeviceAlsa #
  |  |  |  |                                    #########################
  |  |  |  \-----------------------------------------------------\
  |  |  \--------------------------------------------\           |
  |  \--------------------\                          |           |
  |                       |                          |           |
 ####################### ####################### #######################
 # MidiInputDeviceAlsa # # MidiInputDeviceVSTi # # MidiInputDeviceJack #
 ####################### ####################### #######################

As you can see in this example setup, one device (that is midi input driver / audio output driver) can be connected multiple times to different sampler channels.

It's even possible to create multiple instances of the same driver, for example multiple instances of the Alsa output driver to use multiple sound cards at the same time, or multiple instances of the JACK audio output driver to leverage SMP systems or boxes with several hard discs.

Definition at line 281 of file Sampler.h.


Member Typedef Documentation

typedef std::map<uint, SamplerChannel*> LinuxSampler::Sampler::SamplerChannelMap [protected]

Definition at line 686 of file Sampler.h.


Constructor & Destructor Documentation

LinuxSampler::Sampler::Sampler (  ) 

Constructor.

Create a LinuxSampler instance.

virtual LinuxSampler::Sampler::~Sampler (  )  [virtual]

Destructor.


Member Function Documentation

void LinuxSampler::Sampler::AddAudioDeviceCountListener ( AudioDeviceCountListener l  ) 

Registers the specified listener to be notified when the number of audio output devices is changed.

void LinuxSampler::Sampler::AddBufferFillListener ( BufferFillListener l  ) 

Registers the specified listener to be notified when the fill state of the disk stream buffers on a specific sampler channel is changed.

void LinuxSampler::Sampler::AddChannelCountListener ( ChannelCountListener l  ) 

Registers the specified listener to be notified when the number of sampler chanels is changed.

void LinuxSampler::Sampler::AddFxSendCountListener ( FxSendCountListener l  ) 

Registers the specified listener to be notified when the number of effect sends on a particular sampler channel is changed.

void LinuxSampler::Sampler::AddMidiDeviceCountListener ( MidiDeviceCountListener l  ) 

Registers the specified listener to be notified when the number of MIDI input devices is changed.

SamplerChannel* LinuxSampler::Sampler::AddSamplerChannel (  ) 

Create and add a new sampler channel to this Sampler instance.

For race condition reasons the new channel will use an index past the last already existing sampler channel index (in case the index limit was not reached yet, otherwise a free index starting from 0 is searched).

Returns:
pointer to new sampler channel

void LinuxSampler::Sampler::AddStreamCountListener ( StreamCountListener l  ) 

Registers the specified listener to be notified when the number of active disk streams in a particular sampler channel is changed.

void LinuxSampler::Sampler::AddTotalStreamCountListener ( TotalStreamCountListener l  ) 

Registers the specified listener to be notified when the number of total streams is changed.

void LinuxSampler::Sampler::AddTotalVoiceCountListener ( TotalVoiceCountListener l  ) 

Registers the specified listener to be notified when total number of active voices is changed.

void LinuxSampler::Sampler::AddVoiceCountListener ( VoiceCountListener l  ) 

Registers the specified listener to be notified when the number of active voices in a particular sampler channel is changed.

uint LinuxSampler::Sampler::AudioOutputDevices (  ) 

Returns the number of all created audio output devices.

std::vector<String> LinuxSampler::Sampler::AvailableAudioOutputDrivers (  ) 

Returns the names of all available audio output drivers.

std::vector<String> LinuxSampler::Sampler::AvailableEngineTypes (  ) 

Returns the names of all available sampler engine types.

See also:
SamplerChannel::SetEngineType()

std::vector<String> LinuxSampler::Sampler::AvailableMidiInputDrivers (  ) 

Returns the names of all available MIDI input drivers.

AudioOutputDevice* LinuxSampler::Sampler::CreateAudioOutputDevice ( String  AudioDriver,
std::map< String, String Parameters 
) throw (Exception)

Create an audio output device.

Parameters:
AudioDriver - name of the audio driver
Parameters - eventually needed driver parameters to create the device
Returns:
pointer to created audio output device
Exceptions:
Exception if device could not be created

MidiInputDevice* LinuxSampler::Sampler::CreateMidiInputDevice ( String  MidiDriver,
std::map< String, String Parameters 
) throw (Exception)

Create a midi input device.

Parameters:
MidiDriver - name of the midi driver
Parameters - eventually needed driver parameters to create the device
Returns:
pointer to created midi input device
Exceptions:
Exception if device could not be created

void LinuxSampler::Sampler::DestroyAllAudioOutputDevices (  )  throw (Exception)

Destroy all audio output devices and takes care if there are still sampler engines connected to devices, etc.

Note: non-autonomous devices, that is devices associated with host plugin instances like VST, AU, DSSI, LV2 are not destroyed by this method.

Exceptions:
Exception if sampler channels are still connected to device

void LinuxSampler::Sampler::DestroyAllMidiInputDevices (  )  throw (Exception)

Destroy all MIDI input devices and take care if there are still sampler engines connected to device, etc.

Note: non-autonomous devices, that is devices associated with host plugin instances like VST, AU, DSSI, LV2 are not destroyed by this method.

Exceptions:
Exception if sampler channels are still connected to device

void LinuxSampler::Sampler::DestroyAudioOutputDevice ( AudioOutputDevice pDevice  )  throw (Exception)

Destroy the given audio output device and takes care if there are still sampler engines connected to this device, etc.

Exceptions:
Exception if sampler channels are still connected to the device

void LinuxSampler::Sampler::DestroyMidiInputDevice ( MidiInputDevice pDevice  )  throw (Exception)

Destroy the given MIDI input device and takes care if there are still sampler engines connected to this device, etc.

Exceptions:
Exception if sampler channels are still connected to the device

static bool LinuxSampler::Sampler::EnableDenormalsAreZeroMode (  )  [static]

Advise the FPU to treat denormal floating point numbers as zero, to avoid severe performance penalty when dealing with such extreme floating point values.

Returns:
true if FPU supports it, false otherwise

void LinuxSampler::Sampler::fireAudioDeviceCountChanged ( int  NewCount  )  [protected]

Notifies listeners that the number of audio output devices has been changed.

Parameters:
NewCount The new number of audio output devices.

void LinuxSampler::Sampler::fireBufferFillChanged ( int  ChannelId,
String  FillData 
)

Notifies listeners that the fill state of the disk stream buffers on the specified sampler channel is changed.

Parameters:
ChannelId The numerical ID of the sampler channel.
FillData The buffer fill data for the specified sampler channel.

void LinuxSampler::Sampler::fireChannelAdded ( SamplerChannel pChannel  )  [protected]

Notifies listeners that the specified sampler channel has just been added.

Parameters:
pChannel The new sampler channel.

void LinuxSampler::Sampler::fireChannelCountChanged ( int  NewCount  )  [protected]

Notifies listeners that the number of sampler channels has been changed.

Parameters:
NewCount The new number of sampler channels.

void LinuxSampler::Sampler::fireChannelToBeRemoved ( SamplerChannel pChannel  )  [protected]

Notifies listeners that the specified sampler channel is going to be removed soon.

Parameters:
pChannel sampler channel to be removed.

void LinuxSampler::Sampler::fireFxSendCountChanged ( int  ChannelId,
int  NewCount 
) [protected]

Notifies listeners that the number of effect sends on a particular sampler channel is changed.

Parameters:
ChannelId The numerical ID of the sampler channel.
NewCount The new number of sampler channels.

void LinuxSampler::Sampler::fireMidiDeviceCountChanged ( int  NewCount  )  [protected]

Notifies listeners that the number of MIDI input devices has been changed.

Parameters:
NewCount The new number of MIDI input devices.

void LinuxSampler::Sampler::fireMidiDeviceCreated ( MidiInputDevice pDevice  )  [protected]

Notifies listeners that the supplied MIDI input device was just created.

Parameters:
pDevice new MIDI input device

void LinuxSampler::Sampler::fireMidiDeviceToBeDestroyed ( MidiInputDevice pDevice  )  [protected]

Notifies listeners that the supplied MIDI input device is going to be destroyed soon.

Parameters:
pDevice MIDI input device to be destroyed

void LinuxSampler::Sampler::fireStatistics (  ) 

Notifies listeners about the current number of voices, streams and total voices, and the current fill state of the disk stream buffers.

void LinuxSampler::Sampler::fireStreamCountChanged ( int  ChannelId,
int  NewCount 
)

Notifies listeners that the number of active disk streams on the specified sampler channel is changed.

Parameters:
ChannelId The numerical ID of the sampler channel.
NewCount The new number of active disk streams.

void LinuxSampler::Sampler::fireTotalStreamCountChanged ( int  NewCount  ) 

Notifies listeners that the total number of total streams changed.

Parameters:
NewCount The new number of total streams.

void LinuxSampler::Sampler::fireTotalVoiceCountChanged ( int  NewCount  ) 

Notifies listeners that the total number of active voices is changed.

Parameters:
NewCount The new number of active voices.

void LinuxSampler::Sampler::fireVoiceCountChanged ( int  ChannelId,
int  NewCount 
)

Notifies listeners that the number of active voices on the specified sampler channel is changed.

Parameters:
ChannelId The numerical ID of the sampler channel.
NewCount The new number of active voices.

std::map<uint, AudioOutputDevice*> LinuxSampler::Sampler::GetAudioOutputDevices (  ) 

Returns all created audio output devices.

int LinuxSampler::Sampler::GetDiskStreamCount (  ) 

Gets the current number of all active streams.

Returns:
The current number of all active streams.

std::map<uint, MidiInputDevice*> LinuxSampler::Sampler::GetMidiInputDevices (  ) 

Returns all created MIDI input devices.

SamplerChannel* LinuxSampler::Sampler::GetSamplerChannel ( uint  uiSamplerChannel  ) 

Returns the sampler channel of the given sampler channel index.

Returns:
pointer to sought sampler channel

std::map<uint, SamplerChannel*> LinuxSampler::Sampler::GetSamplerChannels (  ) 

Returns all created sampler channels.

int LinuxSampler::Sampler::GetVoiceCount (  ) 

Gets the current number of all active voices.

Returns:
The current number of all active voices.

uint LinuxSampler::Sampler::MidiInputDevices (  ) 

Returns the number of all created MIDI input devices.

void LinuxSampler::Sampler::RemoveAllSamplerChannels (  ) 

Destroy and remove all sampler channels from this Sampler instance.

void LinuxSampler::Sampler::RemoveAudioDeviceCountListener ( AudioDeviceCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveBufferFillListener ( BufferFillListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveChannelCountListener ( ChannelCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveFxSendCountListener ( FxSendCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveMidiDeviceCountListener ( MidiDeviceCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveSamplerChannel ( uint  uiSamplerChannel  ) 

Destroy and remove the given sampler channel from this Sampler instance.

Parameters:
uiSamplerChannel - index of the sampler channel to remove

void LinuxSampler::Sampler::RemoveSamplerChannel ( SamplerChannel pSamplerChannel  ) 

Destroy and remove the given sampler channel from this Sampler instance.

Parameters:
pSamplerChannel - pointer to sampler channel to remove

void LinuxSampler::Sampler::RemoveStreamCountListener ( StreamCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveTotalStreamCountListener ( TotalStreamCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveTotalVoiceCountListener ( TotalVoiceCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::RemoveVoiceCountListener ( VoiceCountListener l  ) 

Removes the specified listener.

void LinuxSampler::Sampler::Reset (  ) 

Reset the whole sampler.

Destroy all engines, sampler channels, MIDI input devices and audio output devices.

uint LinuxSampler::Sampler::SamplerChannels (  ) 

Returns the number of sampler channels currently allocated.


Friends And Related Function Documentation

friend class SamplerChannel [friend]

Definition at line 696 of file Sampler.h.


Member Data Documentation

std::map<uint, uint> LinuxSampler::Sampler::mOldStreamCounts [protected]

Definition at line 694 of file Sampler.h.

std::map<uint, uint> LinuxSampler::Sampler::mOldVoiceCounts [protected]

Definition at line 693 of file Sampler.h.

contains all created sampler channels

Definition at line 688 of file Sampler.h.

Definition at line 692 of file Sampler.h.

Definition at line 691 of file Sampler.h.


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

doxygen