This checkout had no git history at all, so this one commit carries the whole
of the Everwood work as a single import on top of chairmanpow/benilla-octo's
`main` (706cd71). The two trees have genuinely diverged — each has files the
other does not — so this is a fork point, not a catch-up.
Today's work, which is the reason a baseline exists at all:
- Booth previews no longer cast world shadows (`NO_BOOTH_SHADOW`). Portrait
characters were entering the sun's shadow cascades, so every skinned-rig
shadow specialization compiled live mid-frame; the hitch detector logged
"main thread blocked 1316 ms" beside a `compiled LIVE` warning. This was
the Fashion/Tmog stutter.
- Per-pane dress-up: each `DressUpModel` pane assembles and stages its own
tried-on look instead of every pane mirroring the live player.
- Item template cache is append-only JSONL written on the IO pool, replacing
an 11.6 MB whole-map JSON rewrite on the main thread every 10 s.
- `WOW_SYSTEM_TIMING` rebuilt per-thread: it took 2 mutexes per system enter
and 4 per exit, costing 15 ms a frame (590 fps -> 60) and corrupting the
measurements it was taken to produce.
- The visibility-churn sweep moved to its own `WOW_FLASH_CHURN` switch, so a
frame-cost reading no longer pays 2.7 ms a frame for it.
Local state (`benilla-config/`, `logs/`, `target/`) is excluded by the
existing .gitignore; the account credential it holds is not in this commit.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SgstFWtn1RxEJ5kVrpgYwn
144 lines
4.2 KiB
Markdown
144 lines
4.2 KiB
Markdown
# Kira
|
|
|
|
#### [crates.io](https://crates.io/crates/kira) | [docs](https://docs.rs/kira/)
|
|
|
|
Kira is a backend-agnostic library to create expressive audio for games. It
|
|
provides tweens for smoothly adjusting properties of sounds, a flexible mixer
|
|
for applying effects to audio, a clock system for precisely timing audio events,
|
|
and spatial audio support.
|
|
|
|
## Examples
|
|
|
|
Playing a sound multiple times simultaneously:
|
|
|
|
```rust
|
|
use kira::{
|
|
AudioManager, AudioManagerSettings, DefaultBackend,
|
|
sound::static_sound::StaticSoundData,
|
|
};
|
|
|
|
// Create an audio manager. This plays sounds and manages resources.
|
|
let mut manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default())?;
|
|
let sound_data = StaticSoundData::from_file("sound.ogg")?;
|
|
manager.play(sound_data.clone())?;
|
|
// After a couple seconds...
|
|
manager.play(sound_data.clone())?;
|
|
// Cloning the sound data will not use any extra memory.
|
|
```
|
|
|
|
Gradually speeding up a sound over time:
|
|
|
|
```rust
|
|
use std::time::Duration;
|
|
|
|
use kira::{
|
|
AudioManager, AudioManagerSettings, DefaultBackend,
|
|
sound::static_sound::StaticSoundData,
|
|
Tween,
|
|
};
|
|
|
|
let mut manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default())?;
|
|
let sound_data = StaticSoundData::from_file("sound.ogg")?;
|
|
let mut sound = manager.play(sound_data)?;
|
|
// Start smoothly adjusting the playback rate parameter.
|
|
sound.set_playback_rate(
|
|
2.0,
|
|
Tween {
|
|
duration: Duration::from_secs(3),
|
|
..Default::default()
|
|
},
|
|
);
|
|
```
|
|
|
|
Playing a sound with a low-pass filter applied (this makes the audio sound
|
|
muffled):
|
|
|
|
```rust
|
|
use kira::{
|
|
AudioManager, AudioManagerSettings, DefaultBackend,
|
|
sound::static_sound::StaticSoundData,
|
|
track::{
|
|
TrackBuilder,
|
|
effect::filter::FilterBuilder,
|
|
},
|
|
};
|
|
|
|
let mut manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default())?;
|
|
// Create a mixer sub-track with a filter.
|
|
let track = manager.add_sub_track({
|
|
let mut builder = TrackBuilder::new();
|
|
builder.add_effect(FilterBuilder::new().cutoff(1000.0));
|
|
builder
|
|
})?;
|
|
// Play the sound on the track.
|
|
let sound_data = StaticSoundData::from_file("sound.ogg")?.output_destination(&track);
|
|
manager.play(sound_data)?;
|
|
```
|
|
|
|
Playing sounds in time with a musical beat:
|
|
|
|
```rust
|
|
use kira::{
|
|
AudioManager, AudioManagerSettings, DefaultBackend,
|
|
sound::static_sound::StaticSoundData,
|
|
clock::ClockSpeed,
|
|
};
|
|
|
|
const TEMPO: f64 = 120.0;
|
|
|
|
let mut manager = AudioManager::<DefaultBackend>::new(AudioManagerSettings::default())?;
|
|
// Create a clock that ticks 120 times per minute. In this case,
|
|
// each tick is one musical beat. We can use a tick to represent any
|
|
// arbitrary amount of time.
|
|
let mut clock = manager.add_clock(ClockSpeed::TicksPerMinute(TEMPO))?;
|
|
// Play a sound 2 ticks (beats) from now.
|
|
let sound_data_1 = StaticSoundData::from_file("sound1.ogg")?
|
|
.start_time(clock.time() + 2);
|
|
manager.play(sound_data_1)?;
|
|
// Play a different sound 4 ticks (beats) from now.
|
|
let sound_data_2 = StaticSoundData::from_file("sound2.ogg")?
|
|
.start_time(clock.time() + 4);
|
|
manager.play(sound_data_2)?;
|
|
// Start the clock.
|
|
clock.start()?;
|
|
```
|
|
|
|
## Platform support
|
|
|
|
Kira is mainly meant for desktop platforms. Most testing has occurred on
|
|
Windows, but it has been used successfully on Mac and Linux.
|
|
|
|
Kira can also be used in wasm environments with the following limitations:
|
|
|
|
- Static sounds cannot be loaded from files
|
|
- Streaming sounds are not supported because they make heavy use of threads
|
|
|
|
If you'd like to help improve wasm support, please reach out!
|
|
|
|
## Roadmap
|
|
|
|
Features I'd like to have:
|
|
|
|
- C API
|
|
- Spatial audio features:
|
|
- Doppler effect
|
|
|
|
## Contributing
|
|
|
|
I'd love for other people to get involved with development! Since the library is
|
|
still in the early stages, I'm open to all kinds of input - bug reports, feature
|
|
requests, design critiques, etc. Feel free to open an issue or pull request!
|
|
|
|
## License
|
|
|
|
This project is licensed under either of
|
|
|
|
- Apache License, Version 2.0 (LICENSE-APACHE)
|
|
- MIT license (LICENSE-MIT)
|
|
|
|
at your option.
|
|
|
|
Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
for inclusion in `kira` by you, as defined in the Apache-2.0 license, shall be
|
|
dual licensed as above, without any additional terms or conditions.
|