sfizz.h File Reference
sfizz public C API.Macros
SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX
#define SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX (-1) |
Index out of bound error for the requested CC/key label.
- Since
- 0.4.0
Enumerations
sfizz_oversampling_factor_t
SFIZZ_OVERSAMPLING_X1 = 1
SFIZZ_OVERSAMPLING_X2 = 2
SFIZZ_OVERSAMPLING_X4 = 4
SFIZZ_OVERSAMPLING_X8 = 8
}
Oversampling factor.
- Since
- 0.2.0
sfizz_process_mode_t
SFIZZ_PROCESS_LIVE
SFIZZ_PROCESS_FREEWHEELING
}
Processing mode.
- Since
- 0.5.0
Typedefs
sfizz_synth_t
typedef struct sfizz_synth_t sfizz_synth_t |
Synth handle.
- Since
- 0.2.0
sfizz_client_t
typedef struct sfizz_client_t sfizz_client_t |
Client for communicating with the synth engine in either direction.
- Since
- 1.0.0
Functions
sfizz_create_synth
SFIZZ_EXPORTED_API sfizz_synth_t * sfizz_create_synth | ( | ) |
Creates a sfizz synth.
This object has to be freed by the caller using sfizz_free(). The synth by default is set at 48 kHz and a maximum block size of 1024. You should change these values if they are not correct for your application.- Since
- 0.2.0
sfizz_free
SFIZZ_EXPORTED_API void sfizz_free | ( | sfizz_synth_t * | synth | ) |
Frees an existing sfizz synth.
- Parameters
-
synth The synth to destroy.
- Since
- 0.2.0
sfizz_add_ref
SFIZZ_EXPORTED_API void sfizz_add_ref | ( | sfizz_synth_t * | synth | ) |
Adds a reference to an existing sfizz synth.
- Parameters
-
synth The synth to reference.
- Since
- 1.0.0
sfizz_load_file
SFIZZ_EXPORTED_API bool sfizz_load_file | ( | sfizz_synth_t * | synth | , | const char * | path | ) |
Loads an SFZ file.
The file path can be absolute or relative. All file operations for this SFZ file will be relative to the parent directory of the SFZ file.- Parameters
-
synth The synth. path A null-terminated string representing a path to an SFZ file.
- Returns
- true when file loading went OK, false if some error occured while loading.
- Since
- 0.2.0
sfizz_load_string
SFIZZ_EXPORTED_API bool sfizz_load_string | ( | sfizz_synth_t * | synth | , | const char * | path | , | const char * | text | ) |
Loads an SFZ file from textual data.
This accepts a virtual path name for the imaginary sfz file, which is not required to exist on disk. The purpose of the virtual path is to locate samples with relative paths.- Parameters
-
synth The synth. path The virtual path of the SFZ file. text The contents of the virtual SFZ file.
- Returns
- true when file loading went OK, false if some error occured while loading.
- Since
- 0.4.0
sfizz_load_scala_file
SFIZZ_EXPORTED_API bool sfizz_load_scala_file | ( | sfizz_synth_t * | synth | , | const char * | path | ) |
Sets the tuning from a Scala file loaded from the file system.
- Parameters
-
synth The synth. path The path to the file in Scala format.
- Returns
- true when tuning scale loaded OK, false if some error occurred.
- Since
- 0.4.0
sfizz_load_scala_string
SFIZZ_EXPORTED_API bool sfizz_load_scala_string | ( | sfizz_synth_t * | synth | , | const char * | text | ) |
Sets the tuning from a Scala file loaded from memory.
- Parameters
-
synth The synth. text The contents of the file in Scala format.
- Returns
- true when tuning scale loaded OK, false if some error occurred.
- Since
- 0.4.0
sfizz_set_scala_root_key
SFIZZ_EXPORTED_API void sfizz_set_scala_root_key | ( | sfizz_synth_t * | synth | , | int | root_key | ) |
Sets the scala root key.
- Parameters
-
synth The synth. root_key The MIDI number of the Scala root key (default 60 for C4).
- Since
- 0.4.0
sfizz_get_scala_root_key
SFIZZ_EXPORTED_API int sfizz_get_scala_root_key | ( | sfizz_synth_t * | synth | ) |
Gets the scala root key.
- Parameters
-
synth The synth.
- Returns
- The MIDI number of the Scala root key (default 60 for C4).
- Since
- 0.4.0
sfizz_set_tuning_frequency
SFIZZ_EXPORTED_API void sfizz_set_tuning_frequency | ( | sfizz_synth_t * | synth | , | float | frequency | ) |
Sets the reference tuning frequency.
- Parameters
-
synth The synth. frequency The frequency which indicates where standard tuning A4 is (default 440 Hz).
- Since
- 0.4.0
sfizz_get_tuning_frequency
SFIZZ_EXPORTED_API float sfizz_get_tuning_frequency | ( | sfizz_synth_t * | synth | ) |
Gets the reference tuning frequency.
- Parameters
-
synth The synth.
- Returns
- The frequency which indicates where standard tuning A4 is (default 440 Hz).
- Since
- 0.4.0
sfizz_load_stretch_tuning_by_ratio
SFIZZ_EXPORTED_API void sfizz_load_stretch_tuning_by_ratio | ( | sfizz_synth_t * | synth | , | float | ratio | ) |
Configure stretch tuning using a predefined parametric Railsback curve.
A ratio 1/2 is supposed to match the average piano; 0 disables (the default).- Parameters
-
synth The synth. ratio The parameter in domain 0-1.
- Since
- 0.4.0
sfizz_get_num_regions
SFIZZ_EXPORTED_API int sfizz_get_num_regions | ( | sfizz_synth_t * | synth | ) |
Return the number of regions in the currently loaded SFZ file.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_num_groups
SFIZZ_EXPORTED_API int sfizz_get_num_groups | ( | sfizz_synth_t * | synth | ) |
Return the number of groups in the currently loaded SFZ file.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_num_masters
SFIZZ_EXPORTED_API int sfizz_get_num_masters | ( | sfizz_synth_t * | synth | ) |
Return the number of masters in the currently loaded SFZ file.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_num_curves
SFIZZ_EXPORTED_API int sfizz_get_num_curves | ( | sfizz_synth_t * | synth | ) |
Return the number of curves in the currently loaded SFZ file.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_export_midnam
SFIZZ_EXPORTED_API char * sfizz_export_midnam | ( | sfizz_synth_t * | synth | , | const char * | model | ) |
Export a MIDI Name document describing the currently loaded SFZ file.
- Parameters
-
synth The synth. model The model name used if a non-empty string, otherwise generated.
- Returns
- A newly allocated XML string, which must be freed after use using sfizz_free_memory().
- Since
- 0.3.1
sfizz_get_num_preloaded_samples
SFIZZ_EXPORTED_API size_t sfizz_get_num_preloaded_samples | ( | sfizz_synth_t * | synth | ) |
Return the number of preloaded samples for the current SFZ file.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_num_active_voices
SFIZZ_EXPORTED_API int sfizz_get_num_active_voices | ( | sfizz_synth_t * | synth | ) |
Return the number of active voices.
Note that this function is a basic indicator and does not aim to be perfect. In particular, it runs on the calling thread so voices may well start or stop while the function is checking which voice is active.- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_set_samples_per_block
SFIZZ_EXPORTED_API void sfizz_set_samples_per_block | ( | sfizz_synth_t * | synth | , | int | samples_per_block | ) |
Set the expected number of samples per block.
If unsure, give an upper bound since right now ugly things may happen if you go over this number.- Parameters
-
synth The synth. samples_per_block The number of samples per block.
- Since
- 0.2.0
sfizz_set_sample_rate
SFIZZ_EXPORTED_API void sfizz_set_sample_rate | ( | sfizz_synth_t * | synth | , | float | sample_rate | ) |
Set the sample rate for the synth.
This is the output sample rate. This setting does not affect the internal processing.- Parameters
-
synth The synth sample_rate The sample rate.
- Since
- 0.2.0
sfizz_send_note_on
SFIZZ_EXPORTED_API void sfizz_send_note_on | ( | sfizz_synth_t * | synth | , | int | delay | , | int | note_number | , | int | velocity | ) |
Send a note on event to the synth.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. note_number The MIDI note number, in domain 0 to 127. velocity The MIDI velocity, in domain 0 to 127.
- Since
- 0.2.0
sfizz_send_hd_note_on
SFIZZ_EXPORTED_API void sfizz_send_hd_note_on | ( | sfizz_synth_t * | synth | , | int | delay | , | int | note_number | , | float | velocity | ) |
Send a high-precision on event to the synth.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. note_number The MIDI note number, in domain 0 to 127. velocity The normalized MIDI velocity, in domain 0 to 1.
- Since
- 1.0.0
sfizz_send_note_off
SFIZZ_EXPORTED_API void sfizz_send_note_off | ( | sfizz_synth_t * | synth | , | int | delay | , | int | note_number | , | int | velocity | ) |
Send a note off event to the synth.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. note_number The MIDI note number, in domain 0 to 127. velocity The MIDI velocity, in domain 0 to 127.
- Since
- 0.2.0
sfizz_send_hd_note_off
SFIZZ_EXPORTED_API void sfizz_send_hd_note_off | ( | sfizz_synth_t * | synth | , | int | delay | , | int | note_number | , | float | velocity | ) |
Send a high-precision note off event to the synth.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. note_number The MIDI note number, in domain 0 to 127. velocity The normalized MIDI velocity, in domain 0 to 1.
- Since
- 1.0.0
sfizz_send_cc
SFIZZ_EXPORTED_API void sfizz_send_cc | ( | sfizz_synth_t * | synth | , | int | delay | , | int | cc_number | , | int | cc_value | ) |
Send a CC event to the synth.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. cc_number The MIDI CC number, in domain 0 to 127. cc_value The MIDI CC value, in domain 0 to 127.
- Since
- 0.2.0
sfizz_send_hdcc
SFIZZ_EXPORTED_API void sfizz_send_hdcc | ( | sfizz_synth_t * | synth | , | int | delay | , | int | cc_number | , | float | norm_value | ) |
Send a high precision CC event to the synth.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. cc_number The MIDI CC number, in domain 0 to 127. norm_value The normalized CC value, in domain 0 to 1.
- Since
- 0.4.0
sfizz_automate_hdcc
SFIZZ_EXPORTED_API void sfizz_automate_hdcc | ( | sfizz_synth_t * | synth | , | int | delay | , | int | cc_number | , | float | norm_value | ) |
Send a high precision CC automation to the synth.
This updates the CC value known to the synth, but without performing additional MIDI-specific interpretations. (eg. the CC 120 and up)- Parameters
-
synth The synth. delay The delay of the event in the block, in samples. cc_number The MIDI CC number, in domain 0 to 127. norm_value The normalized CC value, in domain 0 to 1.
- Since
- 1.0.0
sfizz_send_pitch_wheel
SFIZZ_EXPORTED_API void sfizz_send_pitch_wheel | ( | sfizz_synth_t * | synth | , | int | delay | , | int | pitch | ) |
Send a pitch wheel event.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. pitch The pitch.
- Since
- 0.2.0
sfizz_send_hd_pitch_wheel
SFIZZ_EXPORTED_API void sfizz_send_hd_pitch_wheel | ( | sfizz_synth_t * | synth | , | int | delay | , | float | pitch | ) |
Send a high-precision pitch wheel event.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. pitch The normalized pitch, in domain -1 to 1.
- Since
- 1.0.0
sfizz_send_aftertouch
SFIZZ_EXPORTED_API SFIZZ_DEPRECATED_API void sfizz_send_aftertouch | ( | sfizz_synth_t * | synth | , | int | delay | , | int | aftertouch | ) |
Send an aftertouch event.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay at which the event occurs; this should be lower than the size of the block in the next call to sfizz_render_block(). aftertouch The aftertouch value, in domain 0 to 127.
- Since
- 0.2.0
sfizz_send_channel_aftertouch
SFIZZ_EXPORTED_API void sfizz_send_channel_aftertouch | ( | sfizz_synth_t * | synth | , | int | delay | , | int | aftertouch | ) |
Send a channel aftertouch (channel pressure) event.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay at which the event occurs; this should be lower than the size of the block in the next call to sfizz_render_block(). aftertouch The aftertouch value, in domain 0 to 127.
- Since
- 1.0.0
sfizz_send_hd_channel_aftertouch
SFIZZ_EXPORTED_API void sfizz_send_hd_channel_aftertouch | ( | sfizz_synth_t * | synth | , | int | delay | , | float | aftertouch | ) |
Send a high-precision aftertouch event.
This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay at which the event occurs; this should be lower than the size of the block in the next call to sfizz_render_block(). aftertouch The normalized aftertouch value, in domain 0 to 1.
- Since
- 1.0.0
sfizz_send_poly_aftertouch
SFIZZ_EXPORTED_API void sfizz_send_poly_aftertouch | ( | sfizz_synth_t * | synth | , | int | delay | , | int | note_number | , | int | aftertouch | ) |
Send a polyphonic aftertouch event.
This feature is experimental and needs more testing in the internal engine. This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay at which the event occurs; this should be lower than the size of the block in the next call to sfizz_render_block(). note_number The note number, in domain 0 to 127. aftertouch The aftertouch value, in domain 0 to 127.
- Since
- 1.0.0
sfizz_send_hd_poly_aftertouch
SFIZZ_EXPORTED_API void sfizz_send_hd_poly_aftertouch | ( | sfizz_synth_t * | synth | , | int | delay | , | int | note_number | , | float | aftertouch | ) |
Send a high-precision polyphonic aftertouch event.
This feature is experimental and needs more testing in the internal engine. This command should be delay-ordered with all other midi-type events (notes, CCs, aftertouch and pitch-wheel), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay at which the event occurs; this should be lower than the size of the block in the next call to sfizz_render_block(). note_number The note number, in domain 0 to 127. aftertouch The normalized aftertouch value, in domain 0 to 1.
- Since
- 1.0.0
sfizz_send_tempo
SFIZZ_EXPORTED_API SFIZZ_DEPRECATED_API void sfizz_send_tempo | ( | sfizz_synth_t * | synth | , | int | delay | , | float | seconds_per_beat | ) |
Send a tempo event.
This command should be delay-ordered with all other time/signature commands, namely sfizz_send_tempo(), sfizz_send_time_signature(), sfizz_send_time_position(), and sfizz_send_playback_state(), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. seconds_per_beat The seconds per beat.
- Since
- 0.2.0
sfizz_send_bpm_tempo
SFIZZ_EXPORTED_API void sfizz_send_bpm_tempo | ( | sfizz_synth_t * | synth | , | int | delay | , | float | beats_per_minute | ) |
Send a tempo event.
This command should be delay-ordered with all other time/signature commands, namely sfizz_send_tempo(), sfizz_send_time_signature(), sfizz_send_time_position(), and sfizz_send_playback_state(), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. beats_per_minute The new tempo, in beats per minute.
- Since
- 1.0.0
sfizz_send_time_signature
SFIZZ_EXPORTED_API void sfizz_send_time_signature | ( | sfizz_synth_t * | synth | , | int | delay | , | int | beats_per_bar | , | int | beat_unit | ) |
Send the time signature.
This command should be delay-ordered with all other time/signature commands, namely sfizz_send_tempo(), sfizz_send_time_signature(), sfizz_send_time_position(), and sfizz_send_playback_state(), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. beats_per_bar The number of beats per bar, or time signature numerator. beat_unit The note corresponding to one beat, or time signature denominator.
- Since
- 0.5.0
sfizz_send_time_position
SFIZZ_EXPORTED_API void sfizz_send_time_position | ( | sfizz_synth_t * | synth | , | int | delay | , | int | bar | , | double | bar_beat | ) |
Send the time position.
This command should be delay-ordered with all other time/signature commands, namely sfizz_send_tempo(), sfizz_send_time_signature(), sfizz_send_time_position(), and sfizz_send_playback_state(), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. bar The current bar. bar_beat The fractional position of the current beat within the bar.
- Since
- 0.5.0
sfizz_send_playback_state
SFIZZ_EXPORTED_API void sfizz_send_playback_state | ( | sfizz_synth_t * | synth | , | int | delay | , | int | playback_state | ) |
Send the playback state.
This command should be delay-ordered with all other time/signature commands, namely sfizz_send_tempo(), sfizz_send_time_signature(), sfizz_send_time_position(), and sfizz_send_playback_state(), otherwise the behavior of the synth is undefined.- Parameters
-
synth The synth. delay The delay. playback_state The playback state, 1 if playing, 0 if stopped.
- Since
- 0.5.0
sfizz_render_block
SFIZZ_EXPORTED_API void sfizz_render_block | ( | sfizz_synth_t * | synth | , | float ** | channels | , | int | num_channels | , | int | num_frames | ) |
Render a block audio data into a stereo channel.
No other channel configuration is supported. The synth will gracefully ignore your request if you provide a value. You should pass all the relevant events for the block (midi notes, CCs, ...) before rendering each block. The synth will memorize the inputs and render sample accurates envelopes depending on the input events passed to it.- Parameters
-
synth The synth. channels Pointers to the left and right channel of the output. num_channels Should be equal to 2 for the time being. num_frames Number of frames to fill. This should be less than or equal to the expected samples_per_block.
- Since
- 0.2.0
sfizz_get_preload_size
SFIZZ_EXPORTED_API unsigned int sfizz_get_preload_size | ( | sfizz_synth_t * | synth | ) |
Get the size of the preloaded data.
This returns the number of floats used in the preloading buffers.- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_set_preload_size
SFIZZ_EXPORTED_API void sfizz_set_preload_size | ( | sfizz_synth_t * | synth | , | unsigned int | preload_size | ) |
Set the size of the preloaded data in number of floats (not bytes).
This will disable the callbacks for the duration of the load. This function takes a lock ; prefer calling it out of the RT thread. It can also take a long time to return. If the new preload size is the same as the current one, it will release the lock immediately and exit.- Parameters
-
synth The synth. preload_size The preload size.
- Since
- 0.2.0
sfizz_get_oversampling_factor
SFIZZ_EXPORTED_API sfizz_oversampling_factor_t sfizz_get_oversampling_factor | ( | sfizz_synth_t * | synth | ) |
Get the internal oversampling rate.
As of 1.0, This is an inactive stub for future work on oversampling in the engine.- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_set_oversampling_factor
SFIZZ_EXPORTED_API bool sfizz_set_oversampling_factor | ( | sfizz_synth_t * | synth | , | sfizz_oversampling_factor_t | oversampling | ) |
Set the internal oversampling rate.
As of 1.0, This is an inactive stub for future work on oversampling in the engine.- Parameters
-
synth The synth. oversampling The oversampling factor.
- Returns
- true if the oversampling factor was correct, false otherwise.
- Since
- 0.2.0
sfizz_get_sample_quality
SFIZZ_EXPORTED_API int sfizz_get_sample_quality | ( | sfizz_synth_t * | synth | , | sfizz_process_mode_t | mode | ) |
Get the default resampling quality.
This is the quality setting which the engine uses when the instrument does not use the opcodesample_quality
. The engine uses distinct default quality settings for live mode and freewheeling mode, which both can be accessed by the means of this function.
- Parameters
-
synth The synth. mode The processing mode.
- Returns
- The sample quality for the given mode, in the range 0 to 10.
- Since
- 0.4.0
sfizz_set_sample_quality
SFIZZ_EXPORTED_API void sfizz_set_sample_quality | ( | sfizz_synth_t * | synth | , | sfizz_process_mode_t | mode | , | int | quality | ) |
Set the default resampling quality.
This is the quality setting which the engine uses when the instrument does not use the opcodesample_quality
. The engine uses distinct default quality settings for live mode and freewheeling mode, which both can be accessed by the means of this function.
- Parameters
-
synth The synth. mode The processing mode. quality The desired sample quality, in the range 0 to 10.
- Since
- 0.4.0
sfizz_get_oscillator_quality
SFIZZ_EXPORTED_API int sfizz_get_oscillator_quality | ( | sfizz_synth_t * | synth | , | sfizz_process_mode_t | mode | ) |
Get the default oscillator quality.
This is the quality setting which the engine uses when the instrument does not use the opcodeoscillator_quality
. The engine uses distinct default quality settings for live mode and freewheeling mode, which both can be accessed by the means of this function.
- Parameters
-
synth The synth. mode The processing mode.
- Returns
- The oscillator quality for the given mode, in the range 0 to 10.
- Since
- 1.0.0
sfizz_set_oscillator_quality
SFIZZ_EXPORTED_API void sfizz_set_oscillator_quality | ( | sfizz_synth_t * | synth | , | sfizz_process_mode_t | mode | , | int | quality | ) |
Set the default oscillator quality.
This is the quality setting which the engine uses when the instrument does not use the opcodeoscillator_quality
. The engine uses distinct default quality settings for live mode and freewheeling mode, which both can be accessed by the means of this function.
- Parameters
-
synth The synth. mode The processing mode. quality The desired oscillator quality, in the range 0 to 10.
- Since
- 1.0.0
sfizz_set_volume
SFIZZ_EXPORTED_API void sfizz_set_volume | ( | sfizz_synth_t * | synth | , | float | volume | ) |
Set the global instrument volume.
- Parameters
-
synth The synth. volume The new volume.
- Since
- 0.2.0
sfizz_get_volume
SFIZZ_EXPORTED_API float sfizz_get_volume | ( | sfizz_synth_t * | synth | ) |
Return the global instrument volume.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_set_num_voices
SFIZZ_EXPORTED_API void sfizz_set_num_voices | ( | sfizz_synth_t * | synth | , | int | num_voices | ) |
Set the number of voices used by the synth.
- Parameters
-
synth The synth. num_voices The number of voices.
- Since
- 0.2.0
sfizz_get_num_voices
SFIZZ_EXPORTED_API int sfizz_get_num_voices | ( | sfizz_synth_t * | synth | ) |
Return the number of voices.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_num_buffers
SFIZZ_EXPORTED_API int sfizz_get_num_buffers | ( | sfizz_synth_t * | synth | ) |
Return the number of allocated buffers from the synth.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_num_bytes
SFIZZ_EXPORTED_API int sfizz_get_num_bytes | ( | sfizz_synth_t * | synth | ) |
Get the number of bytes allocated from the synth.
Note that this value can be less than the actual memory usage since it only counts the buffer objects managed by sfizz.- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_enable_freewheeling
SFIZZ_EXPORTED_API void sfizz_enable_freewheeling | ( | sfizz_synth_t * | synth | ) |
Enable freewheeling on the synth.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_disable_freewheeling
SFIZZ_EXPORTED_API void sfizz_disable_freewheeling | ( | sfizz_synth_t * | synth | ) |
Disable freewheeling on the synth.
- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_get_unknown_opcodes
SFIZZ_EXPORTED_API char * sfizz_get_unknown_opcodes | ( | sfizz_synth_t * | synth | ) |
Return a comma separated list of unknown opcodes.
The caller has to free() the string returned. This function allocates memory, do not call on the audio thread.- Parameters
-
synth The synth.
- Since
- 0.2.0
sfizz_should_reload_file
SFIZZ_EXPORTED_API bool sfizz_should_reload_file | ( | sfizz_synth_t * | synth | ) |
Check if the SFZ should be reloaded.
Depending on the platform this can create file descriptors.- Parameters
-
synth The synth.
- Returns
- true if any included files (including the root file) have been modified since the sfz file was loaded, false otherwise.
- Since
- 0.2.0
sfizz_should_reload_scala
SFIZZ_EXPORTED_API bool sfizz_should_reload_scala | ( | sfizz_synth_t * | synth | ) |
Check if the scala file should be reloaded.
Depending on the platform this can create file descriptors.- Parameters
-
synth The synth.
- Returns
- true if the scala file has been modified since loading.
- Since
- 0.4.0
sfizz_enable_logging
SFIZZ_EXPORTED_API void sfizz_enable_logging | ( | sfizz_synth_t * | synth | , | const char * | prefix | ) |
Enable logging of timings to sidecar CSV files.
- Parameters
-
synth The synth. prefix The prefix.
- Since
- 0.3.0
- Note
- This can produce many outputs so use with caution.
sfizz_disable_logging
SFIZZ_EXPORTED_API void sfizz_disable_logging | ( | sfizz_synth_t * | synth | ) |
Disable logging.
- Parameters
-
synth The synth.
- Since
- 0.3.0
sfizz_set_logging_prefix
SFIZZ_EXPORTED_API SFIZZ_DEPRECATED_API void sfizz_set_logging_prefix | ( | sfizz_synth_t * | synth | , | const char * | prefix | ) |
Enable logging of timings to sidecar CSV files.
- Parameters
-
synth The synth. prefix The prefix.
- Since
- 0.3.2
- Note
- This can produce many outputs so use with caution.
sfizz_all_sound_off
SFIZZ_EXPORTED_API void sfizz_all_sound_off | ( | sfizz_synth_t * | synth | ) |
Shuts down the current processing, clear buffers and reset the voices.
- Parameters
-
synth The synth.
- Since
- 0.3.2
sfizz_add_external_definitions
SFIZZ_EXPORTED_API void sfizz_add_external_definitions | ( | sfizz_synth_t * | synth | , | const char * | id | , | const char * | value | ) |
Add external definitions prior to loading.
- Parameters
-
synth The synth. id The definition variable name. value The definition value.
- Since
- 0.4.0
- Note
- These do not get reset by loading or resetting the synth. You need to call sfizz_clear_external_definitions() to erase them.
sfizz_clear_external_definitions
SFIZZ_EXPORTED_API void sfizz_clear_external_definitions | ( | sfizz_synth_t * | synth | ) |
Clears external definitions for the next file loading.
- Parameters
-
synth The synth.
- Since
- 0.4.0
sfizz_get_num_key_labels
SFIZZ_EXPORTED_API unsigned int sfizz_get_num_key_labels | ( | sfizz_synth_t * | synth | ) |
Get the number of key labels registered in the current sfz file.
- Parameters
-
synth The synth.
- Since
- 0.4.0
sfizz_get_key_label_number
SFIZZ_EXPORTED_API int sfizz_get_key_label_number | ( | sfizz_synth_t * | synth | , | int | label_index | ) |
Get the key number for the label registered at index label_index.
- Parameters
-
synth The synth. label_index The label index.
- Returns
- the number or SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX if the index is out of bounds.
- Since
- 0.4.0
sfizz_get_key_label_text
SFIZZ_EXPORTED_API const char * sfizz_get_key_label_text | ( | sfizz_synth_t * | synth | , | int | label_index | ) |
Get the key text for the label registered at index label_index.
- Parameters
-
synth The synth. label_index The label index.
- Returns
- the label or nullptr if the index is out of bounds.
- Since
- 0.4.0
sfizz_get_num_cc_labels
SFIZZ_EXPORTED_API unsigned int sfizz_get_num_cc_labels | ( | sfizz_synth_t * | synth | ) |
Get the number of CC labels registered in the current sfz file.
- Parameters
-
synth The synth.
- Since
- 0.4.0
sfizz_get_cc_label_number
SFIZZ_EXPORTED_API int sfizz_get_cc_label_number | ( | sfizz_synth_t * | synth | , | int | label_index | ) |
Get the CC number for the label registered at index label_index.
- Parameters
-
synth The synth. label_index The label index.
- Returns
- the number or SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX if the index is out of bounds.
- Since
- 0.4.0
sfizz_get_cc_label_text
SFIZZ_EXPORTED_API const char * sfizz_get_cc_label_text | ( | sfizz_synth_t * | synth | , | int | label_index | ) |
Get the CC text for the label registered at index label_index.
- Parameters
-
synth The synth. label_index The label index.
- Returns
- the label or nullptr if the index is out of bounds.
- Since
- 0.4.0
sfizz_free_memory
SFIZZ_EXPORTED_API void sfizz_free_memory | ( | void * | ptr | ) |
Free a block of memory allocated by the library.
1.0.0- Parameters
-
ptr The address of the memory to free.
sfizz_create_client
SFIZZ_EXPORTED_API sfizz_client_t * sfizz_create_client | ( | void * | data | ) |
Create a new messaging client.
- Parameters
-
data The opaque data pointer which is passed to the receiver.
- Returns
- The new client.
- Since
- 1.0.0
sfizz_delete_client
SFIZZ_EXPORTED_API void sfizz_delete_client | ( | sfizz_client_t * | client | ) |
Destroy a messaging client.
- Parameters
-
client The client.
- Since
- 1.0.0
sfizz_get_client_data
SFIZZ_EXPORTED_API void * sfizz_get_client_data | ( | sfizz_client_t * | client | ) |
Get the client data.
- Parameters
-
client The client.
- Returns
- The client data.
- Since
- 1.0.0
sfizz_set_receive_callback
SFIZZ_EXPORTED_API void sfizz_set_receive_callback | ( | sfizz_client_t * | client | , | sfizz_receive_t * | receive | ) |
Set the function which receives reply messages from the synth engine.
- Parameters
-
client The client. receive The pointer to the receiving function.
- Since
- 1.0.0
sfizz_send_message
SFIZZ_EXPORTED_API void sfizz_send_message | ( | sfizz_synth_t * | synth | , | sfizz_client_t * | client | , | int | delay | , | const char * | path | , | const char * | sig | , | const sfizz_arg_t * | args | ) |
Send a message to the synth engine.
- Parameters
-
synth The synth. client The client sending the message. delay The delay of the message in the block, in samples. path The OSC address pattern. sig The OSC type tag string. args The OSC arguments, whose number and format is determined the type tag string.
- Since
- 1.0.0
sfizz_set_broadcast_callback
SFIZZ_EXPORTED_API void sfizz_set_broadcast_callback | ( | sfizz_synth_t * | synth | , | sfizz_receive_t * | broadcast | , | void * | data | ) |
Set the function which receives broadcast messages from the synth engine.
- Parameters
-
synth The synth. broadcast The pointer to the receiving function. data The opaque data pointer which is passed to the receiver.
- Since
- 1.0.0