libfluidsynth  2.0.2
Macros | Functions
misc.h File Reference

Miscellaneous utility functions and defines. More...

Macros

#define FLUID_OK   (0)
 Value that indicates success, used by most libfluidsynth functions. More...
 
#define FLUID_FAILED   (-1)
 Value that indicates failure, used by most libfluidsynth functions. More...
 

Functions

FLUIDSYNTH_API int fluid_is_soundfont (const char *filename)
 Check if a file is a SoundFont file. More...
 
FLUIDSYNTH_API int fluid_is_midifile (const char *filename)
 Check if a file is a MIDI file. More...
 

Detailed Description

Miscellaneous utility functions and defines.

Macro Definition Documentation

◆ FLUID_OK

#define FLUID_OK   (0)

Value that indicates success, used by most libfluidsynth functions.

Since
1.1.0
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:
#include <fluidsynth.h>
#ifndef FLUID_OK
#define FLUID_OK (0)
#define FLUID_FAILED (-1)
#endif
Examples:
fluidsynth_fx.c, fluidsynth_register_adriver.c, and fluidsynth_sfload_mem.c.

Referenced by delete_fluid_cmd_handler(), delete_fluid_player(), delete_fluid_settings(), delete_fluid_shell(), fluid_audio_driver_register(), fluid_file_renderer_process_block(), fluid_file_set_encoding_quality(), fluid_get_stdout(), fluid_get_sysconf(), fluid_is_soundfont(), fluid_ladspa_activate(), fluid_ladspa_add_buffer(), fluid_ladspa_add_effect(), fluid_ladspa_check(), fluid_ladspa_deactivate(), fluid_ladspa_effect_link(), fluid_ladspa_effect_set_control(), fluid_ladspa_effect_set_mix(), fluid_ladspa_reset(), fluid_midi_event_set_channel(), fluid_midi_event_set_control(), fluid_midi_event_set_key(), fluid_midi_event_set_lyrics(), fluid_midi_event_set_pitch(), fluid_midi_event_set_program(), fluid_midi_event_set_sysex(), fluid_midi_event_set_text(), fluid_midi_event_set_type(), fluid_midi_event_set_value(), fluid_midi_event_set_velocity(), fluid_midi_router_add_rule(), fluid_midi_router_clear_rules(), fluid_midi_router_handle_midi_event(), fluid_midi_router_set_default_rules(), fluid_player_add(), fluid_player_add_mem(), fluid_player_join(), fluid_player_play(), fluid_player_seek(), fluid_player_set_loop(), fluid_player_set_midi_tempo(), fluid_player_set_playback_callback(), fluid_player_stop(), fluid_preset_set_data(), fluid_sample_set_loop(), fluid_sample_set_name(), fluid_sample_set_pitch(), fluid_sample_set_sound_data(), fluid_settings_copystr(), fluid_settings_dupstr(), fluid_settings_foreach(), fluid_settings_foreach_option(), fluid_settings_get_hints(), fluid_settings_get_type(), fluid_settings_getint(), fluid_settings_getint_default(), fluid_settings_getint_range(), fluid_settings_getnum(), fluid_settings_getnum_default(), fluid_settings_getnum_range(), fluid_settings_getstr_default(), fluid_settings_is_realtime(), fluid_settings_option_concat(), fluid_settings_option_count(), fluid_settings_setint(), fluid_settings_setnum(), fluid_settings_setstr(), fluid_settings_str_equal(), fluid_sfloader_set_callbacks(), fluid_sfloader_set_data(), fluid_sfont_set_data(), fluid_synth_activate_key_tuning(), fluid_synth_activate_octave_tuning(), fluid_synth_activate_tuning(), fluid_synth_add_default_mod(), fluid_synth_all_notes_off(), fluid_synth_all_sounds_off(), fluid_synth_alloc_voice(), fluid_synth_bank_select(), fluid_synth_cc(), fluid_synth_deactivate_tuning(), fluid_synth_get_basic_channel(), fluid_synth_get_breath_mode(), fluid_synth_get_cc(), fluid_synth_get_cpu_load(), fluid_synth_get_legato_mode(), fluid_synth_get_pitch_bend(), fluid_synth_get_pitch_wheel_sens(), fluid_synth_get_portamento_mode(), fluid_synth_get_program(), fluid_synth_handle_midi_event(), fluid_synth_key_pressure(), fluid_synth_noteoff(), fluid_synth_nwrite_float(), fluid_synth_process(), fluid_synth_program_reset(), fluid_synth_remove_default_mod(), fluid_synth_remove_sfont(), fluid_synth_reset_basic_channel(), fluid_synth_set_bank_offset(), fluid_synth_set_breath_mode(), fluid_synth_set_channel_type(), fluid_synth_set_gen(), fluid_synth_set_interp_method(), fluid_synth_set_polyphony(), fluid_synth_set_reverb_on(), fluid_synth_sfont_select(), fluid_synth_sfreload(), fluid_synth_sfunload(), fluid_synth_stop(), fluid_synth_sysex(), fluid_synth_system_reset(), fluid_synth_tune_notes(), fluid_synth_tuning_dump(), fluid_synth_write_float(), fluid_voice_gen_get(), fluid_voice_get_velocity(), fluid_voice_optimize_sample(), fluid_voice_update_param(), new_fluid_defsfloader(), and new_fluid_synth().

◆ FLUID_FAILED

#define FLUID_FAILED   (-1)

Value that indicates failure, used by most libfluidsynth functions.

Since
1.1.0
Note
See FLUID_OK for more details.
Examples:
fluidsynth_fx.c, fluidsynth_process.c, and fluidsynth_sfload_mem.c.

Referenced by delete_fluid_cmd_handler(), delete_fluid_player(), delete_fluid_settings(), delete_fluid_shell(), fluid_audio_driver_register(), fluid_command(), fluid_file_renderer_process_block(), fluid_file_set_encoding_quality(), fluid_get_stdout(), fluid_get_sysconf(), fluid_ladspa_activate(), fluid_ladspa_add_buffer(), fluid_ladspa_add_effect(), fluid_ladspa_check(), fluid_ladspa_deactivate(), fluid_ladspa_effect_link(), fluid_ladspa_effect_set_control(), fluid_ladspa_effect_set_mix(), fluid_ladspa_reset(), fluid_log(), fluid_midi_event_set_lyrics(), fluid_midi_router_add_rule(), fluid_midi_router_clear_rules(), fluid_midi_router_handle_midi_event(), fluid_midi_router_set_default_rules(), fluid_player_add(), fluid_player_add_mem(), fluid_player_play(), fluid_player_seek(), fluid_preset_set_data(), fluid_sample_set_loop(), fluid_sample_set_name(), fluid_sample_set_pitch(), fluid_sample_set_sound_data(), fluid_sequencer_add_midi_event_to_buffer(), fluid_sequencer_get_client_id(), fluid_sequencer_register_client(), fluid_sequencer_register_fluidsynth(), fluid_server_join(), fluid_settings_copystr(), fluid_settings_dupstr(), fluid_settings_get_hints(), fluid_settings_getint(), fluid_settings_getint_default(), fluid_settings_getint_range(), fluid_settings_getnum(), fluid_settings_getnum_default(), fluid_settings_getnum_range(), fluid_settings_getstr_default(), fluid_settings_setint(), fluid_settings_setnum(), fluid_settings_setstr(), fluid_sfloader_set_callbacks(), fluid_sfloader_set_data(), fluid_sfont_set_data(), fluid_synth_activate_key_tuning(), fluid_synth_activate_octave_tuning(), fluid_synth_activate_tuning(), fluid_synth_add_default_mod(), fluid_synth_add_sfont(), fluid_synth_all_notes_off(), fluid_synth_all_sounds_off(), fluid_synth_bank_select(), fluid_synth_cc(), fluid_synth_channel_pressure(), fluid_synth_deactivate_tuning(), fluid_synth_get_active_voice_count(), fluid_synth_get_basic_channel(), fluid_synth_get_breath_mode(), fluid_synth_get_cc(), fluid_synth_get_cpu_load(), fluid_synth_get_gen(), fluid_synth_get_legato_mode(), fluid_synth_get_pitch_bend(), fluid_synth_get_pitch_wheel_sens(), fluid_synth_get_polyphony(), fluid_synth_get_portamento_mode(), fluid_synth_get_program(), fluid_synth_handle_midi_event(), fluid_synth_key_pressure(), fluid_synth_noteoff(), fluid_synth_noteon(), fluid_synth_nwrite_float(), fluid_synth_pitch_bend(), fluid_synth_pitch_wheel_sens(), fluid_synth_process(), fluid_synth_program_change(), fluid_synth_program_reset(), fluid_synth_program_select(), fluid_synth_program_select_by_sfont_name(), fluid_synth_remove_default_mod(), fluid_synth_remove_sfont(), fluid_synth_reset_basic_channel(), fluid_synth_set_bank_offset(), fluid_synth_set_basic_channel(), fluid_synth_set_breath_mode(), fluid_synth_set_channel_type(), fluid_synth_set_chorus_type(), fluid_synth_set_custom_filter(), fluid_synth_set_gen(), fluid_synth_set_interp_method(), fluid_synth_set_legato_mode(), fluid_synth_set_polyphony(), fluid_synth_set_portamento_mode(), fluid_synth_set_reverb_level(), fluid_synth_set_reverb_on(), fluid_synth_sfload(), fluid_synth_sfont_select(), fluid_synth_sfreload(), fluid_synth_sfunload(), fluid_synth_start(), fluid_synth_stop(), fluid_synth_sysex(), fluid_synth_system_reset(), fluid_synth_tune_notes(), fluid_synth_tuning_dump(), fluid_synth_unset_program(), fluid_synth_write_float(), and new_fluid_defsfloader().

Function Documentation

◆ fluid_is_soundfont()

FLUIDSYNTH_API int fluid_is_soundfont ( const char *  filename)

Check if a file is a SoundFont file.

Parameters
filenamePath to the file to check
Returns
TRUE if it could be a SoundFont, FALSE otherwise
Note
The current implementation only checks for the "RIFF" and "sfbk" headers in the file. It is useful to distinguish between SoundFont and other (e.g. MIDI) files.

References FLUID_DBG, FLUID_ERR, FLUID_INFO, FLUID_OK, and FLUID_WARN.

◆ fluid_is_midifile()

FLUIDSYNTH_API int fluid_is_midifile ( const char *  filename)

Check if a file is a MIDI file.

Parameters
filenamePath 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.