Move the manufacturer and model to Config

This commit is contained in:
Jean Pierre Cimalando 2020-02-26 15:27:44 +01:00
parent 30b579feb4
commit 633159c5e1
2 changed files with 9 additions and 6 deletions

View file

@ -12,6 +12,7 @@
#endif
#define _SILENCE_CXX17_OLD_ALLOCATOR_MEMBERS_DEPRECATION_WARNING
#endif
#include "absl/strings/string_view.h"
#include <cstddef>
#include <cstdint>
@ -62,6 +63,11 @@ namespace config {
modulated filter. The lower, the more CPU resources are consumed.
*/
constexpr int filterControlInterval { 16 };
/**
Default metadata for MIDIName documents
*/
const absl::string_view midnamManufacturer { "The Sfizz authors" };
const absl::string_view midnamModel { "Sfizz" };
} // namespace config
// Enable or disable SIMD accelerators by default

View file

@ -581,13 +581,10 @@ int sfz::Synth::getNumCurves() const noexcept
std::string sfz::Synth::exportMidnam(absl::string_view model) const
{
pugi::xml_document doc;
// TODO: perhaps define this somewhere, or use some metadata from the SFZ
const char *manufacturer = "Paul Ferrand";
const char *defaultModel = "Sfizz";
absl::string_view manufacturer = config::midnamManufacturer;
if (model.empty())
model = defaultModel;
model = config::midnamModel;
doc.append_child(pugi::node_doctype).set_value(
"MIDINameDocument PUBLIC"
@ -603,7 +600,7 @@ std::string sfz::Synth::exportMidnam(absl::string_view model) const
pugi::xml_node device = root.append_child("MasterDeviceNames");
device.append_child("Manufacturer")
.append_child(pugi::node_pcdata).set_value(manufacturer);
.append_child(pugi::node_pcdata).set_value(std::string(manufacturer).c_str());
device.append_child("Model")
.append_child(pugi::node_pcdata).set_value(std::string(model).c_str());