AudioBuffer_concat   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/core/audiobuffer.xtm

Implementation

(bind-func AudioBuffer_concat
  (lambda (ab1:AudioBuffer* ab2:AudioBuffer*)
    (if (or (<> (AudioBuffer_samplerate ab1) (AudioBuffer_samplerate ab2))
            (<> (AudioBuffer_channels ab1) (AudioBuffer_channels ab2)))
        (begin (println "Error: cannot concat incompatible audiobuffers") null) ;; return null on error!
        (let ((new (AudioBuffer (+ (AudioBuffer_frames ab1) (AudioBuffer_frames ab2))
                                (AudioBuffer_channels ab1)
                                (AudioBuffer_samplerate ab1)))
              (dat1 (AudioBuffer_ptr new 0 0))
              (dat2 (AudioBuffer_ptr new (AudioBuffer_frames ab1) 0)))
          (memcpy (cast dat1) (cast (AudioBuffer_ptr ab1 0 0)) (* (AudioBuffer_frames ab1) (AudioBuffer_channels ab1) 4))
          (memcpy (cast dat2) (cast (AudioBuffer_ptr ab2 0 0)) (* (AudioBuffer_frames ab2) (AudioBuffer_channels ab2) 4))
          new))))


Back to Index

Similar Entries

  • AudioBuffer    xtlang
  • AudioBuffer    xtlang
  • AudioBuffer    xtlang
  • AudioBuffer    xtlang
  • AudioBuffer    xtlang
  • AudioBuffer_cstring    xtlang
  • AudioBuffer_data_b64    xtlang
  • AudioBuffer_data_b64_cstring    xtlang
  • AudioBuffer_from_aiff    xtlang
  • AudioBuffer_from_wave    xtlang
  • AudioBuffer_malloc    xtlang
  • AudioBuffer_read    xtlang
  • AudioBuffer_read    xtlang
  • AudioBuffer_read_interp    xtlang
  • AudioBuffer_read_interp_mix    xtlang
  • AudioBuffer_read_interp_pw    xtlang
  • AudioBuffer_read_looped    xtlang
  • AudioBuffer_read_looped    xtlang
  • AudioBuffer_set_data_b64    xtlang
  • AudioBuffer_shared_data    xtlang
  • concat    xtlang
  • set_sampler_audiobuffer    xtlang