(bind-func audiofile_24bitPCM_to_sample_be
(let ((range (i64tod (<< 1 32)))
(tmp:i8* (zalloc 4)))
(lambda (src:i8* dest:SAMPLE* nsamp)
(pset! tmp 0 0)
(doloop (i nsamp)
;; copy the 3 bytes to tmp (in reverse order)
(pset! tmp 3 (pref src (* i 3)))
(pset! tmp 2 (pref src (+ (* i 3) 1)))
(pset! tmp 1 (pref src (+ (* i 3) 2)))
(pset! dest i (dtof (/ (i32tod (pref (cast tmp i32*) 0)) range)))))))