[][src]Crate fluidlite

Rust fluidlite bindings

This project aims provide safe Rust bindings to fluidlite C library.

FluidLite is a very light version of FluidSynth designed to be hardware, platform and external dependency independant. It only uses standard C libraries.

It also adds support for SF3 files (SF2 files compressed with ogg vorbis) and an additional setting to remove the constraint of channel 9 (drums): fluid_settings_setstr(settings, "synth.drums-channel.active", "no"); you can still select bank 128 on any channel to use drum kits.

FluidLite keeps very minimal functionnalities (settings and synth), therefore MIDI file reading, realtime MIDI events and audio output must be implemented externally.

Crates

Features

  • generate-bindings Force generate bindings on build instead of using pre-generated

Example

use std::{
    fs::File,
    io::Write,
};
use byte_slice_cast::AsByteSlice;
use fluidlite::{Settings, Synth};

let settings = Settings::new().unwrap();

let synth = Synth::new(settings).unwrap();
synth.sfload("soundfont.sf3", true).unwrap();

let mut buffer = [0i16; 44100 * 2];

let mut file = File::create("soundfont-sample.pcm").unwrap();

synth.note_on(0, 60, 127).unwrap();
synth.write(buffer.as_mut()).unwrap();
file.write(buffer.as_byte_slice()).unwrap();

synth.note_off(0, 60).unwrap();
synth.write(buffer.as_mut()).unwrap();
file.write(buffer.as_byte_slice()).unwrap();

Structs

FnLogger

Closure logger wrapper

FontRef

Reference to SoundFont object

Hints

The setting hints

Loader

The SoundFont loader object

Log

Logging

LogLogger

Logger implementation backed by log crate.

PresetRef

Reference to Preset object

Range

The range of setting value

Setting

The single setting of specific type

Settings

The generic settings object

SettingsRef

The settings reference

Synth

The synth object

TuningIter

The iterator over tunings

Version

The library version info

Enums

Error

Common error type

LogLevel

Logging level

Traits

FileApi

The file reading API

IsFont

The SoundFont interface

IsPreset

The SoundFont preset interface

IsSamples

The trait which implements samples data buffer interface

IsSetting

The single setting object interface

IsSettings

The settings interface

Logger

Log output handler

Type Definitions

Bank

Bank number (0..=127)

Chan

Channel number

Ctrl

Control number

FontId

Font Id

Key

Key number

PresetId

Preset Id

Prog

Program number (0..=127)

Result

Generic result type

Status

Result without value

Val

Control value

Vel

Velocity value