2021-04-15 22:25:17 +02:00
|
|
|
// SPDX-License-Identifier: BSD-2-Clause
|
|
|
|
|
|
|
|
|
|
// 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
|
|
|
|
|
|
|
|
|
|
#include "sfizz.h"
|
|
|
|
|
#include "sfizz.hpp"
|
|
|
|
|
#include "catch2/catch.hpp"
|
|
|
|
|
#include "ghc/fs_std.hpp"
|
|
|
|
|
|
|
|
|
|
TEST_CASE("[Bindings] Midnam C++")
|
|
|
|
|
{
|
|
|
|
|
sfz::Sfizz synth;
|
|
|
|
|
const auto path = fs::current_path() / "tests/TestFiles/labels.sfz";
|
|
|
|
|
synth.loadSfzFile(path.string());
|
|
|
|
|
const std::string xmlMidnam = synth.exportMidnam("");
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Note Number=\"12\" Name=\"Cymbals\" />") != xmlMidnam.npos);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Note Number=\"65\" Name=\"Crash\" />") != xmlMidnam.npos);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Control Type=\"7bit\" Number=\"54\" Name=\"Gain\" />") != xmlMidnam.npos);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Control Type=\"7bit\" Number=\"2\" Name=\"Other\" />") != xmlMidnam.npos);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TEST_CASE("[Bindings] Midnam C")
|
|
|
|
|
{
|
|
|
|
|
sfizz_synth_t* synth = sfizz_create_synth();
|
|
|
|
|
const auto path = fs::current_path() / "tests/TestFiles/labels.sfz";
|
|
|
|
|
const auto strPath = path.string();
|
|
|
|
|
sfizz_load_file(synth, strPath.c_str());
|
|
|
|
|
char* midnamChar = sfizz_export_midnam(synth, "");
|
|
|
|
|
const std::string xmlMidnam = std::string(midnamChar);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Note Number=\"12\" Name=\"Cymbals\" />") != xmlMidnam.npos);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Note Number=\"65\" Name=\"Crash\" />") != xmlMidnam.npos);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Control Type=\"7bit\" Number=\"54\" Name=\"Gain\" />") != xmlMidnam.npos);
|
|
|
|
|
REQUIRE(xmlMidnam.find("<Control Type=\"7bit\" Number=\"2\" Name=\"Other\" />") != xmlMidnam.npos);
|
2021-04-16 01:19:05 +02:00
|
|
|
sfizz_free_memory(midnamChar);
|
2021-04-15 22:25:17 +02:00
|
|
|
sfizz_free(synth);
|
|
|
|
|
}
|