Open umlaeute opened 6 days ago
btw, my expectation would have been that i could freely switch the tracks while writing, in order to e.g. record drums and piano simultaneously (into different tracks)
Without looking at the code, I think it's a state mechanism:
I would think only allowing one track at a time would be severely limiting. Ideally, I could write multiple tracks per tick.
well, yes; that's what i expect as well.
it seems like it doesn't work like this though.
my fix would be:
diff --git a/midifile.c b/midifile.c
index 65a427d..bbb84e2 100644
--- a/midifile.c
+++ b/midifile.c
@@ -1417,7 +1417,7 @@ static void midifile_set_track(t_midifile *x, t_floatarg track)
else
{
x->track = track; // possibly update x->header_chunk.chunk_ntrks
- if (x->track_chunk[x->track].track_data == NULL)
+ if (x->tmpFP[x->track] == NULL)
{
/* this track is being used for the first time */
post("this track (%d) is being used for the first time", x->track);
(but otoh, i would really like to get rid of these tempfiles altogether (see #7))
Yeah, we don't need temp files. MIDI data is so compact, I can't imagine memory pressure being an issue.
it seems that writing tracks is seriously broken.
most importantly, https://github.com/pd-externals/midifile/blob/95354384c269ae2c849fe710c0c13570de5c1656/midifile.c#L1420-L1424 will always be
true
(becausex->track_chunk[x->track].track_data
is nowhere used when writing data), and thus the tempfiles are cleared whenever atrack
message is sent (during writing).i'm not a frequent user of
[midifile]
, so i might miss something. otherwise i have a simple fix at handafaict, this might be related to one of the subitems of #3