Class: FluidSynth::FluidPresetT

Inherits:
FFI::Struct
  • Object
show all
Defined in:
lib/ffi-fluidsynth.rb

Overview

< SoundFont

Fields:

:data

(FFI::Pointer(*Void)) < User supplied data

:sfont

(FluidSfontT) < Parent virtual SoundFont

:free

(FFI::Pointer(*)) Method to free a virtual SoundFont preset. @param preset Virtual SoundFont preset @return Should return 0

:get_name

(FFI::Pointer(*)) Method to get a virtual SoundFont preset name. @param preset Virtual SoundFont preset @return Should return the name of the preset. The returned string must be

valid for the duration of the virtual preset (or the duration of the
SoundFont, in the case of preset iteration).
:get_banknum

(FFI::Pointer(*)) Method to get a virtual SoundFont preset MIDI bank number. @param preset Virtual SoundFont preset @param return The bank number of the preset

:get_num

(FFI::Pointer(*)) Method to get a virtual SoundFont preset MIDI program number. @param preset Virtual SoundFont preset @param return The program number of the preset

:noteon

(FFI::Pointer(*)) Method to handle a noteon event (synthesize the instrument). @param preset Virtual SoundFont preset @param synth Synthesizer instance @param chan MIDI channel number of the note on event @param key MIDI note number (0-127) @param vel MIDI velocity (0-127) @return #FLUID_OK on success (0) or #FLUID_FAILED (-1) otherwise

This method may be called from within synthesis context and therefore should be as efficient as possible and not perform any operations considered bad for realtime audio output (memory allocations and other OS calls).

Call fluid_synth_alloc_voice() for every sample that has to be played. fluid_synth_alloc_voice() expects a pointer to a #fluid_sample_t structure and returns a pointer to the opaque #fluid_voice_t structure. To set or increment the values of a generator, use fluid_voice_gen_set() or fluid_voice_gen_incr(). When you are finished initializing the voice call fluid_voice_start() to start playing the synthesis voice. Starting with FluidSynth 1.1.0 all voices created will be started at the same time.

:notify

(FFI::Pointer(*)) Virtual SoundFont preset notify method. @param preset Virtual SoundFont preset @param reason #FLUID_PRESET_SELECTED or #FLUID_PRESET_UNSELECTED @param chan MIDI channel number @return Should return #FLUID_OK

Implement this optional method if the preset needs to be notified about preset select and unselect events.

This method may be called from within synthesis context and therefore should be as efficient as possible and not perform any operations considered bad for realtime audio output (memory allocations and other OS calls).