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.
23 lines
330 B
C++
23 lines
330 B
C++
#pragma once
|
|
|
|
#include <cstdint>
|
|
|
|
#include "midi.hpp"
|
|
|
|
namespace midi {
|
|
namespace generate {
|
|
|
|
using buf_t = uint8_t *;
|
|
|
|
buf_t
|
|
header(buf_t buf, const header_t& header) noexcept;
|
|
|
|
buf_t
|
|
track(buf_t buf, const track_t& track) noexcept;
|
|
|
|
buf_t
|
|
mtrk_event(buf_t buf, const mtrk_event_t& event, uint8_t& running_status) noexcept;
|
|
|
|
}
|
|
}
|