Open dpwe opened 3 months ago
Would it make sense to also compress the remaining fields to uint16_t fixed-point values too? It would still be easy to get back to the original floating point values at runtime, with a relatively minor loss of precision.
I mean, something like this:
The partials oscillator stores each set of partial trajectories by a sequence of
partial_breakpoint_t
elements inpartial_breakpoints[]
. The last three elements of apartial_breakpoint_t
arems_delta, amp_delta, freq_delta
, which are redundant with thems_offset, amp
andfreq
of the next breakpoint entry for that oscillator (specifically,ms_delta
is the increment in thems_offset
, andamp_delta
andfreq_delta
are multiplicative scales to transform the currentamp
andfreq
into the next ones).We could save three fields for each breakpoint entry by, instead, scanning ahead to the next entry for the current oscillator, reading its
ms_offset, amp, freq
, and calculating the deltas on-the-fly. This would also simplify adding partials, since the partial-construction system would not have to calculate the deltas.