Handle timed buffer switch and messaging callbacks in asio-sys

This adds an implementation of ASIO message handling in a manner that
matches that demonstrated in the SDK's `hostsample.cpp` file.

Also refactors the code to ensure that both `buffer_switch` and
`buffer_switch_time_info` callbacks are handled.
This commit is contained in:
mitchmindtree 2019-07-05 04:21:23 +10:00
parent cc5b0555c2
commit b7d40d2993
2 changed files with 203 additions and 30 deletions

View file

@ -159,14 +159,35 @@ fn create_bindings(cpal_asio_dir: &PathBuf) {
.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")
@ -179,6 +200,8 @@ fn create_bindings(cpal_asio_dir: &PathBuf) {
.whitelist_function("load_asio_driver")
.whitelist_function("remove_current_driver")
.whitelist_function("get_driver_names")
.bitfield_enum("AsioTimeInfoFlags")
.bitfield_enum("ASIOTimeCodeFlags")
// Finish the builder and generate the bindings.
.generate()
// Unwrap the Result and panic on failure.