blob: ad55a74cfc9077c664c569f3d1a6c9d943f0aee6 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
|
# bevy_rustysynth
![Crates](https://img.shields.io/crates/v/bevy_rustysynth)
![License](https://img.shields.io/badge/license-0BSD%2FMIT%2FApache-blue.svg)
![Tag](https://img.shields.io/github/v/tag/exvacuum/bevy_rustysynth)
![Build](https://img.shields.io/github/actions/workflow/status/exvacuum/bevy_rustysynth/rust.yml)
A plugin which adds MIDI file and soundfont audio support to the bevy engine via rustysynth.
## Compatibility
| Crate Version | Bevy Version |
|--- |--- |
| 0.1-0.2 | 0.14 |
## Installation
### crates.io
```toml
[dependencies]
bevy_rustysynth = "0.2"
```
### Using git URL in Cargo.toml
```toml
[dependencies.bevy_rustysynth]
git = "https://github.com/exvacuum/bevy_rustysynth.git"
```
## Usage
In `main.rs`:
```rs
use bevy::prelude::*;
use bevy_rustysynth::*;
fn main() {
App::new()
.add_plugins((
DefaultPlugins,
RustySynthPlugin {
soundfont: // Bring your own soundfont or enable the "hl4mgm" feature to use a terrible 4MB default
}
))
.run();
}
```
Then you can load and play a MIDI like any other audio file:
```rs
let midi_handle = asset_server.load::<MidiAudio>("example.mid");
commands.spawn(AudioSourceBundle {
source: midi_handle,
..Default::default()
});
```
## License
This crate is licensed under your choice of 0BSD, Apache-2.0, or MIT license.
|