This adds both a midi generator and a midi type 1 simulator. While I would have preferred to use an existing tool for this, I found that timidity++ does not emit pitch wheel events correctly, and I don't know of another widely-distributed tool that does midi-to-midi format conversion. The c++ and python versions were co-developed. I wrote one to test the other. There is more cleanup to do, but `roundtrip.cpp` produces a valid type 0 midi file given a type 1 or type 0 midi file as input.
24 lines
369 B
C++
24 lines
369 B
C++
#pragma once
|
|
|
|
#include <string>
|
|
#include <cassert>
|
|
|
|
#include "midi.hpp"
|
|
|
|
namespace midi {
|
|
namespace strings {
|
|
|
|
constexpr inline std::string
|
|
header_format(header_t::format_t format)
|
|
{
|
|
switch (format) {
|
|
case header_t::format_t::_0: return "0";
|
|
case header_t::format_t::_1: return "1";
|
|
case header_t::format_t::_2: return "2";
|
|
default: assert(false);
|
|
}
|
|
}
|
|
|
|
}
|
|
}
|