Changeset 7126
- Timestamp:
- 01/30/10 07:14:25 (7 months ago)
- Files:
-
- 1 modified
-
trunk/liquidsoap/src/tools/rutils.ml (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/liquidsoap/src/tools/rutils.ml
r6935 r7126 77 77 (fun ~audio_src_rate src -> 78 78 let sample_bytes = samplesize / 8 in 79 let len = (String.length src) / (sample_bytes*channels) in80 let dst =81 (* TODO: convert channel number? *)82 Array.init channels (fun _ -> Array.make len 0.)83 in84 79 let ratio = audio_dst_rate /. audio_src_rate in 80 (* Compute the length in samples, in the source data, 81 * then in the destination format, adding 1 to prevent rounding bugs. *) 82 let len_src = (String.length src) / (sample_bytes*channels) in 83 let len_dst = 1 + int_of_float (float len_src *. ratio) in 84 let dst = Array.init channels (fun _ -> Array.make len_dst 0.) in 85 85 ignore 86 ( 87 Float_pcm.resample_s16le 88 src 0 len signed samplesize big_endian 89 ratio dst 0 90 ); 91 dst,Frame.master_of_audio len) 92 93 94 86 (Float_pcm.resample_s16le 87 src 0 len_src signed samplesize big_endian 88 ratio dst 0) ; 89 dst, Frame.master_of_audio len_dst)
