2020-01-25 10:04:31 +01:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
|
2020-01-25 13:13:07 +01:00
|
|
|
// This code is part of the sfizz library and is licensed under a BSD 2-clause
|
|
|
|
|
// license. You should have receive a LICENSE.md file along with the code.
|
|
|
|
|
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2019-11-18 00:22:06 +01:00
|
|
|
/**
|
|
|
|
|
@file
|
2020-09-05 16:14:51 +02:00
|
|
|
@brief sfizz public C API.
|
2019-11-18 00:22:06 +01:00
|
|
|
*/
|
|
|
|
|
|
2019-11-17 09:04:42 +01:00
|
|
|
#pragma once
|
2020-02-25 10:56:17 +01:00
|
|
|
#include <stddef.h>
|
2019-11-19 01:21:08 +01:00
|
|
|
#include <stdbool.h>
|
2020-03-26 23:13:45 +01:00
|
|
|
|
|
|
|
|
#if defined SFIZZ_EXPORT_SYMBOLS
|
|
|
|
|
#if defined _WIN32
|
|
|
|
|
#define SFIZZ_EXPORTED_API __declspec(dllexport)
|
|
|
|
|
#else
|
|
|
|
|
#define SFIZZ_EXPORTED_API __attribute__ ((visibility ("default")))
|
|
|
|
|
#endif
|
|
|
|
|
#else
|
|
|
|
|
#define SFIZZ_EXPORTED_API
|
|
|
|
|
#endif
|
|
|
|
|
|
2019-11-17 09:04:42 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
2020-04-07 18:42:41 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Synth handle.
|
|
|
|
|
* @since 0.2.0
|
2020-04-07 18:42:41 +02:00
|
|
|
*/
|
2019-11-17 09:04:42 +01:00
|
|
|
typedef struct sfizz_synth_t sfizz_synth_t;
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2020-04-07 18:42:41 +02:00
|
|
|
/**
|
|
|
|
|
* @brief Oversampling factor
|
2020-09-05 16:14:51 +02:00
|
|
|
* @since 0.2.0
|
2020-04-07 18:42:41 +02:00
|
|
|
*/
|
2019-12-01 23:17:50 +01:00
|
|
|
typedef enum {
|
|
|
|
|
SFIZZ_OVERSAMPLING_X1 = 1,
|
|
|
|
|
SFIZZ_OVERSAMPLING_X2 = 2,
|
|
|
|
|
SFIZZ_OVERSAMPLING_X4 = 4,
|
|
|
|
|
SFIZZ_OVERSAMPLING_X8 = 8
|
|
|
|
|
} sfizz_oversampling_factor_t;
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2020-06-11 13:51:37 +02:00
|
|
|
/**
|
|
|
|
|
* @brief Processing mode
|
2020-09-05 16:14:51 +02:00
|
|
|
* @since 0.4.1
|
2020-06-11 13:51:37 +02:00
|
|
|
*/
|
|
|
|
|
typedef enum {
|
|
|
|
|
SFIZZ_PROCESS_LIVE,
|
|
|
|
|
SFIZZ_PROCESS_FREEWHEELING,
|
|
|
|
|
} sfizz_process_mode_t;
|
2019-12-02 00:10:21 +01:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief 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
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API sfizz_synth_t* sfizz_create_synth();
|
2020-04-07 18:42:41 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Frees an existing sfizz synth.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth to destroy.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_free(sfizz_synth_t* synth);
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Loads an SFZ file.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* 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.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param path A null-terminated string representing a path to an SFZ file.
|
|
|
|
|
*
|
|
|
|
|
* @return @true when file loading went OK,
|
|
|
|
|
* @false if some error occured while loading.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API bool sfizz_load_file(sfizz_synth_t* synth, const char* path);
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2020-05-06 19:10:35 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief 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.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-06 19:10:35 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param path The virtual path of the SFZ file.
|
|
|
|
|
* @param text The contents of the virtual SFZ file.
|
2020-05-06 19:10:35 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @return @true when file loading went OK,
|
|
|
|
|
* @false if some error occured while loading.
|
2020-05-06 19:10:35 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API bool sfizz_load_string(sfizz_synth_t* synth, const char* path, const char* text);
|
|
|
|
|
|
2020-05-19 14:51:33 +02:00
|
|
|
/**
|
|
|
|
|
* @brief Sets the tuning from a Scala file loaded from the file system.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-19 14:51:33 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param path The path to the file in Scala format.
|
|
|
|
|
*
|
|
|
|
|
* @return @true when tuning scale loaded OK,
|
|
|
|
|
* @false if some error occurred.
|
2020-05-19 14:51:33 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API bool sfizz_load_scala_file(sfizz_synth_t* synth, const char* path);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Sets the tuning from a Scala file loaded from memory.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-19 14:51:33 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param text The contents of the file in Scala format.
|
|
|
|
|
*
|
|
|
|
|
* @return @true when tuning scale loaded OK,
|
|
|
|
|
* @false if some error occurred.
|
2020-05-19 14:51:33 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API bool sfizz_load_scala_string(sfizz_synth_t* synth, const char* text);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Sets the scala root key.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-19 14:51:33 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param root_key The MIDI number of the Scala root key (default 60 for C4).
|
2020-05-19 14:51:33 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_scala_root_key(sfizz_synth_t* synth, int root_key);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Gets the scala root key.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-19 14:51:33 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
*
|
|
|
|
|
* @return The MIDI number of the Scala root key (default 60 for C4).
|
2020-05-19 14:51:33 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_scala_root_key(sfizz_synth_t* synth);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Sets the reference tuning frequency.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-19 14:51:33 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param frequency The frequency which indicates where standard tuning A4 is (default 440 Hz).
|
2020-05-19 14:51:33 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_tuning_frequency(sfizz_synth_t* synth, float frequency);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Gets the reference tuning frequency.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-05-19 14:51:33 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
*
|
|
|
|
|
* @return The frequency which indicates where standard tuning A4 is (default 440 Hz).
|
2020-05-19 14:51:33 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API float sfizz_get_tuning_frequency(sfizz_synth_t* synth);
|
|
|
|
|
|
2020-06-11 22:22:47 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Configure stretch tuning using a predefined parametric Railsback curve.
|
|
|
|
|
*
|
|
|
|
|
* A ratio 1/2 is supposed to match the average piano; 0 disables (the default).
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-06-11 22:22:47 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param ratio The parameter in domain 0-1.
|
2020-06-11 22:22:47 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_load_stretch_tuning_by_ratio(sfizz_synth_t* synth, float ratio);
|
|
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of regions in the currently loaded SFZ file.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_regions(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of groups in the currently loaded SFZ file.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_groups(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of masters in the currently loaded SFZ file.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_masters(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of curves in the currently loaded SFZ file.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_curves(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2020-02-25 11:30:34 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Export a MIDI Name document describing the currently loaded SFZ file.
|
|
|
|
|
* @since 0.3.1
|
2020-02-25 11:30:34 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param model The model name used if a non-empty string, otherwise generated.
|
2020-02-25 11:30:34 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @return A newly allocated XML string, which must be freed after use.
|
2020-02-25 11:30:34 +01:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API char* sfizz_export_midnam(sfizz_synth_t* synth, const char* model);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of preloaded samples for the current SFZ file.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API size_t sfizz_get_num_preloaded_samples(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of active voices.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* 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.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_active_voices(sfizz_synth_t* synth);
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief 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.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param samples_per_block The number of samples per block.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_samples_per_block(sfizz_synth_t* synth, int samples_per_block);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Set the sample rate for the synth.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* This is the output sample rate. This setting does not affect the internal processing.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth
|
|
|
|
|
* @param sample_rate The sample rate.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_sample_rate(sfizz_synth_t* synth, float sample_rate);
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send a note on event to the synth.
|
|
|
|
|
*
|
|
|
|
|
* As with all MIDI events, this needs to happen before the call to
|
|
|
|
|
* sfizz_render_block() in each block and should appear in order of the delays.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay of the event in the block, in samples.
|
|
|
|
|
* @param note_number The MIDI note number.
|
|
|
|
|
* @param velocity The MIDI velocity.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_note_on(sfizz_synth_t* synth, int delay, int note_number, char velocity);
|
2019-11-17 21:37:00 +01:00
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send a note off event to the synth.
|
|
|
|
|
*
|
|
|
|
|
* As with all MIDI events, this needs to happen before the call to
|
|
|
|
|
* sfizz_render_block() in each block and should appear in order of the delays.
|
|
|
|
|
* As per the SFZ spec the velocity of note-off events is usually replaced by
|
|
|
|
|
* the note-on velocity.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay of the event in the block, in samples.
|
|
|
|
|
* @param note_number The MIDI note number.
|
|
|
|
|
* @param velocity The MIDI velocity.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_note_off(sfizz_synth_t* synth, int delay, int note_number, char velocity);
|
2019-11-17 21:37:00 +01:00
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send a CC event to the synth.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* As with all MIDI events, this needs to happen before the call to
|
|
|
|
|
* sfizz_render_block() in each block and should appear in order of the delays.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay of the event in the block, in samples.
|
|
|
|
|
* @param cc_number The MIDI CC number.
|
|
|
|
|
* @param cc_value The MIDI CC value.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_cc(sfizz_synth_t* synth, int delay, int cc_number, char cc_value);
|
2020-04-07 18:42:41 +02:00
|
|
|
|
2020-05-17 18:06:25 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send a high precision CC event to the synth.
|
|
|
|
|
*
|
|
|
|
|
* As with all MIDI events, this needs to happen before the call to
|
|
|
|
|
* sfizz_render_block() in each block and should appear in order of the delays.
|
|
|
|
|
* @since 0.4.0
|
2020-05-17 18:06:25 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay of the event in the block, in samples.
|
|
|
|
|
* @param cc_number The MIDI CC number.
|
|
|
|
|
* @param norm_value The normalized CC value, in domain 0 to 1.
|
2020-05-17 18:06:25 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_hdcc(sfizz_synth_t* synth, int delay, int cc_number, float norm_value);
|
|
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send a pitch wheel event.
|
|
|
|
|
*
|
|
|
|
|
* As with all MIDI events, this needs to happen before the call to
|
|
|
|
|
* sfizz_render_block() in each block and should appear in order of the delays.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay.
|
|
|
|
|
* @param pitch The pitch.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_pitch_wheel(sfizz_synth_t* synth, int delay, int pitch);
|
2019-11-17 21:37:00 +01:00
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send an aftertouch event. (CURRENTLY UNIMPLEMENTED)
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay at which the event occurs; this should be lower
|
|
|
|
|
* than the size of the block in the next call to renderBlock().
|
|
|
|
|
* @param aftertouch The aftertouch value.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_aftertouch(sfizz_synth_t* synth, int delay, char aftertouch);
|
2019-11-17 21:37:00 +01:00
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send a tempo event.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay.
|
|
|
|
|
* @param seconds_per_beat The seconds per beat.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-08-11 15:31:23 +02:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_tempo(sfizz_synth_t* synth, int delay, float seconds_per_beat);
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send the time signature.
|
|
|
|
|
* @since 0.4.1
|
2020-08-11 15:31:23 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay.
|
|
|
|
|
* @param beats_per_bar The number of beats per bar, or time signature numerator.
|
|
|
|
|
* @param beat_unit The note corresponding to one beat, or time signature denominator.
|
2020-08-11 15:31:23 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_time_signature(sfizz_synth_t* synth, int delay, int beats_per_bar, int beat_unit);
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send the time position.
|
|
|
|
|
* @since 0.4.1
|
2020-08-11 15:31:23 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay.
|
|
|
|
|
* @param bar The current bar.
|
|
|
|
|
* @param bar_beat The fractional position of the current beat within the bar.
|
2020-08-11 15:31:23 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_time_position(sfizz_synth_t* synth, int delay, int bar, float bar_beat);
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Send the playback state.
|
|
|
|
|
* @since 0.4.1
|
2020-08-11 15:31:23 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param delay The delay.
|
|
|
|
|
* @param playback_state The playback state, 1 if playing, 0 if stopped.
|
2020-08-11 15:31:23 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_send_playback_state(sfizz_synth_t* synth, int delay, int playback_state);
|
|
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Render a block audio data into a stereo channel.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* 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.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param channels Pointers to the left and right channel of the output.
|
|
|
|
|
* @param num_channels Should be equal to 2 for the time being.
|
|
|
|
|
* @param num_frames Number of frames to fill. This should be less than
|
|
|
|
|
* or equal to the expected samples_per_block.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_render_block(sfizz_synth_t* synth, float** channels, int num_channels, int num_frames);
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2019-11-17 21:37:00 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Get the size of the preloaded data.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* This returns the number of floats used in the preloading buffers.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2019-12-01 23:17:50 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API unsigned int sfizz_get_preload_size(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-12-01 23:17:50 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief 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.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-04-07 18:42:41 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param[in] preload_size The preload size.
|
2019-11-17 21:37:00 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_preload_size(sfizz_synth_t* synth, unsigned int preload_size);
|
2019-11-17 09:04:42 +01:00
|
|
|
|
2019-11-20 22:13:56 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Get the internal oversampling rate.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* This is the sampling rate of the engine, not the output or expected rate of
|
|
|
|
|
* the calling function. For the latter use the sfizz_get_sample_rate() function.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2019-12-01 23:17:50 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API sfizz_oversampling_factor_t sfizz_get_oversampling_factor(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-12-01 23:17:50 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Set the internal oversampling rate.
|
|
|
|
|
*
|
|
|
|
|
* This is the sampling rate of the engine, not the output or expected rate of
|
|
|
|
|
* the calling function. For the latter use the sfizz_set_sample_rate() function.
|
|
|
|
|
*
|
|
|
|
|
* Increasing this value (up to x8 oversampling) improves the quality of the
|
|
|
|
|
* output at the expense of memory consumption and background loading speed.
|
|
|
|
|
* The main render path still uses the same linear interpolation algorithm and
|
|
|
|
|
* should not see its performance decrease, but the files are oversampled upon
|
|
|
|
|
* loading which increases the stress on the background loader and reduce
|
|
|
|
|
* the loading speed. You can tweak the size of the preloaded data to compensate
|
|
|
|
|
* for the memory increase, but the full loading will need to take place anyway.
|
|
|
|
|
*
|
|
|
|
|
* This function takes a lock and disables the callback; prefer calling it out
|
|
|
|
|
* of the RT thread. It can also take a long time to return.
|
|
|
|
|
* If the new oversampling factor is the same as the current one, it will
|
|
|
|
|
* release the lock immediately and exit.
|
|
|
|
|
* @since 0.2.0
|
2020-05-13 22:10:02 +02:00
|
|
|
*
|
2020-04-07 18:42:41 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param[in] oversampling The oversampling factor.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @return @true if the oversampling factor was correct, @false otherwise.
|
2019-12-01 23:17:50 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API bool sfizz_set_oversampling_factor(sfizz_synth_t* synth, sfizz_oversampling_factor_t oversampling);
|
2019-12-01 23:17:50 +01:00
|
|
|
|
2020-06-11 13:51:37 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Get the default resampling quality.
|
|
|
|
|
*
|
|
|
|
|
* This is the quality setting which the engine uses when the instrument
|
|
|
|
|
* does not use the opcode `sample_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.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-06-11 13:51:37 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param[in] mode The processing mode.
|
2020-06-11 13:51:37 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @return The sample quality for the given mode, in the range 1 to 10.
|
2020-06-11 13:51:37 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_sample_quality(sfizz_synth_t* synth, sfizz_process_mode_t mode);
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Set the default resampling quality.
|
|
|
|
|
*
|
|
|
|
|
* This is the quality setting which the engine uses when the instrument
|
|
|
|
|
* does not use the opcode `sample_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.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-06-11 13:51:37 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param[in] mode The processing mode.
|
|
|
|
|
* @param[in] quality The desired sample quality, in the range 1 to 10.
|
2020-06-11 13:51:37 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_sample_quality(sfizz_synth_t* synth, sfizz_process_mode_t mode, int quality);
|
|
|
|
|
|
2019-12-01 23:17:50 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Set the global instrument volume.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param volume The new volume.
|
2019-11-20 22:13:56 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_volume(sfizz_synth_t* synth, float volume);
|
2019-11-20 22:13:56 +01:00
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the global instrument volume.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-20 22:13:56 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API float sfizz_get_volume(sfizz_synth_t* synth);
|
2019-11-20 22:13:56 +01:00
|
|
|
|
2019-11-20 22:35:51 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Set the number of voices used by the synth.
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* This function takes a lock and disables the callback; prefer calling
|
|
|
|
|
* it out of the RT thread. It can also take a long time to return.
|
|
|
|
|
* If the new number of voices is the same as the current one, it will
|
|
|
|
|
* release the lock immediately and exit.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param num_voices The number of voices.
|
2019-11-20 22:35:51 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_num_voices(sfizz_synth_t* synth, int num_voices);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-11-20 22:35:51 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of voices.
|
|
|
|
|
* @since 0.2.0
|
2019-12-01 23:17:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-11-20 22:35:51 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_voices(sfizz_synth_t* synth);
|
2019-11-20 22:35:51 +01:00
|
|
|
|
2019-12-02 12:24:34 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return the number of allocated buffers from the synth.
|
|
|
|
|
* @since 0.2.0
|
2019-12-02 12:24:34 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-12-02 12:24:34 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_buffers(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-12-02 12:24:34 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Get the number of bytes allocated from the synth.
|
2019-12-02 12:24:34 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* Note that this value can be less than the actual memory usage since it only
|
|
|
|
|
* counts the buffer objects managed by sfizz.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2019-12-02 12:24:34 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_num_bytes(sfizz_synth_t* synth);
|
2019-12-02 12:24:34 +01:00
|
|
|
|
2019-12-08 21:43:15 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Enable freewheeling on the synth.
|
|
|
|
|
* @since 0.2.0
|
2019-12-08 21:43:15 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-12-08 21:43:15 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_enable_freewheeling(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-12-08 21:43:15 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Disable freewheeling on the synth.
|
|
|
|
|
* @since 0.2.0
|
2019-12-08 21:43:15 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2019-12-08 21:43:15 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API void sfizz_disable_freewheeling(sfizz_synth_t* synth);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2019-12-08 21:43:15 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Return a comma separated list of unknown opcodes.
|
2019-12-08 21:43:15 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* The caller has to free() the string returned. This function allocates memory,
|
|
|
|
|
* do not call on the audio thread.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2019-12-08 21:43:15 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API char* sfizz_get_unknown_opcodes(sfizz_synth_t* synth);
|
2019-12-27 18:41:26 +01:00
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Check if the SFZ should be reloaded.
|
2019-12-27 18:41:26 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* Depending on the platform this can create file descriptors.
|
|
|
|
|
* @since 0.2.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2019-12-27 18:41:26 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @return @true if any included files (including the root file)
|
|
|
|
|
have been modified since the sfz file was loaded, @false otherwise.
|
2019-12-27 18:41:26 +01:00
|
|
|
*/
|
2020-01-18 17:32:30 +01:00
|
|
|
SFIZZ_EXPORTED_API bool sfizz_should_reload_file(sfizz_synth_t* synth);
|
2019-12-27 18:41:26 +01:00
|
|
|
|
2020-05-29 16:24:53 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Check if the scala file should be reloaded.
|
2020-05-29 16:24:53 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* Depending on the platform this can create file descriptors.
|
|
|
|
|
* @since 0.4.0
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2020-05-29 16:24:53 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @return @true if the scala file has been modified since loading.
|
2020-05-29 16:24:53 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API bool sfizz_should_reload_scala(sfizz_synth_t* synth);
|
|
|
|
|
|
2020-02-18 16:16:24 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Enable logging of timings to sidecar CSV files.
|
|
|
|
|
* @since 0.3.0
|
2020-02-18 16:16:24 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @note This can produce many outputs so use with caution.
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2020-02-18 16:16:24 +01:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_enable_logging(sfizz_synth_t* synth);
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Disable logging.
|
|
|
|
|
* @since 0.3.0
|
2020-02-18 16:16:24 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2020-02-18 16:16:24 +01:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_disable_logging(sfizz_synth_t* synth);
|
|
|
|
|
|
2020-03-26 23:15:50 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Enable logging of timings to sidecar CSV files.
|
|
|
|
|
* @since 0.3.2
|
2020-03-26 23:15:50 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @note This can produce many outputs so use with caution.
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param prefix The prefix.
|
2020-03-26 23:15:50 +01:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_set_logging_prefix(sfizz_synth_t* synth, const char* prefix);
|
|
|
|
|
|
2020-03-15 23:16:40 +01:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Shuts down the current processing, clear buffers and reset the voices.
|
|
|
|
|
* @since 0.3.2
|
2020-03-15 23:16:40 +01:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2020-03-15 23:16:40 +01:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_all_sound_off(sfizz_synth_t* synth);
|
|
|
|
|
|
2020-04-07 01:06:39 +02:00
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Add external definitions prior to loading.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-07 01:06:39 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @note These do not get reset by loading or resetting the synth.
|
|
|
|
|
* You need to call sfizz_clear_external_definitions() to erase them.
|
|
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param id The definition variable name.
|
|
|
|
|
* @param value The definition value.
|
2020-04-07 01:06:39 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_add_external_definitions(sfizz_synth_t* synth, const char* id, const char* value);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Clears external definitions for the next file loading.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-07 01:06:39 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2020-04-07 01:06:39 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API void sfizz_clear_external_definitions(sfizz_synth_t* synth);
|
|
|
|
|
|
2020-09-05 16:14:51 +02:00
|
|
|
/**
|
|
|
|
|
* @brief Index out of bound error for the requested CC/key label.
|
|
|
|
|
* @since 0.4.0
|
|
|
|
|
*/
|
2020-04-08 12:57:03 +02:00
|
|
|
#define SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX -1
|
|
|
|
|
|
|
|
|
|
/**
|
2020-09-05 16:14:51 +02:00
|
|
|
* @brief Get the number of key labels registered in the current sfz file.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-09-05 16:14:51 +02:00
|
|
|
*
|
|
|
|
|
* @param synth The synth.
|
2020-04-08 12:57:03 +02:00
|
|
|
*/
|
2020-04-15 18:04:02 +02:00
|
|
|
SFIZZ_EXPORTED_API unsigned int sfizz_get_num_key_labels(sfizz_synth_t* synth);
|
2020-04-08 12:57:03 +02:00
|
|
|
|
|
|
|
|
/**
|
2020-04-15 18:04:02 +02:00
|
|
|
* @brief Get the key number for the label registered at index label_index.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-08 12:57:03 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param label_index The label index.
|
|
|
|
|
*
|
2020-04-08 14:00:40 +02:00
|
|
|
* @returns the number or SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX if the index is out of bounds.
|
2020-04-08 12:57:03 +02:00
|
|
|
*/
|
2020-04-15 18:04:02 +02:00
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_key_label_number(sfizz_synth_t* synth, int label_index);
|
2020-04-08 12:57:03 +02:00
|
|
|
|
|
|
|
|
/**
|
2020-04-15 18:04:02 +02:00
|
|
|
* @brief Get the key text for the label registered at index label_index.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-08 12:57:03 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param label_index The label index.
|
|
|
|
|
*
|
|
|
|
|
* @returns the label or @null if the index is out of bounds.
|
2020-04-08 12:57:03 +02:00
|
|
|
*/
|
2020-04-15 18:04:02 +02:00
|
|
|
SFIZZ_EXPORTED_API const char * sfizz_get_key_label_text(sfizz_synth_t* synth, int label_index);
|
2020-04-08 12:57:03 +02:00
|
|
|
|
|
|
|
|
/**
|
2020-04-15 18:04:02 +02:00
|
|
|
* @brief Get the number of CC labels registered in the current sfz file
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-08 12:57:03 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
2020-04-08 12:57:03 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API unsigned int sfizz_get_num_cc_labels(sfizz_synth_t* synth);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief Get the CC number for the label registered at index label_index.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-08 12:57:03 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param label_index The label index.
|
|
|
|
|
*
|
2020-04-08 14:00:40 +02:00
|
|
|
* @returns the number or SFIZZ_OUT_OF_BOUNDS_LABEL_INDEX if the index is out of bounds.
|
2020-04-08 12:57:03 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API int sfizz_get_cc_label_number(sfizz_synth_t* synth, int label_index);
|
2020-09-05 16:14:51 +02:00
|
|
|
|
2020-04-08 12:57:03 +02:00
|
|
|
/**
|
|
|
|
|
* @brief Get the CC text for the label registered at index label_index.
|
2020-07-06 14:38:43 +02:00
|
|
|
* @since 0.4.0
|
2020-04-08 12:57:03 +02:00
|
|
|
*
|
2020-09-05 16:14:51 +02:00
|
|
|
* @param synth The synth.
|
|
|
|
|
* @param label_index The label index.
|
|
|
|
|
*
|
|
|
|
|
* @returns the label or @null if the index is out of bounds.
|
2020-04-08 12:57:03 +02:00
|
|
|
*/
|
|
|
|
|
SFIZZ_EXPORTED_API const char * sfizz_get_cc_label_text(sfizz_synth_t* synth, int label_index);
|
|
|
|
|
|
2019-11-17 09:04:42 +01:00
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
2019-12-01 23:17:50 +01:00
|
|
|
#endif
|