4 ms·
Yup, just declare the function like so: #[no_mangle] pub unsafe extern "C" fn transform_pcm( data: *mut c_short, len: c_uint, ramp_
by vvanders 9y ago
Yup, just declare the function like so:
#[no_mangle]
pub unsafe extern "C" fn transform_pcm(
data: *mut c_short,
len: c_uint,
ramp_time: c_uint,
tone_delta_frame: c_float) {
then call from python:
gen_pcm_dll = ctypes.cdll.LoadLibrary("gen_pcm_rust/target/release/gen_pcm.dll")
gen_pcm_dll.transform_pcm.argtypes = [ctypes.c_void_p, ctypes.c_uint, ctypes.c_uint, ctypes.c_float]
gen_pcm_dll.transform_pcm(ptr, len(pcm), ramp_time, tone_delta_frame)
Rust doesn't generate headers(although there are helper libs if you want) and you don't need them to FFI.