Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ when upgrading from a version of rust-sdl2 to another.

[PR #1506](https://github.com/Rust-SDL2/rust-sdl2/pull/1506) **BREAKING CHANGE** Update crates.io dependencies, update bundled SDL2 to 2.32.10, add whitelist to bindgen to only emit SDL related items, and specifically no platform (or compiler, etc) specific items. Implement the same set of useful derived traits on bitflags types.

[PR #1508](https://github.com/Rust-SDL2/rust-sdl2/pull/1508) Add `Chunk::from_rwops` to bind `Mix_LoadWAV_RW`.

### v0.38.0

[PR #1493](https://github.com/Rust-SDL2/rust-sdl2/pull/1493) Add `Rect::origin` and specifies origin location in `Rect::new`.
Expand Down
6 changes: 6 additions & 0 deletions src/sdl2/mixer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,12 @@ impl Chunk {
Self::from_owned_raw(raw)
}

/// Load from `RWOps` for use as a sample.
pub fn from_rwops(rwops: RWops<'_>) -> Result<Chunk, String> {
let raw = unsafe { mixer::Mix_LoadWAV_RW(rwops.raw(), 0) };
Self::from_owned_raw(raw)
}

/// Load chunk from a buffer containing raw audio data in the mixer format. The length of the
/// buffer has to fit in 32-bit unsigned integer. The chunk takes ownership of the buffer.
///
Expand Down