Coder Social home page Coder Social logo

thindx-xaudio2's Introduction

🦀 thindx-xaudio2[-sys] 🦀

FFI and thin wrappers for XAudio2

GitHub Build Status Last Commit
MSRV: 1.63.0 License
Examples Changelog

crate crates.io docs.rs Description
thindx-xaudio2 crates.io docs.rs High level FFI for XAudio2
thindx-xaudio2-sys crates.io docs.rs Low level FFI for XAudio2

Warnings

⚠️ 0.0.0-yyyy-mm-dd does not obey semver.
⚠️ I'm not yet willing to stabilize these crates APIs.
⚠️ thindx-xaudio2 lacks testing and may not yet be sound.

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

thindx-xaudio2's People

Contributors

maulingmonkey avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

thindx-xaudio2's Issues

Overhaul doc versioning

Having the same symbol exported N times in docs.rs is lame.
Abuse wildcards, probably. And #[doc(no_inline)].

Don't require importing winresult to use thindx-xaudio2

fn on_voice_error(&self, _buffer_context: &Self::BufferContext, error: winresult::HResult) { panic!("{error:?}"); }

This effectively requires pulling in winresult just to impl this semi-mandatory trait.
Also consider making a callbackless version of this, or at least introduce:

  • impl DefaultVoiceCallback for VoiceCallback
  • impl DefaultEngineCallback for EngineCallback

Which would presumably panic on errors but otherwise do ≈nothing. The A440 sample really shouldn't be forced to impl callbacks.

Provenance tracking issues

core::ptr::from_raw_parts is not yet stable

Which is a problem for here:

b.pContext = Box::into_raw(Box::new(SourceBuffer::<Context> {
context,
audio_len: audio_data.len(),
audio_data: {
// ⚠️ WARNING: easy to muck up provenance of ArcInner<[Sample]> here.
let raw : *const [Sample] = Arc::into_raw(audio_data);
let raw : *const Sample = unsafe { (*raw).as_ptr() };
raw.cast()
},
audio_free: |data, len| {
// 🐞 BUG: core::slice::from_raw_parts here incorrectly narrows provenance from ArcInner<[Sample]> to [Sample] here.
// However, core::ptr::from_raw_parts is not yet stable: https://github.com/rust-lang/rust/issues/81513
// Local tracking issue: https://github.com/MaulingMonkey/thindx-xaudio2/issues/18
let audio_data : *const [Sample] = unsafe { core::slice::from_raw_parts(data as *const Sample, len) };
let audio_data = unsafe { Arc::from_raw(audio_data) };
drop(audio_data);
},
})).cast();

voice destruction

  • DestroyVoice warns of perf issues / delays measured in milliseconds
  • destroy_voice_async for automatic offloading to a worker thread per doc suggestions?
  • features to make drop do so automatically?
  • Also probably bad to allow them to outlive IXAudio2
  • Make SourceVoice et all borrow IXAudio2?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.