Channel

class Channel

Represents a MIDI channel.

A MIDI Synthesizer has several channels. Each one can be assigned to a specific “bank:preset” pair in the SoundFont file.

Various parameters (affecting the synthesis) of a channel can be modified via MIDI events. Only a few are supported by this class.

Construction

Channel(bool percussion = false)

Initializes a Channel instance.

Parameters:

percussion – (optional): Indicates if the channel is a percussion channel. Percussion channels are handled differently. Defaults to false.

Reset methods

void reset()

Reset the channel to the default values.

void resetControllers()

Reset the controllers of the channel to the default values.

Setters for general parameters

inline void setBank(uint8_t value)

Sets the bank number for the channel.

inline void setPreset(uint8_t value)

Sets the preset number for the channel.

inline void setPitchBend(uint8_t value1, uint8_t value2)

Sets the pitch bend value for the channel.

Parameters:
  • value1 – The least significant byte of the pitch bend value

  • value2 – The most significant byte of the pitch bend value

Setters for high resolution continuous controllers

inline void setModulationCoarse(uint8_t value)

Sets the coarse modulation value.

inline void setModulationFine(uint8_t value)

Sets the fine modulation value.

inline void setVolumeCoarse(uint8_t value)

Sets the coarse volume value.

inline void setVolumeFine(uint8_t value)

Sets the fine volume value.

inline void setPanCoarse(uint8_t value)

Sets the coarse pan value.

inline void setPanFine(uint8_t value)

Sets the fine pan value.

inline void setExpressionCoarse(uint8_t value)

Sets the coarse expression value.

inline void setExpressionFine(uint8_t value)

Sets the fine expression value.

Setters for switches

inline void setSustain(uint8_t value)

Sets the sustain switch.

Setters for low resolution continuous controllers

inline void setReverbSend(uint8_t value)

Sets the reverb send level.

inline void setChorusSend(uint8_t value)

Sets the chorus send level.

Setters for Registered Parameters (RPN)

inline void setRPNCoarse(uint8_t value)

Sets the coarse RPN value.

inline void setRPNFine(uint8_t value)

Sets the fine RPN value.

inline void setDataEntryCoarse(uint8_t value)

Sets the coarse data entry value based on the current RPN.

inline void setDataEntryFine(uint8_t value)

Sets the fine data entry value based on the current RPN.

Getters for the parameters

inline bool percussion() const

Returns whether the channel is a percussion channel.

inline uint8_t bank() const

Returns the bank number of the channel.

inline uint8_t preset() const

Returns the preset number of the channel.

inline float modulation() const

Returns the modulation value.

inline float volume() const

Returns the volume value in decibels.

inline float pan() const

Returns the pan value.

inline float expression() const

Returns the expression value.

inline bool sustain() const

Returns whether sustain is enabled.

inline float reverbSend() const

Returns the reverb send level.

inline float chorusSend() const

Returns the chorus send level.

inline float pitchBendRange() const

Returns the pitch bend range.

inline float pitchBend() const

Returns the pitch bend value.

inline float tune() const

Returns the tuning adjustment.