Skip to content

Commit

Permalink
Add settings with live changes
Browse files Browse the repository at this point in the history
  • Loading branch information
MyBlackMIDIScore committed Aug 25, 2024
1 parent a9301ec commit 45a96bc
Show file tree
Hide file tree
Showing 7 changed files with 397 additions and 93 deletions.
8 changes: 4 additions & 4 deletions kdmapi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
[package]
name = "kdmapi"
description = "A cdylib wrapper around real-time to act as a drop-in replacement for OmniMIDI."
name = "xsynth-kdmapi"
description = "A cdylib wrapper around XSynth to act as a drop in replacement for OmniMIDI/KDMAPI."
authors = ["Kaydax", "Arduano", "MBMS"]
readme = "README.md"

authors.workspace = true
version.workspace = true
edition.workspace = true
license.workspace = true
homepage.workspace = true
repository.workspace = true
readme.workspace = true
keywords.workspace = true
categories.workspace = true

Expand Down
75 changes: 75 additions & 0 deletions kdmapi/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# xsynth-kdmapi
A cdylib wrapper around XSynth to act as a drop in replacement for OmniMIDI/KDMAPI.

## Usage
1) Download `OmniMIDI.dll` from the [releases](https://github.com/BlackMIDIDevs/xsynth/releases) page
1) Alternatively you can build the library yourself by cloning the repo and compiling with Cargo.
2) Place it in the same directory as your KDMAPI aware software of choice.

Upon loading the library, the following two files will be generated under `%userprofile%/AppData/Roaming/xsynth-kdmapi` (on Windows):

### `settings.json`
The synthesizer settings. Fields:
- `layers`

- The layer limit for each channel. One layer is one voice per key per channel. If set to `null` the synth will not limit the voices.
- This setting will be updated live during playback.

- `fade_out_killing`

- If set to `true`, the voices killed due to the voice limit will fade out. If set to `false`, they will be killed immediately, usually causing clicking but improving performance.

- `render_window_ms`

- The length of the buffer reader in ms.

- `multithreading`

- Controls the multithreading used for rendering per-voice audio for all the voices stored in a key for a channel.
- Can be `"None"` for no multithreading, `"Auto"` for multithreading with an automatically determined thread count, or `{ "Manual": <threads> }` for multithreading with a custom thread count.

- `ignore_range`

- The synth will ignore notes in this range of velocities.
- Values: `start` (low velocity), `end` (high velocity).

### `soundfonts.json`
The list of soundfonts that will be used. Any changes in the soundfont list will be updated live during playback.

For information about the supported soundfont formats visit [the official XSynth documentation](https://docs.rs/xsynth-core/latest/xsynth_core/soundfont/struct.SampleSoundfont.html).

Each soundfont item has the following fields:

- `path`

- The path of the soundfont.

- `enabled`

- Whether or not the soundfont will be loaded. Can be `true` or `false`.

- `bank`

- The bank number (0-128) to extract and use from the soundfont.
- `null` means to use all available banks (bank 0 for SFZ).

- `preset`

- The preset number (0-127) to extract and use from the soundfont.
- `null` means to use all available presets (preset 0 for SFZ).

- `vol_envelope_options`

- Volume envelope configuration in the dB scale. Each option supports the following values: `"Exponential"` and `"Linear"`.
- `attack_curve`: Attack stage curve type
- `decay_curve`: Decay stage curve type
- `release_curve`: Release stage curve type

- `use_effects`

- If set to `true`, the soundfont will be able to use signal processing effects. Currently this option only affects the cutoff filter. Setting to `false` disables those filters.

- `interpolator`

- The type of interpolator used in the soundfont.
- Can be `"Nearest"` for nearest neighbor interpolation (no interpolation) or `"Linear"` for linear interpolation.
6 changes: 5 additions & 1 deletion kdmapi/build.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
fn main() {
if cfg!(windows) {
println!("cargo:rustc-cdylib-link-arg=/DEF:./kdmapi/Ordinals.def")
// Building on Windows
println!("cargo:rustc-cdylib-link-arg=/DEF:Ordinals.def")
} else if std::env::var_os("CARGO_CFG_WINDOWS").is_some() {
// Cross building for Windows
println!("cargo:rustc-cdylib-link-arg=Ordinals.def")
}
}
Loading

0 comments on commit 45a96bc

Please sign in to comment.