fix: asio-sys build failure, Segmentation fault (#775)

This commit is contained in:
mizuki0629 2023-04-14 17:12:55 +09:00 • committed by GitHub
parent 848abf256f
commit 7d40371785
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 107 additions and 75 deletions

View file

@ -164,50 +164,35 @@ fn create_bindings(cpal_asio_dir: &PathBuf) {
.clang_arg(format!("-I{}/{}", cpal_asio_dir.display(), "host"))
.clang_arg(format!("-I{}/{}", cpal_asio_dir.display(), "common"))
// Need to whitelist to avoid binding tp c++ std::*
.whitelist_type("AsioDrivers")
.whitelist_type("AsioDriver")
.whitelist_type("ASIOTime")
.whitelist_type("ASIOTimeInfo")
.whitelist_type("ASIODriverInfo")
.whitelist_type("ASIOBufferInfo")
.whitelist_type("ASIOCallbacks")
.whitelist_type("ASIOSamples")
.whitelist_type("ASIOSampleType")
.whitelist_type("ASIOSampleRate")
.whitelist_type("ASIOChannelInfo")
.whitelist_type("AsioTimeInfoFlags")
.whitelist_type("ASIOTimeCodeFlags")
.whitelist_var("kAsioSelectorSupported")
.whitelist_var("kAsioEngineVersion")
.whitelist_var("kAsioResetRequest")
.whitelist_var("kAsioBufferSizeChange")
.whitelist_var("kAsioResyncRequest")
.whitelist_var("kAsioLatenciesChanged")
.whitelist_var("kAsioSupportsTimeInfo")
.whitelist_var("kAsioSupportsTimeCode")
.whitelist_var("kAsioMMCCommand")
.whitelist_var("kAsioSupportsInputMonitor")
.whitelist_var("kAsioSupportsInputGain")
.whitelist_var("kAsioSupportsInputMeter")
.whitelist_var("kAsioSupportsOutputGain")
.whitelist_var("kAsioSupportsOutputMeter")
.whitelist_var("kAsioOverload")
.whitelist_function("ASIOGetChannels")
.whitelist_function("ASIOGetChannelInfo")
.whitelist_function("ASIOGetBufferSize")
.whitelist_function("ASIOGetSamplePosition")
.whitelist_function("get_sample_rate")
.whitelist_function("set_sample_rate")
.whitelist_function("can_sample_rate")
.whitelist_function("ASIOInit")
.whitelist_function("ASIOCreateBuffers")
.whitelist_function("ASIOStart")
.whitelist_function("ASIOStop")
.whitelist_function("ASIODisposeBuffers")
.whitelist_function("ASIOExit")
.whitelist_function("load_asio_driver")
.whitelist_function("remove_current_driver")
.whitelist_function("get_driver_names")
.allowlist_type("AsioDrivers")
.allowlist_type("AsioDriver")
.allowlist_type("ASIOTime")
.allowlist_type("ASIOTimeInfo")
.allowlist_type("ASIODriverInfo")
.allowlist_type("ASIOBufferInfo")
.allowlist_type("ASIOCallbacks")
.allowlist_type("ASIOSamples")
.allowlist_type("ASIOSampleType")
.allowlist_type("ASIOSampleRate")
.allowlist_type("ASIOChannelInfo")
.allowlist_type("AsioTimeInfoFlags")
.allowlist_type("ASIOTimeCodeFlags")
.allowlist_function("ASIOGetChannels")
.allowlist_function("ASIOGetChannelInfo")
.allowlist_function("ASIOGetBufferSize")
.allowlist_function("ASIOGetSamplePosition")
.allowlist_function("get_sample_rate")
.allowlist_function("set_sample_rate")
.allowlist_function("can_sample_rate")
.allowlist_function("ASIOInit")
.allowlist_function("ASIOCreateBuffers")
.allowlist_function("ASIOStart")
.allowlist_function("ASIOStop")
.allowlist_function("ASIODisposeBuffers")
.allowlist_function("ASIOExit")
.allowlist_function("load_asio_driver")
.allowlist_function("remove_current_driver")
.allowlist_function("get_driver_names")
.bitfield_enum("AsioTimeInfoFlags")
.bitfield_enum("ASIOTimeCodeFlags")
// Finish the builder and generate the bindings.