Commit graph

7 commits

Author SHA1 Message Date
Paul Davis
65332e603b libsmf: speed up ridiculous design of smf_save()
This would realloc a buffer for every event, making it absurdly slow for
large MIDI files (say, 10k events). Use the somewhat standard heuristic
of doubling the requested allocation every time we need to increase the size.

This results in a speedup of 40-100x when saving SMF to disk
2025-11-17 16:05:03 -07:00
Paul Davis
0d9656ef82 use new macros to cleanup #ifndef NDEBUG as much as possible (libs edition) 2022-06-22 13:31:08 -06:00
Paul Davis
9b80d6558a fix optimized unused variable warning 2022-06-22 13:31:08 -06:00
Robin Gareus
c6b87972b1
Remove unused libsmf seconds/time API
This significantly speeds up parsing MIDI files with complex
tempo-maps. e.g. "Black MIDI Trilogy_2.mid" has 24134 Tempo
changes. Prior to this commit parsing that file took over 5 minutes.
now it loads in under one seconds (libsmf only; libardour still
add overhead, and now needs about 30-40 seconds, previously
it took about 10 mins).

The problem was that every call to `smf_track_add_event_pulses()`
calls `seconds_from_pulses()` which calls `smf_get_tempo_by_seconds()`
which iterates over the tempo-map:

  for every midi-event { for ever tempo until that midi-event {..} }

This does not scale to 3.5M events and 24k tempo-changes.
2020-07-16 18:38:03 +02:00
Robin Gareus
43158047ed
SMF: use glib macros for endian conversion 2020-07-16 17:57:59 +02:00
David Robillard
39bdde4250 Use labs() for long instead of abs() 2019-12-09 23:25:51 +01:00
Paul Davis
eaae38ba84 move evoral/src/* to evoral/ 2019-11-02 16:32:18 -06:00
Renamed from libs/evoral/src/libsmf/smf_save.c (Browse further)