SIGN IN SIGN UP

Synth reblocking and upsampling (#7402)

* scsynth: use common function for s_new and s_newargs command

* implement Synth reblocking and upsampling

- SynthDef: add block size value, block size index, resample value and resample index fields
  if the block size resp. resample value is negative, the value will be taken from the control specified by the index field.
  The latter is not supported by Supernova yet, due to the way Synths are constructed.

- ClassLibrary: Add Reblock() and Resample() objects that allow to set the block size resp. resample factor.
  The input can be a constant or a Control.

- Graph now has its own Rate* members;
  if the Graph should be reblocked or upsampled, it allocates its own Rate objects,
  otherwise they point to the global World Rate objects.

- the FULLRATE, FULLBUFLENGTH etc. macros now use mParent->mFullRate instead of mWorld->mFullRate,
  so that UGens automatically use the *local* sample rate and block size in case the Graph
  is reblocked or upsampled. UGens *must* use these macros to work correctly with reblocking/upsampling.

- Graph has maintains a sub-tick count so that UGens can know the current phase.
  This is only relevant for UGens that deal with audio or control busses;
  all other UGens simply run at the higher sample rate and/or the lower block size
  because they just use wire buffers.

- IOUGens do the actual reblocking and up/downsampling from/to audio or control busses.
  Special care must be taken regarding buffer touching. Some UGens like AudioControl, In or FeedbackIn
  save the buffer timestamp on the first tick and use the value for the remaining ticks.

- LocalIn/LocalOut works like "normal" UGens, except that it needs to maintain its own tick counter

* improve AudioBusGuard

make everything private and add isValid() method.

Also remove wrong uint32 cast in IO_a_update_channels.

* AudioControl: check if bus guard is valid

* add Unit tests for reblocking and resampling

test every single IOUGen with two channels and with either resampling or reblocking.
The output of resampled resp. reblocked Synth must match the output of the "normal" Synth.
C
Christof Ressi committed
a27ec6c01ac78fba2967c136ba8cfc94414d1c61
Parent: d0d7aa7
Committed by GitHub <noreply@github.com> on 4/24/2026, 5:45:20 PM