libfluidsynth
2.1.1
|
SoundFont plugins. More...
Typedefs | |
typedef fluid_sfont_t *(* | fluid_sfloader_load_t) (fluid_sfloader_t *loader, const char *filename) |
Method to load an instrument file (does not actually need to be a real file name, could be another type of string identifier that the loader understands). More... | |
typedef void(* | fluid_sfloader_free_t) (fluid_sfloader_t *loader) |
The free method should free the memory allocated for a fluid_sfloader_t instance in addition to any private data. More... | |
typedef void *(* | fluid_sfloader_callback_open_t) (const char *filename) |
Opens the file or memory indicated by filename in binary read mode. More... | |
typedef int(* | fluid_sfloader_callback_read_t) (void *buf, int count, void *handle) |
Reads count bytes to the specified buffer buf . More... | |
typedef int(* | fluid_sfloader_callback_seek_t) (void *handle, long offset, int origin) |
Same purpose and behaviour as fseek. More... | |
typedef int(* | fluid_sfloader_callback_close_t) (void *handle) |
Closes the handle returned by fluid_sfloader_callback_open_t and frees used resources. More... | |
typedef long(* | fluid_sfloader_callback_tell_t) (void *handle) |
typedef const char *(* | fluid_sfont_get_name_t) (fluid_sfont_t *sfont) |
Method to return the name of a virtual SoundFont. More... | |
typedef fluid_preset_t *(* | fluid_sfont_get_preset_t) (fluid_sfont_t *sfont, int bank, int prenum) |
Get a virtual SoundFont preset by bank and program numbers. More... | |
typedef void(* | fluid_sfont_iteration_start_t) (fluid_sfont_t *sfont) |
Start virtual SoundFont preset iteration method. More... | |
typedef fluid_preset_t *(* | fluid_sfont_iteration_next_t) (fluid_sfont_t *sfont) |
Virtual SoundFont preset iteration function. More... | |
typedef int(* | fluid_sfont_free_t) (fluid_sfont_t *sfont) |
Method to free a virtual SoundFont bank. More... | |
typedef const char *(* | fluid_preset_get_name_t) (fluid_preset_t *preset) |
Method to get a virtual SoundFont preset name. More... | |
typedef int(* | fluid_preset_get_banknum_t) (fluid_preset_t *preset) |
Method to get a virtual SoundFont preset MIDI bank number. More... | |
typedef int(* | fluid_preset_get_num_t) (fluid_preset_t *preset) |
Method to get a virtual SoundFont preset MIDI program number. More... | |
typedef int(* | fluid_preset_noteon_t) (fluid_preset_t *preset, fluid_synth_t *synth, int chan, int key, int vel) |
Method to handle a noteon event (synthesize the instrument). More... | |
typedef void(* | fluid_preset_free_t) (fluid_preset_t *preset) |
Method to free a virtual SoundFont preset. More... | |
Enumerations | |
enum | { FLUID_PRESET_SELECTED, FLUID_PRESET_UNSELECTED, FLUID_SAMPLE_DONE } |
Some notification enums for presets and samples. More... | |
enum | fluid_sample_type { FLUID_SAMPLETYPE_MONO = 0x1, FLUID_SAMPLETYPE_RIGHT = 0x2, FLUID_SAMPLETYPE_LEFT = 0x4, FLUID_SAMPLETYPE_LINKED = 0x8, FLUID_SAMPLETYPE_OGG_VORBIS = 0x10, FLUID_SAMPLETYPE_ROM = 0x8000 } |
Indicates the type of a sample used by the _fluid_sample_t::sampletype field. More... | |
Functions | |
FLUIDSYNTH_API fluid_sfloader_t * | new_fluid_sfloader (fluid_sfloader_load_t load, fluid_sfloader_free_t free) |
Creates a new SoundFont loader. More... | |
FLUIDSYNTH_API void | delete_fluid_sfloader (fluid_sfloader_t *loader) |
Frees a SoundFont loader created with new_fluid_sfloader(). More... | |
FLUIDSYNTH_API fluid_sfloader_t * | new_fluid_defsfloader (fluid_settings_t *settings) |
Creates a default soundfont2 loader that can be used with fluid_synth_add_sfloader(). More... | |
FLUIDSYNTH_API int | fluid_sfloader_set_callbacks (fluid_sfloader_t *loader, fluid_sfloader_callback_open_t open, fluid_sfloader_callback_read_t read, fluid_sfloader_callback_seek_t seek, fluid_sfloader_callback_tell_t tell, fluid_sfloader_callback_close_t close) |
Set custom callbacks to be used upon soundfont loading. More... | |
FLUIDSYNTH_API int | fluid_sfloader_set_data (fluid_sfloader_t *loader, void *data) |
Specify private data to be used by fluid_sfloader_load_t. More... | |
FLUIDSYNTH_API void * | fluid_sfloader_get_data (fluid_sfloader_t *loader) |
Obtain private data previously set with fluid_sfloader_set_data(). More... | |
FLUIDSYNTH_API fluid_sfont_t * | new_fluid_sfont (fluid_sfont_get_name_t get_name, fluid_sfont_get_preset_t get_preset, fluid_sfont_iteration_start_t iter_start, fluid_sfont_iteration_next_t iter_next, fluid_sfont_free_t free) |
Creates a new virtual SoundFont instance structure. More... | |
FLUIDSYNTH_API int | delete_fluid_sfont (fluid_sfont_t *sfont) |
Destroys a SoundFont instance created with new_fluid_sfont(). More... | |
FLUIDSYNTH_API int | fluid_sfont_set_data (fluid_sfont_t *sfont, void *data) |
Set private data to use with a SoundFont instance. More... | |
FLUIDSYNTH_API void * | fluid_sfont_get_data (fluid_sfont_t *sfont) |
Retrieve the private data of a SoundFont instance. More... | |
FLUIDSYNTH_API int | fluid_sfont_get_id (fluid_sfont_t *sfont) |
Retrieve the unique ID of a SoundFont instance. More... | |
FLUIDSYNTH_API const char * | fluid_sfont_get_name (fluid_sfont_t *sfont) |
Retrieve the name of a SoundFont instance. More... | |
FLUIDSYNTH_API fluid_preset_t * | fluid_sfont_get_preset (fluid_sfont_t *sfont, int bank, int prenum) |
Retrieve the preset assigned the a SoundFont instance for the given bank and preset number. More... | |
FLUIDSYNTH_API void | fluid_sfont_iteration_start (fluid_sfont_t *sfont) |
Starts / re-starts virtual preset iteration in a SoundFont. More... | |
FLUIDSYNTH_API fluid_preset_t * | fluid_sfont_iteration_next (fluid_sfont_t *sfont) |
Virtual SoundFont preset iteration function. More... | |
FLUIDSYNTH_API fluid_preset_t * | new_fluid_preset (fluid_sfont_t *parent_sfont, fluid_preset_get_name_t get_name, fluid_preset_get_banknum_t get_bank, fluid_preset_get_num_t get_num, fluid_preset_noteon_t noteon, fluid_preset_free_t free) |
Create a virtual SoundFont preset instance. More... | |
FLUIDSYNTH_API void | delete_fluid_preset (fluid_preset_t *preset) |
Destroys a SoundFont preset instance created with new_fluid_preset(). More... | |
FLUIDSYNTH_API int | fluid_preset_set_data (fluid_preset_t *preset, void *data) |
Set private data to use with a SoundFont preset instance. More... | |
FLUIDSYNTH_API void * | fluid_preset_get_data (fluid_preset_t *preset) |
Retrieve the private data of a SoundFont preset instance. More... | |
FLUIDSYNTH_API const char * | fluid_preset_get_name (fluid_preset_t *preset) |
Retrieves the presets name by executing the get_name function provided on its creation. More... | |
FLUIDSYNTH_API int | fluid_preset_get_banknum (fluid_preset_t *preset) |
Retrieves the presets bank number by executing the get_bank function provided on its creation. More... | |
FLUIDSYNTH_API int | fluid_preset_get_num (fluid_preset_t *preset) |
Retrieves the presets (instrument) number by executing the get_num function provided on its creation. More... | |
FLUIDSYNTH_API fluid_sfont_t * | fluid_preset_get_sfont (fluid_preset_t *preset) |
Retrieves the presets parent SoundFont instance. More... | |
FLUIDSYNTH_API fluid_sample_t * | new_fluid_sample (void) |
Create a new sample instance. More... | |
FLUIDSYNTH_API void | delete_fluid_sample (fluid_sample_t *sample) |
Destroy a sample instance previously created with new_fluid_sample(). More... | |
FLUIDSYNTH_API size_t | fluid_sample_sizeof (void) |
Returns the size of the fluid_sample_t structure. More... | |
FLUIDSYNTH_API int | fluid_sample_set_name (fluid_sample_t *sample, const char *name) |
Set the name of a SoundFont sample. More... | |
FLUIDSYNTH_API int | fluid_sample_set_sound_data (fluid_sample_t *sample, short *data, char *data24, unsigned int nbframes, unsigned int sample_rate, short copy_data) |
Assign sample data to a SoundFont sample. More... | |
FLUIDSYNTH_API int | fluid_sample_set_loop (fluid_sample_t *sample, unsigned int loop_start, unsigned int loop_end) |
Set the loop of a sample. More... | |
FLUIDSYNTH_API int | fluid_sample_set_pitch (fluid_sample_t *sample, int root_key, int fine_tune) |
Set the pitch of a sample. More... | |
SoundFont plugins.
It is possible to add new SoundFont loaders to the synthesizer. This API allows for virtual SoundFont files to be loaded and synthesized, which may not actually be SoundFont files, as long as they can be represented by the SoundFont synthesis model.
To add a new SoundFont loader to the synthesizer, call fluid_synth_add_sfloader() and pass a pointer to an fluid_sfloader_t instance created by new_fluid_sfloader(). On creation, you must specify a callback function load
that will be called for every file attempting to load it and if successful returns a fluid_sfont_t instance, or NULL if it fails.
The fluid_sfont_t structure contains a callback to obtain the name of the SoundFont. It contains two functions to iterate though the contained presets, and one function to obtain a preset corresponding to a bank and preset number. This function should return a fluid_preset_t instance.
The fluid_preset_t instance contains some functions to obtain information from the preset (name, bank, number). The most important callback is the noteon function. The noteon function is called by fluidsynth internally and should call fluid_synth_alloc_voice() for every sample that has to be played. fluid_synth_alloc_voice() expects a pointer to a fluid_sample_t instance and returns a pointer to the opaque fluid_voice_t structure. To set or increment the values of a generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are finished initializing the voice call fluid_voice_start() to start playing the synthesis voice.
typedef fluid_sfont_t*(* fluid_sfloader_load_t) (fluid_sfloader_t *loader, const char *filename) |
Method to load an instrument file (does not actually need to be a real file name, could be another type of string identifier that the loader understands).
loader | SoundFont loader |
filename | File name or other string identifier |
typedef void(* fluid_sfloader_free_t) (fluid_sfloader_t *loader) |
The free method should free the memory allocated for a fluid_sfloader_t instance in addition to any private data.
Any custom user provided cleanup function must ultimately call delete_fluid_sfloader() to ensure proper cleanup of the fluid_sfloader_t struct. If no private data needs to be freed, setting this to delete_fluid_sfloader() is sufficient.
loader | SoundFont loader |
typedef void*(* fluid_sfloader_callback_open_t) (const char *filename) |
Opens the file or memory indicated by filename
in binary read mode.
filename
matches the string provided during the fluid_synth_sfload() call.
typedef int(* fluid_sfloader_callback_read_t) (void *buf, int count, void *handle) |
Reads count
bytes to the specified buffer buf
.
count
bytes were successfully read, else returns FLUID_FAILED and leaves buf unmodified. typedef int(* fluid_sfloader_callback_seek_t) (void *handle, long offset, int origin) |
Same purpose and behaviour as fseek.
origin | either SEEK_SET , SEEK_CUR or SEEK_END |
typedef int(* fluid_sfloader_callback_close_t) (void *handle) |
Closes the handle returned by fluid_sfloader_callback_open_t and frees used resources.
typedef long(* fluid_sfloader_callback_tell_t) (void *handle) |
typedef const char*(* fluid_sfont_get_name_t) (fluid_sfont_t *sfont) |
Method to return the name of a virtual SoundFont.
sfont | Virtual SoundFont |
typedef fluid_preset_t*(* fluid_sfont_get_preset_t) (fluid_sfont_t *sfont, int bank, int prenum) |
Get a virtual SoundFont preset by bank and program numbers.
sfont | Virtual SoundFont |
bank | MIDI bank number (0-16383) |
prenum | MIDI preset number (0-127) |
typedef void(* fluid_sfont_iteration_start_t) (fluid_sfont_t *sfont) |
Start virtual SoundFont preset iteration method.
sfont | Virtual SoundFont |
Starts/re-starts virtual preset iteration in a SoundFont.
typedef fluid_preset_t*(* fluid_sfont_iteration_next_t) (fluid_sfont_t *sfont) |
Virtual SoundFont preset iteration function.
sfont | Virtual SoundFont |
Returns preset information to the caller. The returned buffer is only valid until a subsequent call to this function.
typedef int(* fluid_sfont_free_t) (fluid_sfont_t *sfont) |
Method to free a virtual SoundFont bank.
Any custom user provided cleanup function must ultimately call delete_fluid_sfont() to ensure proper cleanup of the fluid_sfont_t struct. If no private data needs to be freed, setting this to delete_fluid_sfont() is sufficient.
sfont | Virtual SoundFont to free. |
typedef const char*(* fluid_preset_get_name_t) (fluid_preset_t *preset) |
Method to get a virtual SoundFont preset name.
preset | Virtual SoundFont preset |
typedef int(* fluid_preset_get_banknum_t) (fluid_preset_t *preset) |
Method to get a virtual SoundFont preset MIDI bank number.
preset | Virtual SoundFont preset |
return | The bank number of the preset |
typedef int(* fluid_preset_get_num_t) (fluid_preset_t *preset) |
Method to get a virtual SoundFont preset MIDI program number.
preset | Virtual SoundFont preset |
return | The program number of the preset |
typedef int(* fluid_preset_noteon_t) (fluid_preset_t *preset, fluid_synth_t *synth, int chan, int key, int vel) |
Method to handle a noteon event (synthesize the instrument).
preset | Virtual SoundFont preset |
synth | Synthesizer instance |
chan | MIDI channel number of the note on event |
key | MIDI note number (0-127) |
vel | MIDI velocity (0-127) |
This method may be called from within synthesis context and therefore should be as efficient as possible and not perform any operations considered bad for realtime audio output (memory allocations and other OS calls).
Call fluid_synth_alloc_voice() for every sample that has to be played. fluid_synth_alloc_voice() expects a pointer to a fluid_sample_t structure and returns a pointer to the opaque fluid_voice_t structure. To set or increment the values of a generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are finished initializing the voice call fluid_voice_start() to start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices created will be started at the same time.
typedef void(* fluid_preset_free_t) (fluid_preset_t *preset) |
Method to free a virtual SoundFont preset.
Any custom user provided cleanup function must ultimately call delete_fluid_preset() to ensure proper cleanup of the fluid_preset_t struct. If no private data needs to be freed, setting this to delete_fluid_preset() is sufficient.
preset | Virtual SoundFont preset |
anonymous enum |
enum fluid_sample_type |
Indicates the type of a sample used by the _fluid_sample_t::sampletype field.
This enum corresponds to the SFSampleLink
enum in the SoundFont spec. One flag
may be bit-wise OR-ed with one value
.
FLUIDSYNTH_API fluid_sfloader_t* new_fluid_sfloader | ( | fluid_sfloader_load_t | load, |
fluid_sfloader_free_t | free | ||
) |
Creates a new SoundFont loader.
load | Pointer to a function that provides a fluid_sfont_t (see fluid_sfloader_load_t). |
free | Pointer to a function that destroys this instance (see fluid_sfloader_free_t). Unless any private data needs to be freed it is sufficient to set this to delete_fluid_sfloader(). |
References FLUID_ERR, and fluid_sfloader_set_callbacks().
Referenced by new_fluid_defsfloader().
FLUIDSYNTH_API void delete_fluid_sfloader | ( | fluid_sfloader_t * | loader | ) |
Frees a SoundFont loader created with new_fluid_sfloader().
loader | The SoundFont loader instance to free. |
Referenced by new_fluid_defsfloader().
FLUIDSYNTH_API fluid_sfloader_t* new_fluid_defsfloader | ( | fluid_settings_t * | settings | ) |
Creates a default soundfont2 loader that can be used with fluid_synth_add_sfloader().
By default every synth instance has an initial default soundfont loader instance. Calling this function is usually only necessary to load a soundfont from memory, by providing custom callback functions via fluid_sfloader_set_callbacks().
settings | A settings instance obtained by new_fluid_settings() |
References delete_fluid_sfloader(), FLUID_ERR, fluid_sfloader_set_data(), and new_fluid_sfloader().
Referenced by new_fluid_synth().
FLUIDSYNTH_API int fluid_sfloader_set_callbacks | ( | fluid_sfloader_t * | loader, |
fluid_sfloader_callback_open_t | open, | ||
fluid_sfloader_callback_read_t | read, | ||
fluid_sfloader_callback_seek_t | seek, | ||
fluid_sfloader_callback_tell_t | tell, | ||
fluid_sfloader_callback_close_t | close | ||
) |
Set custom callbacks to be used upon soundfont loading.
Useful for loading a soundfont from memory, see doc/fluidsynth_sfload_mem.c as an example.
loader | The SoundFont loader instance. |
open | A function implementing fluid_sfloader_callback_open_t. |
read | A function implementing fluid_sfloader_callback_read_t. |
seek | A function implementing fluid_sfloader_callback_seek_t. |
tell | A function implementing fluid_sfloader_callback_tell_t. |
close | A function implementing fluid_sfloader_callback_close_t. |
References FLUID_FAILED, and FLUID_OK.
Referenced by new_fluid_sfloader().
FLUIDSYNTH_API int fluid_sfloader_set_data | ( | fluid_sfloader_t * | loader, |
void * | data | ||
) |
Specify private data to be used by fluid_sfloader_load_t.
loader | The SoundFont loader instance. |
data | The private data to store. |
References FLUID_FAILED, and FLUID_OK.
Referenced by new_fluid_defsfloader().
FLUIDSYNTH_API void* fluid_sfloader_get_data | ( | fluid_sfloader_t * | loader | ) |
Obtain private data previously set with fluid_sfloader_set_data().
loader | The SoundFont loader instance. |
FLUIDSYNTH_API fluid_sfont_t* new_fluid_sfont | ( | fluid_sfont_get_name_t | get_name, |
fluid_sfont_get_preset_t | get_preset, | ||
fluid_sfont_iteration_start_t | iter_start, | ||
fluid_sfont_iteration_next_t | iter_next, | ||
fluid_sfont_free_t | free | ||
) |
Creates a new virtual SoundFont instance structure.
get_name | A function implementing fluid_sfont_get_name_t. |
get_preset | A function implementing fluid_sfont_get_preset_t. |
iter_start | A function implementing fluid_sfont_iteration_start_t, or NULL if preset iteration not needed. |
iter_next | A function implementing fluid_sfont_iteration_next_t, or NULL if preset iteration not needed. |
free | A function implementing fluid_sfont_free_t. |
References FLUID_ERR.
FLUIDSYNTH_API int delete_fluid_sfont | ( | fluid_sfont_t * | sfont | ) |
Destroys a SoundFont instance created with new_fluid_sfont().
Implements fluid_sfont_free_t.
sfont | The SoundFont instance to destroy. |
FLUIDSYNTH_API int fluid_sfont_set_data | ( | fluid_sfont_t * | sfont, |
void * | data | ||
) |
Set private data to use with a SoundFont instance.
sfont | The SoundFont instance. |
data | The private data to store. |
References FLUID_FAILED, and FLUID_OK.
FLUIDSYNTH_API void* fluid_sfont_get_data | ( | fluid_sfont_t * | sfont | ) |
Retrieve the private data of a SoundFont instance.
sfont | The SoundFont instance. |
FLUIDSYNTH_API int fluid_sfont_get_id | ( | fluid_sfont_t * | sfont | ) |
Retrieve the unique ID of a SoundFont instance.
sfont | The SoundFont instance. |
Referenced by fluid_synth_get_bank_offset(), fluid_synth_get_sfont_by_id(), fluid_synth_program_change(), fluid_synth_program_select_by_sfont_name(), fluid_synth_set_bank_offset(), fluid_synth_sfreload(), and fluid_synth_sfunload().
FLUIDSYNTH_API const char* fluid_sfont_get_name | ( | fluid_sfont_t * | sfont | ) |
Retrieve the name of a SoundFont instance.
sfont | The SoundFont instance. |
Referenced by fluid_synth_get_sfont_by_name(), and fluid_synth_sfreload().
FLUIDSYNTH_API fluid_preset_t* fluid_sfont_get_preset | ( | fluid_sfont_t * | sfont, |
int | bank, | ||
int | prenum | ||
) |
Retrieve the preset assigned the a SoundFont instance for the given bank and preset number.
sfont | The SoundFont instance. |
bank | bank number of the preset |
prenum | program number of the preset |
FLUIDSYNTH_API void fluid_sfont_iteration_start | ( | fluid_sfont_t * | sfont | ) |
Starts / re-starts virtual preset iteration in a SoundFont.
sfont | Virtual SoundFont instance |
FLUIDSYNTH_API fluid_preset_t* fluid_sfont_iteration_next | ( | fluid_sfont_t * | sfont | ) |
Virtual SoundFont preset iteration function.
Returns preset information to the caller and advances the internal iteration state to the next preset for subsequent calls.
sfont | The SoundFont instance. |
FLUIDSYNTH_API fluid_preset_t* new_fluid_preset | ( | fluid_sfont_t * | parent_sfont, |
fluid_preset_get_name_t | get_name, | ||
fluid_preset_get_banknum_t | get_bank, | ||
fluid_preset_get_num_t | get_num, | ||
fluid_preset_noteon_t | noteon, | ||
fluid_preset_free_t | free | ||
) |
Create a virtual SoundFont preset instance.
parent_sfont | The SoundFont instance this preset shall belong to |
get_name | A function implementing fluid_preset_get_name_t |
get_bank | A function implementing fluid_preset_get_banknum_t |
get_num | A function implementing fluid_preset_get_num_t |
noteon | A function implementing fluid_preset_noteon_t |
free | A function implementing fluid_preset_free_t |
References FLUID_ERR.
FLUIDSYNTH_API void delete_fluid_preset | ( | fluid_preset_t * | preset | ) |
Destroys a SoundFont preset instance created with new_fluid_preset().
Implements fluid_preset_free_t.
preset | The SoundFont preset instance to destroy. |
FLUIDSYNTH_API int fluid_preset_set_data | ( | fluid_preset_t * | preset, |
void * | data | ||
) |
Set private data to use with a SoundFont preset instance.
preset | The SoundFont preset instance. |
data | The private data to store. |
References FLUID_FAILED, and FLUID_OK.
FLUIDSYNTH_API void* fluid_preset_get_data | ( | fluid_preset_t * | preset | ) |
Retrieve the private data of a SoundFont preset instance.
preset | The SoundFont preset instance. |
FLUIDSYNTH_API const char* fluid_preset_get_name | ( | fluid_preset_t * | preset | ) |
Retrieves the presets name by executing the get_name
function provided on its creation.
preset | The SoundFont preset instance. |
FLUIDSYNTH_API int fluid_preset_get_banknum | ( | fluid_preset_t * | preset | ) |
Retrieves the presets bank number by executing the get_bank
function provided on its creation.
preset | The SoundFont preset instance. |
preset
. FLUIDSYNTH_API int fluid_preset_get_num | ( | fluid_preset_t * | preset | ) |
Retrieves the presets (instrument) number by executing the get_num
function provided on its creation.
preset | The SoundFont preset instance. |
preset
. FLUIDSYNTH_API fluid_sfont_t* fluid_preset_get_sfont | ( | fluid_preset_t * | preset | ) |
Retrieves the presets parent SoundFont instance.
preset | The SoundFont preset instance. |
preset
. FLUIDSYNTH_API fluid_sample_t* new_fluid_sample | ( | void | ) |
FLUIDSYNTH_API void delete_fluid_sample | ( | fluid_sample_t * | sample | ) |
Destroy a sample instance previously created with new_fluid_sample().
sample | The sample to destroy. |
FLUIDSYNTH_API size_t fluid_sample_sizeof | ( | void | ) |
Returns the size of the fluid_sample_t structure.
Useful in low latency scenarios e.g. to allocate a pool of samples.
FLUIDSYNTH_API int fluid_sample_set_name | ( | fluid_sample_t * | sample, |
const char * | name | ||
) |
Set the name of a SoundFont sample.
sample | SoundFont sample |
name | Name to assign to sample (20 chars in length + zero terminator) |
References FLUID_FAILED, and FLUID_OK.
FLUIDSYNTH_API int fluid_sample_set_sound_data | ( | fluid_sample_t * | sample, |
short * | data, | ||
char * | data24, | ||
unsigned int | nbframes, | ||
unsigned int | sample_rate, | ||
short | copy_data | ||
) |
Assign sample data to a SoundFont sample.
sample | SoundFont sample |
data | Buffer containing 16 bit (mono-)audio sample data |
data24 | If not NULL, pointer to the least significant byte counterparts of each sample data point in order to create 24 bit audio samples |
nbframes | Number of samples in data |
sample_rate | Sampling rate of the sample data |
copy_data | TRUE to copy the sample data (and automatically free it upon delete_fluid_sample()), FALSE to use it directly (and not free it) |
References FLUID_ERR, FLUID_FAILED, FLUID_OK, and FLUID_SAMPLETYPE_MONO.
FLUIDSYNTH_API int fluid_sample_set_loop | ( | fluid_sample_t * | sample, |
unsigned int | loop_start, | ||
unsigned int | loop_end | ||
) |
Set the loop of a sample.
sample | SoundFont sample |
loop_start | Start sample index of the loop. |
loop_end | End index of the loop (must be a valid sample as it marks the last sample to be played). |
References FLUID_FAILED, and FLUID_OK.
FLUIDSYNTH_API int fluid_sample_set_pitch | ( | fluid_sample_t * | sample, |
int | root_key, | ||
int | fine_tune | ||
) |
Set the pitch of a sample.
sample | SoundFont sample |
root_key | Root MIDI note of sample (0-127) |
fine_tune | Fine tune in cents |
References FLUID_FAILED, and FLUID_OK.