Added an external API for the external definitions
This commit is contained in:
parent
4e7f15328a
commit
75c898d50c
4 changed files with 56 additions and 0 deletions
19
src/sfizz.h
19
src/sfizz.h
|
|
@ -394,6 +394,25 @@ SFIZZ_EXPORTED_API void sfizz_set_logging_prefix(sfizz_synth_t* synth, const cha
|
||||||
*/
|
*/
|
||||||
SFIZZ_EXPORTED_API void sfizz_all_sound_off(sfizz_synth_t* synth);
|
SFIZZ_EXPORTED_API void sfizz_all_sound_off(sfizz_synth_t* synth);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add external definitions prior to loading;
|
||||||
|
* Note that these do not get reset by loading or resetting the synth.
|
||||||
|
* You need to call sfizz_clear_external_definitions() to erase them.
|
||||||
|
*
|
||||||
|
* @param synth
|
||||||
|
* @param id
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
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.
|
||||||
|
*
|
||||||
|
* @param synth
|
||||||
|
*/
|
||||||
|
SFIZZ_EXPORTED_API void sfizz_clear_external_definitions(sfizz_synth_t* synth);
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -284,6 +284,21 @@ public:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
void allSoundOff() noexcept;
|
void allSoundOff() noexcept;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Add external definitions prior to loading;
|
||||||
|
* Note that these do not get reset by loading or resetting the synth.
|
||||||
|
* You need to call clearExternalDefintions() to erase them.
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
|
void addExternalDefinition(const std::string& id, const std::string& value);
|
||||||
|
/**
|
||||||
|
* @brief Clears external definitions for the next file loading.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
void clearExternalDefinitions();
|
||||||
private:
|
private:
|
||||||
std::unique_ptr<sfz::Synth> synth;
|
std::unique_ptr<sfz::Synth> synth;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -210,3 +210,13 @@ void sfz::Sfizz::allSoundOff() noexcept
|
||||||
{
|
{
|
||||||
synth->allSoundOff();
|
synth->allSoundOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sfz::Sfizz::addExternalDefinition(const std::string& id, const std::string& value)
|
||||||
|
{
|
||||||
|
synth->getParser().addExternalDefinition(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sfz::Sfizz::clearExternalDefinitions()
|
||||||
|
{
|
||||||
|
synth->getParser().clearExternalDefinitions();
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -256,6 +256,18 @@ void sfizz_all_sound_off(sfizz_synth_t* synth)
|
||||||
return self->allSoundOff();
|
return self->allSoundOff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void sfizz_add_external_definitions(sfizz_synth_t* synth, const char* id, const char* value)
|
||||||
|
{
|
||||||
|
auto self = reinterpret_cast<sfz::Synth*>(synth);
|
||||||
|
self->getParser().addExternalDefinition(id, value);
|
||||||
|
}
|
||||||
|
|
||||||
|
void sfizz_clear_external_definitions(sfizz_synth_t* synth)
|
||||||
|
{
|
||||||
|
auto self = reinterpret_cast<sfz::Synth*>(synth);
|
||||||
|
self->getParser().clearExternalDefinitions();
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue