libfluidsynth  2.2.3
MIDI Channel Setup

The functions in this section provide interfaces to change the channel type and to configure basic channels, legato and portamento setups. More...

Channel Type

enum  fluid_midi_channel_type {
  CHANNEL_TYPE_MELODIC = 0,
  CHANNEL_TYPE_DRUM = 1
}
 The midi channel type used by fluid_synth_set_channel_type() More...
 
int fluid_synth_set_channel_type (fluid_synth_t *synth, int chan, int type)
 Set midi channel type. More...
 

Basic Channel Mode

enum  fluid_channel_mode_flags {
  FLUID_CHANNEL_POLY_OFF = 0x01,
  FLUID_CHANNEL_OMNI_OFF = 0x02
}
 Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3) More...
 
enum  fluid_basic_channel_modes {
  FLUID_CHANNEL_MODE_MASK = (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF),
  FLUID_CHANNEL_MODE_OMNION_POLY = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF),
  FLUID_CHANNEL_MODE_OMNION_MONO = FLUID_CHANNEL_MODE_MASK & (~FLUID_CHANNEL_OMNI_OFF & FLUID_CHANNEL_POLY_OFF),
  FLUID_CHANNEL_MODE_OMNIOFF_POLY = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF & ~FLUID_CHANNEL_POLY_OFF),
  FLUID_CHANNEL_MODE_OMNIOFF_MONO = FLUID_CHANNEL_MODE_MASK & (FLUID_CHANNEL_OMNI_OFF | FLUID_CHANNEL_POLY_OFF)
}
 Indicates the mode a basic channel is set to. More...
 
int fluid_synth_reset_basic_channel (fluid_synth_t *synth, int chan)
 Disables and unassigns all channels from a basic channel group. More...
 
int fluid_synth_get_basic_channel (fluid_synth_t *synth, int chan, int *basic_chan_out, int *mode_chan_out, int *basic_val_out)
 Returns poly mono mode information of any MIDI channel. More...
 
int fluid_synth_set_basic_channel (fluid_synth_t *synth, int chan, int mode, int val)
 Sets a new basic channel group only. More...
 

Legato Mode

enum  fluid_channel_legato_mode {
  FLUID_CHANNEL_LEGATO_MODE_RETRIGGER,
  FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER
}
 Indicates the legato mode a channel is set to n1,n2,n3,. More...
 
int fluid_synth_set_legato_mode (fluid_synth_t *synth, int chan, int legatomode)
 Sets the legato mode of a channel. More...
 
int fluid_synth_get_legato_mode (fluid_synth_t *synth, int chan, int *legatomode)
 Gets the legato mode of a channel. More...
 

Portamento Mode

enum  fluid_channel_portamento_mode {
  FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE,
  FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY,
  FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY
}
 Indicates the portamento mode a channel is set to. More...
 
int fluid_synth_set_portamento_mode (fluid_synth_t *synth, int chan, int portamentomode)
 Sets the portamento mode of a channel. More...
 
int fluid_synth_get_portamento_mode (fluid_synth_t *synth, int chan, int *portamentomode)
 Gets the portamento mode of a channel. More...
 

Breath Mode

enum  fluid_channel_breath_flags {
  FLUID_CHANNEL_BREATH_POLY = 0x10,
  FLUID_CHANNEL_BREATH_MONO = 0x20,
  FLUID_CHANNEL_BREATH_SYNC = 0x40
}
 Indicates the breath mode a channel is set to. More...
 
int fluid_synth_set_breath_mode (fluid_synth_t *synth, int chan, int breathmode)
 Sets the breath mode of a channel. More...
 
int fluid_synth_get_breath_mode (fluid_synth_t *synth, int chan, int *breathmode)
 Gets the breath mode of a channel. More...
 

Detailed Description

The functions in this section provide interfaces to change the channel type and to configure basic channels, legato and portamento setups.

Enumeration Type Documentation

◆ fluid_basic_channel_modes

Indicates the mode a basic channel is set to.

Enumerator
FLUID_CHANNEL_MODE_MASK 

Mask Poly and Omni bits of fluid_channel_mode_flags, usually only used internally.

FLUID_CHANNEL_MODE_OMNION_POLY 

corresponds to MIDI mode 0

FLUID_CHANNEL_MODE_OMNION_MONO 

corresponds to MIDI mode 1

FLUID_CHANNEL_MODE_OMNIOFF_POLY 

corresponds to MIDI mode 2

FLUID_CHANNEL_MODE_OMNIOFF_MONO 

corresponds to MIDI mode 3

◆ fluid_channel_breath_flags

Indicates the breath mode a channel is set to.

Enumerator
FLUID_CHANNEL_BREATH_POLY 

when channel is poly, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath to initial attenuation modulator

FLUID_CHANNEL_BREATH_MONO 

when channel is mono, this flag indicates that the default velocity to initial attenuation modulator is replaced by a breath modulator

FLUID_CHANNEL_BREATH_SYNC 

when channel is mono, this flag indicates that the breath controller(MSB)triggers noteon/noteoff on the running note

◆ fluid_channel_legato_mode

Indicates the legato mode a channel is set to n1,n2,n3,.

. is a legato passage. n1 is the first note, and n2,n3,n4 are played legato with previous note.

Enumerator
FLUID_CHANNEL_LEGATO_MODE_RETRIGGER 

Mode 0 - Release previous note, start a new note.

FLUID_CHANNEL_LEGATO_MODE_MULTI_RETRIGGER 

Mode 1 - On contiguous notes retrigger in attack section using current value, shape attack using current dynamic and make use of previous voices if any.

◆ fluid_channel_mode_flags

Channel mode bits OR-ed together so that it matches with the midi spec: poly omnion (0), mono omnion (1), poly omnioff (2), mono omnioff (3)

Enumerator
FLUID_CHANNEL_POLY_OFF 

if flag is set, the basic channel is in mono on state, if not set poly is on

FLUID_CHANNEL_OMNI_OFF 

if flag is set, the basic channel is in omni off state, if not set omni is on

◆ fluid_channel_portamento_mode

Indicates the portamento mode a channel is set to.

Enumerator
FLUID_CHANNEL_PORTAMENTO_MODE_EACH_NOTE 

Mode 0 - Portamento on each note (staccato or legato)

FLUID_CHANNEL_PORTAMENTO_MODE_LEGATO_ONLY 

Mode 1 - Portamento only on legato note.

FLUID_CHANNEL_PORTAMENTO_MODE_STACCATO_ONLY 

Mode 2 - Portamento only on staccato note.

◆ fluid_midi_channel_type

The midi channel type used by fluid_synth_set_channel_type()

Enumerator
CHANNEL_TYPE_MELODIC 

Melodic midi channel.

CHANNEL_TYPE_DRUM 

Drum midi channel.

Function Documentation

◆ fluid_synth_get_basic_channel()

int fluid_synth_get_basic_channel ( fluid_synth_t synth,
int  chan,
int *  basic_chan_out,
int *  mode_out,
int *  val_out 
)

Returns poly mono mode information of any MIDI channel.

Parameters
synththe synth instance
chanMIDI channel number (0 to MIDI channel count - 1)
basic_chan_outBuffer to store the basic channel chan belongs to or FLUID_FAILED if chan is disabled.
mode_outBuffer to store the mode of chan (see fluid_basic_channel_modes) or FLUID_FAILED if chan is disabled.
val_outBuffer to store the total number of channels in this basic channel group or FLUID_FAILED if chan is disabled.
Note
If any of basic_chan_out, mode_out, val_out pointer is NULL the corresponding information isn't returned.
Returns

◆ fluid_synth_get_breath_mode()

int fluid_synth_get_breath_mode ( fluid_synth_t synth,
int  chan,
int *  breathmode 
)

Gets the breath mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
breathmodePointer to the returned breath mode as indicated by fluid_channel_breath_flags.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • breathmode is NULL.

◆ fluid_synth_get_legato_mode()

int fluid_synth_get_legato_mode ( fluid_synth_t synth,
int  chan,
int *  legatomode 
)

Gets the legato mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
legatomodeThe legato mode as indicated by fluid_channel_legato_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • legatomode is NULL.

◆ fluid_synth_get_portamento_mode()

int fluid_synth_get_portamento_mode ( fluid_synth_t synth,
int  chan,
int *  portamentomode 
)

Gets the portamento mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
portamentomodePointer to the portamento mode as indicated by fluid_channel_portamento_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • portamentomode is NULL.

◆ fluid_synth_reset_basic_channel()

int fluid_synth_reset_basic_channel ( fluid_synth_t synth,
int  chan 
)

Disables and unassigns all channels from a basic channel group.

Parameters
synthThe synth instance.
chanThe basic channel of the group to reset or -1 to reset all channels.
Note
By default (i.e. on creation after new_fluid_synth() and after fluid_synth_system_reset()) a synth instance has one basic channel at channel 0 in mode FLUID_CHANNEL_MODE_OMNION_POLY. All other channels belong to this basic channel group. Make sure to call this function before setting any custom basic channel setup.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • chan isn't a basic channel.

◆ fluid_synth_set_basic_channel()

int fluid_synth_set_basic_channel ( fluid_synth_t synth,
int  chan,
int  mode,
int  val 
)

Sets a new basic channel group only.

The function doesn't allow to change an existing basic channel.

The function fails if any channel overlaps any existing basic channel group. To make room if necessary, basic channel groups can be cleared using fluid_synth_reset_basic_channel().

Parameters
synththe synth instance.
chanthe basic Channel number (0 to MIDI channel count-1).
modethe MIDI mode to use for chan (see fluid_basic_channel_modes).
valnumber of channels in the group.
Note
val is only relevant for mode FLUID_CHANNEL_MODE_OMNION_POLY, FLUID_CHANNEL_MODE_OMNION_MONO and FLUID_CHANNEL_MODE_OMNIOFF_MONO. A value of 0 means all possible channels from chan to to next basic channel minus 1 (if any) or to MIDI channel count minus 1. Val is ignored for FLUID_CHANNEL_MODE_OMNIOFF_POLY as this mode implies a group of only one channel.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • mode is invalid.
    • val has a number of channels overlapping another basic channel group or been above MIDI channel count.
    • When the function fails, any existing basic channels aren't modified.

◆ fluid_synth_set_breath_mode()

int fluid_synth_set_breath_mode ( fluid_synth_t synth,
int  chan,
int  breathmode 
)

Sets the breath mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
breathmodeThe breath mode as indicated by fluid_channel_breath_flags.
Returns

◆ fluid_synth_set_channel_type()

int fluid_synth_set_channel_type ( fluid_synth_t synth,
int  chan,
int  type 
)

Set midi channel type.

Parameters
synthFluidSynth instance
chanMIDI channel number (0 to MIDI channel count - 1)
typeMIDI channel type (fluid_midi_channel_type)
Returns
FLUID_OK on success, FLUID_FAILED otherwise
Since
1.1.4

◆ fluid_synth_set_legato_mode()

int fluid_synth_set_legato_mode ( fluid_synth_t synth,
int  chan,
int  legatomode 
)

Sets the legato mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
legatomodeThe legato mode as indicated by fluid_channel_legato_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • legatomode is invalid.

◆ fluid_synth_set_portamento_mode()

int fluid_synth_set_portamento_mode ( fluid_synth_t synth,
int  chan,
int  portamentomode 
)

Sets the portamento mode of a channel.

Parameters
synththe synth instance.
chanMIDI channel number (0 to MIDI channel count - 1).
portamentomodeThe portamento mode as indicated by fluid_channel_portamento_mode.
Returns
  • FLUID_OK on success.
  • FLUID_FAILED
    • synth is NULL.
    • chan is outside MIDI channel count.
    • portamentomode is invalid.