zero_pad   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/contrib/TSM_library.xtm

Implementation

;creates a copy of the input buffer and pads with zeros
(bind-func zero_pad
  (lambda (buffer:float* buffer_size:i64 padded_buffer:float* padded_size:i64)
    (let ((n:i64 0))
      (dotimes (n padded_size)
        (cond ((< n buffer_size)
                (pset! padded_buffer n (pref buffer n)))
              (else
                (pset! padded_buffer n 0.0))))
      void)))


Back to Index

Similar Entries