Miscellaneous
Miscellaneous utility functions and defines.
Functions
fluid_free()
Wrapper for free() that satisfies at least C90 requirements.
Parameters:
| Name | Description |
|---|---|
ptr |
Pointer to memory region that should be freed |
Note
Only use this function when the API documentation explicitly says so. Otherwise use adequate delete_fluid_* functions.
Warning
Calling C-std lib free() on memory that is advised to be freed with fluid_free() results in undefined behaviour! (cf.: "Potential Errors Passing CRT Objects Across DLL Boundaries" found in MS Docs)
Since
2.0.7
fluid_is_midifile()
Check if a file is a MIDI file.
Parameters:
| Name | Description |
|---|---|
filename |
Path to the file to check |
Returns: TRUE if it could be a MIDI file, FALSE otherwise
The current implementation only checks for the "MThd" header in the file. It is useful only to distinguish between SoundFont and MIDI files.
fluid_is_soundfont()
Check if a file is a SoundFont file.
Parameters:
| Name | Description |
|---|---|
filename |
Path to the file to check |
Returns: TRUE if it could be a SF2, SF3 or DLS file, FALSE otherwise
This function uses regular fopen(), fread() and fseek() to identify known Soundfont formats. If fluidsynth was built with DLS support, this function will also identify DLS files.
Note
This function only checks whether certain RIFF chunks are present in the file. A call to fluid_synth_sfload() might still fail, as it imposes much stricter structural checks.
fluid_version()
Get FluidSynth runtime version.
Parameters:
| Name | Description |
|---|---|
major |
Location to store major number |
minor |
Location to store minor number |
micro |
Location to store micro number |
fluid_version_str()
Get FluidSynth runtime version as a string.
Returns: FluidSynth version string, which is internal and should not be modified or freed.
Macros
FLUID_FAILED
Value that indicates failure, used by most libfluidsynth functions.
Note
See FLUID_OK for more details.
Since
1.1.0
FLUID_OK
Value that indicates success, used by most libfluidsynth functions.
Note
This was not publicly defined prior to libfluidsynth 1.1.0. When writing code which should also be compatible with older versions, something like the following can be used:
Since
1.1.0
FLUIDSYNTH_VERSION
String constant of libfluidsynth version.
FLUIDSYNTH_VERSION_MAJOR
libfluidsynth major version integer constant.
FLUIDSYNTH_VERSION_MICRO
libfluidsynth micro version integer constant.
FLUIDSYNTH_VERSION_MINOR
libfluidsynth minor version integer constant.