diff -r 000000000000 -r dcdd12e654da sysex2smf.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/sysex2smf.cpp Tue May 19 22:56:20 2020 +0200
@@ -0,0 +1,42 @@
+/**
+ * SysEx to SMF convertor
+ * Copyright © 2020 František Kučera (Frantovo.cz, GlobalCode.info)
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, version 3 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
+ */
+#include
+#include
+#include
+
+int main(int argc, char**argv) {
+ if (argc == 2) {
+ smf_t* smf = smf_new();
+ smf_track_t* track = smf_track_new();
+ smf_add_track(smf, track);
+
+ std::stringstream data;
+ for (char ch; std::cin.read(&ch, 1).good();) {
+ data.put(ch);
+ }
+
+ smf_event_t* event = smf_event_new_from_pointer((void*) data.str().c_str(), data.tellp());
+ smf_track_add_event_pulses(track, event, 0);
+
+
+ int res = smf_save(smf, argv[1]);
+ if (res) std::cerr << "unable to save MIDI file: " << res << std::endl;
+ smf_delete(smf);
+ } else {
+ std::cerr << "Usage: " << argv[0] << " 'output-file.mid'" << std::endl;
+ }
+}