MuseScore  3.4
Music composition and notation
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | Static Private Attributes | Friends | List of all members
FluidS::Fluid Class Reference

#include <fluid.h>

Inheritance diagram for FluidS::Fluid:
Inheritance graph
[legend]
Collaboration diagram for FluidS::Fluid:
Collaboration graph
[legend]

Public Member Functions

 Fluid ()
 
 ~Fluid ()
 
virtual void init (float sampleRate)
 
virtual const char * name () const
 
virtual void play (const PlayEvent &)
 
virtual const QList< MidiPatch * > & getPatchInfo () const
 
virtual SynthesizerGroup state () const
 
virtual bool setState (const SynthesizerGroup &)
 
virtual void allSoundsOff (int)
 
virtual void allNotesOff (int)
 
int loadProgress ()
 
void setLoadProgress (int val)
 
bool loadWasCanceled ()
 
void setLoadWasCanceled (bool status)
 
Presetget_preset (unsigned int sfontnum, unsigned int banknum, unsigned int prognum)
 
Presetfind_preset (unsigned int banknum, unsigned int prognum)
 
void modulate_voices (int chan, bool is_cc, int ctrl)
 
void modulate_voices_all (int chan)
 
void damp_voices (int chan)
 
int kill_voice (Voice *voice)
 
void print_voice ()
 
void update_presets ()
 This function assures that every MIDI channels has a valid preset (NULL is okay). More...
 
int get_cc (int chan, int num) const
 
void system_reset ()
 
void program_change (int chan, int prognum)
 
void set_gen2 (int chan, int param, float value, int absolute, int normalized)
 Change the value of a generator. More...
 
float get_gen (int chan, int param)
 
void set_gen (int chan, int param, float value)
 
void set_interp_method (int chan, int interp_method)
 
Presetget_channel_preset (int chan) const
 
virtual bool loadSoundFonts (const QStringList &s)
 
virtual bool addSoundFont (const QString &s)
 
virtual bool removeSoundFont (const QString &s)
 
QStringList soundFonts () const
 
std::vector< SoundFontInfosoundFontsInfo () const override
 
void start_voice (Voice *voice)
 
Voicealloc_voice (unsigned id, Sample *sample, int chan, int key, int vel, double vt)
 
void free_voice_by_kill ()
 
virtual void process (unsigned len, float *out, float *effect1, float *effect2)
 
bool program_select (int chan, unsigned sfont_id, unsigned bank_num, unsigned preset_num)
 
void get_program (int chan, unsigned *sfont_id, unsigned *bank_num, unsigned *preset_num)
 
void get_pitch_wheel_sens (int chan, int *pval)
 
void pitch_wheel_sens (int chan, int val)
 
void get_pitch_bend (int chan, int *ppitch_bend)
 
void freeVoice (Voice *v)
 
double getPitch (int k) const
 
float ct2hz_real (float cents)
 
float act2hz (float c)
 
float ct2hz (float cents)
 
virtual double masterTuning () const
 
virtual void setMasterTuning (double f)
 
QString error () const
 
virtual SynthesizerGuigui ()
 
bool globalTerminate ()
 
void setGlobalTerminate (bool terminate=true)
 
- Public Member Functions inherited from Ms::Synthesizer
 Synthesizer ()
 
virtual ~Synthesizer ()
 
float sampleRate () const
 
virtual void setValue (int, double)
 
virtual double value (int) const
 
void reset ()
 
bool active () const
 
void setActive (bool val=true)
 

Static Public Member Functions

static QFileInfoList sfFiles ()
 

Protected Member Functions

SFontget_sfont_by_name (const QString &name)
 
SFontget_sfont_by_id (int id)
 
SFontget_sfont (int idx) const
 
bool sfunload (int id)
 
int sfload (const QString &filename)
 

Protected Attributes

int _state
 
unsigned int sfont_id
 
QList< Channel * > channel
 
unsigned int noteid
 
- Protected Attributes inherited from Ms::Synthesizer
float _sampleRate
 
SynthesizerGui_gui
 

Private Member Functions

void updatePatchList ()
 

Private Attributes

QList< SFont * > sfonts
 
QList< MidiPatch * > patches
 
QList< Voice * > freeVoices
 
QList< Voice * > activeVoices
 
QString _error
 
double sample_rate
 
float _masterTuning
 
double _tuning [128]
 
int _loadProgress = 0
 
bool _loadWasCanceled = false
 
QMutex mutex
 
bool _globalTerminate = false
 

Static Private Attributes

static bool initialized = false
 

Friends

class Voice
 
class Preset
 

Constructor & Destructor Documentation

◆ Fluid()

FluidS::Fluid::Fluid ( )

◆ ~Fluid()

FluidS::Fluid::~Fluid ( )

Member Function Documentation

◆ act2hz()

float FluidS::Fluid::act2hz ( float  c)
inline

◆ addSoundFont()

bool FluidS::Fluid::addSoundFont ( const QString &  s)
virtual

Reimplemented from Ms::Synthesizer.

◆ allNotesOff()

void FluidS::Fluid::allNotesOff ( int  chan)
virtual

Reimplemented from Ms::Synthesizer.

◆ alloc_voice()

Voice * FluidS::Fluid::alloc_voice ( unsigned  id,
Sample sample,
int  chan,
int  key,
int  vel,
double  vt 
)

◆ allSoundsOff()

void FluidS::Fluid::allSoundsOff ( int  chan)
virtual

Reimplemented from Ms::Synthesizer.

◆ ct2hz()

float FluidS::Fluid::ct2hz ( float  cents)
inline

◆ ct2hz_real()

float FluidS::Fluid::ct2hz_real ( float  cents)
inline

◆ damp_voices()

void FluidS::Fluid::damp_voices ( int  chan)

◆ error()

QString FluidS::Fluid::error ( ) const
inline

◆ find_preset()

Preset * FluidS::Fluid::find_preset ( unsigned int  banknum,
unsigned int  prognum 
)

◆ free_voice_by_kill()

void FluidS::Fluid::free_voice_by_kill ( )

◆ freeVoice()

void FluidS::Fluid::freeVoice ( Voice v)

◆ get_cc()

int FluidS::Fluid::get_cc ( int  chan,
int  num 
) const
inline

◆ get_channel_preset()

Preset* FluidS::Fluid::get_channel_preset ( int  chan) const
inline

◆ get_gen()

float FluidS::Fluid::get_gen ( int  chan,
int  param 
)

◆ get_pitch_bend()

void FluidS::Fluid::get_pitch_bend ( int  chan,
int *  ppitch_bend 
)

◆ get_pitch_wheel_sens()

void FluidS::Fluid::get_pitch_wheel_sens ( int  chan,
int *  pval 
)

◆ get_preset()

Preset * FluidS::Fluid::get_preset ( unsigned int  sfontnum,
unsigned int  banknum,
unsigned int  prognum 
)

◆ get_program()

void FluidS::Fluid::get_program ( int  chan,
unsigned *  sfont_id,
unsigned *  bank_num,
unsigned *  preset_num 
)

◆ get_sfont()

SFont* FluidS::Fluid::get_sfont ( int  idx) const
inlineprotected

◆ get_sfont_by_id()

SFont * FluidS::Fluid::get_sfont_by_id ( int  id)
protected

◆ get_sfont_by_name()

SFont * FluidS::Fluid::get_sfont_by_name ( const QString &  name)
protected

◆ getPatchInfo()

virtual const QList<MidiPatch*>& FluidS::Fluid::getPatchInfo ( ) const
inlinevirtual

Implements Ms::Synthesizer.

◆ getPitch()

double FluidS::Fluid::getPitch ( int  k) const
inline

◆ globalTerminate()

bool FluidS::Fluid::globalTerminate ( )
inline

◆ gui()

SynthesizerGui * FluidS::Fluid::gui ( )
virtual

Reimplemented from Ms::Synthesizer.

◆ init()

void FluidS::Fluid::init ( float  sampleRate)
virtual

Reimplemented from Ms::Synthesizer.

◆ kill_voice()

int FluidS::Fluid::kill_voice ( Voice voice)

◆ loadProgress()

int FluidS::Fluid::loadProgress ( )
inline

◆ loadSoundFonts()

bool FluidS::Fluid::loadSoundFonts ( const QStringList &  s)
virtual

Implements Ms::Synthesizer.

◆ loadWasCanceled()

bool FluidS::Fluid::loadWasCanceled ( )
inline

◆ masterTuning()

virtual double FluidS::Fluid::masterTuning ( ) const
inlinevirtual

Reimplemented from Ms::Synthesizer.

◆ modulate_voices()

void FluidS::Fluid::modulate_voices ( int  chan,
bool  is_cc,
int  ctrl 
)

◆ modulate_voices_all()

void FluidS::Fluid::modulate_voices_all ( int  chan)

◆ name()

virtual const char* FluidS::Fluid::name ( ) const
inlinevirtual

Implements Ms::Synthesizer.

◆ pitch_wheel_sens()

void FluidS::Fluid::pitch_wheel_sens ( int  chan,
int  val 
)

◆ play()

void FluidS::Fluid::play ( const PlayEvent event)
virtual

Implements Ms::Synthesizer.

◆ print_voice()

void FluidS::Fluid::print_voice ( )

◆ process()

void FluidS::Fluid::process ( unsigned  len,
float *  out,
float *  effect1,
float *  effect2 
)
virtual

Implements Ms::Synthesizer.

◆ program_change()

void FluidS::Fluid::program_change ( int  chan,
int  prognum 
)

◆ program_select()

bool FluidS::Fluid::program_select ( int  chan,
unsigned  sfont_id,
unsigned  bank_num,
unsigned  preset_num 
)

◆ removeSoundFont()

bool FluidS::Fluid::removeSoundFont ( const QString &  s)
virtual

Reimplemented from Ms::Synthesizer.

◆ set_gen()

void FluidS::Fluid::set_gen ( int  chan,
int  param,
float  value 
)

◆ set_gen2()

void FluidS::Fluid::set_gen2 ( int  chan,
int  param,
float  value,
int  absolute,
int  normalized 
)

Change the value of a generator.

This function allows to control all synthesis parameters in real-time. The changes are additive, i.e. they add up to the existing parameter value. This function is similar to sending an NRPN message to the synthesizer. The function accepts a float as the value of the parameter. The parameter numbers and ranges are described in the SoundFont 2.01 specification, paragraph 8.1.3, page 48. See also 'fluid_gen_type'.

Using the fluid_synth_set_gen2() function, it is possible to set the absolute value of a generator. This is an extension to the SoundFont standard. If 'absolute' is non-zero, the value of the generator specified in the SoundFont is completely ignored and the generator is fixed to the value passed as argument. To undo this behavior, you must call fluid_synth_set_gen2 again, with 'absolute' set to 0 (and possibly 'value' set to zero).

If 'normalized' is non-zero, the value is supposed to be normalized between 0 and 1. Before applying the value, it will be scaled and shifted to the range defined in the SoundFont specifications.

◆ set_interp_method()

void FluidS::Fluid::set_interp_method ( int  chan,
int  interp_method 
)

◆ setGlobalTerminate()

void FluidS::Fluid::setGlobalTerminate ( bool  terminate = true)
inline

◆ setLoadProgress()

void FluidS::Fluid::setLoadProgress ( int  val)
inline

◆ setLoadWasCanceled()

void FluidS::Fluid::setLoadWasCanceled ( bool  status)
inline

◆ setMasterTuning()

virtual void FluidS::Fluid::setMasterTuning ( double  f)
inlinevirtual

Reimplemented from Ms::Synthesizer.

◆ setState()

bool FluidS::Fluid::setState ( const SynthesizerGroup sp)
virtual

Implements Ms::Synthesizer.

◆ sfFiles()

QFileInfoList FluidS::Fluid::sfFiles ( )
static

◆ sfload()

int FluidS::Fluid::sfload ( const QString &  filename)
protected

◆ sfunload()

bool FluidS::Fluid::sfunload ( int  id)
protected

◆ soundFonts()

QStringList FluidS::Fluid::soundFonts ( ) const

◆ soundFontsInfo()

std::vector< SoundFontInfo > FluidS::Fluid::soundFontsInfo ( ) const
overridevirtual

Implements Ms::Synthesizer.

◆ start_voice()

void FluidS::Fluid::start_voice ( Voice voice)

Kill all voices on a given channel, which belong into excl_class. This function is called by a SoundFont's preset in response to a noteon event. If one noteon event results in several voice processes (stereo samples), ignore_ID must name the voice ID of the first generated voice (so that it is not stopped). The first voice uses ignore_ID=-1, which will terminate all voices on a channel belonging into the exclusive class excl_class.

◆ state()

SynthesizerGroup FluidS::Fluid::state ( ) const
virtual

Implements Ms::Synthesizer.

◆ system_reset()

void FluidS::Fluid::system_reset ( )

◆ update_presets()

void FluidS::Fluid::update_presets ( )

This function assures that every MIDI channels has a valid preset (NULL is okay).

This function is called after a SoundFont is unloaded or reloaded.

◆ updatePatchList()

void FluidS::Fluid::updatePatchList ( )
private

Friends And Related Function Documentation

◆ Preset

friend class Preset
friend

◆ Voice

friend class Voice
friend

Member Data Documentation

◆ _error

QString FluidS::Fluid::_error
private

◆ _globalTerminate

bool FluidS::Fluid::_globalTerminate = false
private

◆ _loadProgress

int FluidS::Fluid::_loadProgress = 0
private

◆ _loadWasCanceled

bool FluidS::Fluid::_loadWasCanceled = false
private

◆ _masterTuning

float FluidS::Fluid::_masterTuning
private

◆ _state

int FluidS::Fluid::_state
protected

◆ _tuning

double FluidS::Fluid::_tuning[128]
private

◆ activeVoices

QList<Voice*> FluidS::Fluid::activeVoices
private

◆ channel

QList<Channel*> FluidS::Fluid::channel
protected

◆ freeVoices

QList<Voice*> FluidS::Fluid::freeVoices
private

◆ initialized

bool FluidS::Fluid::initialized = false
staticprivate

◆ mutex

QMutex FluidS::Fluid::mutex
private

◆ noteid

unsigned int FluidS::Fluid::noteid
protected

◆ patches

QList<MidiPatch*> FluidS::Fluid::patches
private

◆ sample_rate

double FluidS::Fluid::sample_rate
private

◆ sfont_id

unsigned int FluidS::Fluid::sfont_id
protected

◆ sfonts

QList<SFont*> FluidS::Fluid::sfonts
private

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