13
0

unused but slightly tricky code to add track name/instrument to an SMF file when saved

This commit is contained in:
Paul Davis 2016-12-15 17:23:44 +00:00
parent 76dca432f0
commit fe0761d404

View File

@ -382,6 +382,32 @@ write_track(smf_track_t *track)
if (ret)
return (ret);
if (track->name) {
printf ("save track name [%s]\n", track->name);
smf_event_t *ev = smf_event_new_textual (0x03, track->name);
ev->delta_time_pulses = 0; /* time zero */
ev->track = track;
ret = write_event (ev);
ev->track = 0;
smf_event_delete (ev);
if (ret) {
return ret;
}
}
if (track->instrument) {
printf ("save track instrument [%s]\n", track->instrument);
smf_event_t *ev = smf_event_new_textual (0x04, track->instrument);
ev->delta_time_pulses = 0; /* time zero */
ev->track = track;
ret = write_event (ev);
ev->track = 0;
smf_event_delete (ev);
if (ret) {
return ret;
}
}
while ((event = smf_track_get_next_event(track)) != NULL) {
ret = write_event(event);
if (ret)