#include <Sampler.h>
Classes | |
class | EventHandler |
Public Member Functions | |
Sampler () | |
Constructor. | |
virtual | ~Sampler () |
Destructor. | |
uint | SamplerChannels () |
Returns the number of sampler channels currently allocated. | |
SamplerChannel * | AddSamplerChannel () |
Create and add a new sampler channel to this Sampler instance. | |
SamplerChannel * | GetSamplerChannel (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< String > | AvailableAudioOutputDrivers () |
Returns the names of all available audio output drivers. | |
std::vector< String > | AvailableMidiInputDrivers () |
Returns the names of all available MIDI input drivers. | |
std::vector< String > | AvailableEngineTypes () |
Returns the names of all available sampler engine types. | |
AudioOutputDevice * | CreateAudioOutputDevice (String AudioDriver, std::map< String, String > Parameters) throw (Exception) |
Create an audio output device. | |
MidiInputDevice * | CreateMidiInputDevice (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 |
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.
typedef std::map<uint, SamplerChannel*> LinuxSampler::Sampler::SamplerChannelMap [protected] |
LinuxSampler::Sampler::Sampler | ( | ) |
Constructor.
Create a LinuxSampler instance.
virtual LinuxSampler::Sampler::~Sampler | ( | ) | [virtual] |
Destructor.
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).
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 | ( | ) |
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.
AudioDriver | - name of the audio driver | |
Parameters | - eventually needed driver parameters to create the device |
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.
MidiDriver | - name of the midi driver | |
Parameters | - eventually needed driver parameters to create the device |
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.
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.
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.
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.
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.
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.
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.
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.
pChannel | The new sampler channel. |
void LinuxSampler::Sampler::fireChannelCountChanged | ( | int | NewCount | ) | [protected] |
Notifies listeners that the number of sampler channels has been changed.
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.
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.
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.
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.
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.
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.
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.
NewCount | The new number of total streams. |
void LinuxSampler::Sampler::fireTotalVoiceCountChanged | ( | int | NewCount | ) |
Notifies listeners that the total number of active voices is changed.
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.
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.
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.
std::map<uint, SamplerChannel*> LinuxSampler::Sampler::GetSamplerChannels | ( | ) |
Returns all created sampler channels.
int LinuxSampler::Sampler::GetVoiceCount | ( | ) |
Gets 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.
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.
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.
friend class SamplerChannel [friend] |
std::map<uint, uint> LinuxSampler::Sampler::mOldStreamCounts [protected] |
std::map<uint, uint> LinuxSampler::Sampler::mOldVoiceCounts [protected] |
uint LinuxSampler::Sampler::uiOldTotalStreamCount [protected] |
uint LinuxSampler::Sampler::uiOldTotalVoiceCount [protected] |