| Safe Haskell | None |
|---|---|
| Language | GHC2021 |
Termtab.Audio.FluidSynth.Raw
Description
Direct FFI bindings to libfluidsynth's C API. Each binding is a
thin, 1:1 wrapper around the identically-named fluid_* function from
fluidsynth.h — see that header (or the FluidSynth API docs) for
parameter/return semantics. Termtab.Audio.FluidSynth is the only
caller; it wraps these raw pointer-passing calls in the
Types-typed, exception-safe FluidSynthEngine
API that the rest of the codebase uses.
Synopsis
- data C'fluid_settings_t
- data C'fluid_synth_t
- data C'fluid_audio_driver_t
- c'new_fluid_settings :: IO (Ptr C'fluid_settings_t)
- c'delete_fluid_settings :: Ptr C'fluid_settings_t -> IO ()
- c'fluid_settings_setstr :: Ptr C'fluid_settings_t -> CString -> CString -> IO CInt
- c'fluid_settings_setint :: Ptr C'fluid_settings_t -> CString -> CInt -> IO CInt
- c'new_fluid_synth :: Ptr C'fluid_settings_t -> IO (Ptr C'fluid_synth_t)
- c'delete_fluid_synth :: Ptr C'fluid_synth_t -> IO ()
- c'fluid_synth_sfload :: Ptr C'fluid_synth_t -> CString -> CInt -> IO CInt
- c'new_fluid_audio_driver :: Ptr C'fluid_settings_t -> Ptr C'fluid_synth_t -> IO (Ptr C'fluid_audio_driver_t)
- c'delete_fluid_audio_driver :: Ptr C'fluid_audio_driver_t -> IO ()
- c'fluid_synth_noteon :: Ptr C'fluid_synth_t -> CInt -> CInt -> CInt -> IO CInt
- c'fluid_synth_noteoff :: Ptr C'fluid_synth_t -> CInt -> CInt -> IO CInt
- c'fluid_synth_program_change :: Ptr C'fluid_synth_t -> CInt -> CInt -> IO CInt
Opaque C types
data C'fluid_settings_t Source #
Uninhabited marker type for fluid_settings_t*; values only ever exist
behind a Ptr obtained from c'new_fluid_settings.
data C'fluid_synth_t Source #
Uninhabited marker type for fluid_synth_t*, obtained from
c'new_fluid_synth.
data C'fluid_audio_driver_t Source #
Uninhabited marker type for fluid_audio_driver_t*, obtained from
c'new_fluid_audio_driver.
Settings
c'new_fluid_settings :: IO (Ptr C'fluid_settings_t) Source #
Create a new settings object; must precede c'new_fluid_synth.
c'delete_fluid_settings :: Ptr C'fluid_settings_t -> IO () Source #
Free a settings object, once its synth (if any) is already freed.
c'fluid_settings_setstr :: Ptr C'fluid_settings_t -> CString -> CString -> IO CInt Source #
Set a string-valued setting (used by Termtab.Audio.FluidSynth to
force audio.driver).
c'fluid_settings_setint :: Ptr C'fluid_settings_t -> CString -> CInt -> IO CInt Source #
Set an integer-valued setting.
Synth
c'new_fluid_synth :: Ptr C'fluid_settings_t -> IO (Ptr C'fluid_synth_t) Source #
Create a synth from a settings object.
c'delete_fluid_synth :: Ptr C'fluid_synth_t -> IO () Source #
Free a synth, before freeing its settings.
c'fluid_synth_sfload :: Ptr C'fluid_synth_t -> CString -> CInt -> IO CInt Source #
Load a SoundFont (.sf2) file into a synth; the CInt argument is
the "reset presets" flag (1 to reset MIDI channel programs).
Audio driver
c'new_fluid_audio_driver :: Ptr C'fluid_settings_t -> Ptr C'fluid_synth_t -> IO (Ptr C'fluid_audio_driver_t) Source #
Start an audio driver for a synth, using the driver named by the
settings object's audio.driver key.
c'delete_fluid_audio_driver :: Ptr C'fluid_audio_driver_t -> IO () Source #
Stop and free an audio driver, before freeing its synth.
Note playback
c'fluid_synth_noteon :: Ptr C'fluid_synth_t -> CInt -> CInt -> CInt -> IO CInt Source #
Start a note: synth, channel, key, velocity.
c'fluid_synth_noteoff :: Ptr C'fluid_synth_t -> CInt -> CInt -> IO CInt Source #
Stop a note: synth, channel, key.
Program change
c'fluid_synth_program_change :: Ptr C'fluid_synth_t -> CInt -> CInt -> IO CInt Source #
Change a channel's General MIDI program: synth, channel, program number.