(bind-func audiofile_copy_samples
(lambda (src dest nsamp bitdepth type le:i1)
(cond ((= type WAVE_FORMAT_IEEE_FLOAT)
(if le
(audiofile_float_to_sample_le src dest nsamp)
(audiofile_float_to_sample_be src dest nsamp))
#t)
((and (or (= type WAVE_FORMAT_PCM)
(= type WAVE_FORMAT_EXTENSIBLE))
(= bitdepth 16))
(if le
(audiofile_16bitPCM_to_sample_le src dest nsamp)
(audiofile_16bitPCM_to_sample_be src dest nsamp))
#t)
((and (or (= type WAVE_FORMAT_PCM)
(= type WAVE_FORMAT_EXTENSIBLE))
(= bitdepth 24))
(if le
(audiofile_24bitPCM_to_sample_le src dest nsamp)
(audiofile_24bitPCM_to_sample_be src dest nsamp))
#t)
(else
(println "audiofile error: the native xtlang wave/aiff file reader currently\nonly supports 16/24-bit PCM or 32-bit IEEE float audio\n\nFor more audio format options, use libs/external/sndfile.xtm")
#f))))