Channels#

namespace YSE#

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

namespace CHANNEL#

Enums

enum MESSAGE#

Values:

enumerator VOLUME#
enumerator MOVE#
enumerator VIRTUAL#
enumerator ATTACH_REVERB#
namespace YSE

Public API of libYSE — sound playback, mixing, and 3D positional audio.

Entry points: YSE::System (lifecycle and audio device), YSE::Listener (3D origin), YSE::sound (a playable source), YSE::channel (mixing tree), YSE::reverb (positioned reverb zone), YSE::patcher (modular DSP graph), YSE::player (note sequencer). Sub-namespaces group domain-specific types: YSE::DSP for signal processing, YSE::MIDI for MIDI I/O, YSE::MUSIC for note / chord / motif primitives.

Note

Apart from their constructors, the oscillator and vcf classes must only be invoked from inside a DSP callback / process body.

Functions

channel &ChannelMaster()#

Root of the channel tree.

Every channel ultimately routes here. < This macro is added to all public class declarations.

channel &ChannelFX()#

Pre-built channel for short sound effects.

< This macro is added to all public class declarations.

channel &ChannelMusic()#

Pre-built channel for playlists and music tracks.

< This macro is added to all public class declarations.

channel &ChannelAmbient()#

Pre-built channel for environmental and ambient sounds.

< This macro is added to all public class declarations.

channel &ChannelVoice()#

Pre-built channel for dialogue and voice-over.

< This macro is added to all public class declarations.

channel &ChannelGui()#

Pre-built channel for user-interface sounds.

< This macro is added to all public class declarations.

class channel#

A node in the channel tree — a group of sounds that mix together.

Channels work like the channel groups on a mixing console: every sound is attached to a channel, and channels can themselves be attached to a parent channel, forming a tree rooted at MainMix. Each channel is rendered on its own DSP thread, so spreading sounds across multiple channels can help scale across cores.

Several pre-built channels are created for you and exposed through free functions:

Use them as-is or as roots for your own subtrees.

See also

YSE::sound

Output peak metering

Lock-free getters returning the latest per-block peak of this channel’s output buffers.

Refresh granularity is one audio block (so polling faster than the audio block rate yields no new data). Pre reads the peak measured at the end of dsp() (after reverb/underwater FX, before the channel volume is applied); Post reads the peak measured immediately after adjustVolume() — what listeners hear. Per-output overloads take an index in [0, getNumOutputs()); out-of-range indices return 0. dB getters convert the linear value on the fly with a -120 dB floor for silence. Returns 0 on an invalid channel.

int getNumOutputs()#

Number of output channels currently allocated (matches the open device’s layout).

float getPeakLinearPre()#

Combined (max-over-outputs) pre-volume peak as a linear sample value.

float getPeakLinearPost()#

Combined (max-over-outputs) post-volume peak as a linear sample value.

float getPeakDbPre()#

Combined pre-volume peak in dBFS (-120 floor for silence).

float getPeakDbPost()#

Combined post-volume peak in dBFS (-120 floor for silence).

float getPeakLinearPre(int outputIdx)#

Per-output pre-volume peak as a linear sample value.

float getPeakLinearPost(int outputIdx)#

Per-output post-volume peak as a linear sample value.

float getPeakDbPre(int outputIdx)#

Per-output pre-volume peak in dBFS (-120 floor for silence).

float getPeakDbPost(int outputIdx)#

Per-output post-volume peak in dBFS (-120 floor for silence).

Public Functions

channel &create(const char *name, channel &parent)#

Create the channel and attach it to the tree.

Must be called before any other method. The pre-built channels (ChannelFX etc.) call this internally.

Parameters:
  • name – Channel name, used for log output.

  • parent – Existing channel to attach to. Use ChannelMaster() for a top-level channel.

channel &setVolume(float value)#

Set the channel volume in the range [0.0, 1.0].

float getVolume()#

Current channel volume.

channel &moveTo(channel &parent)#

Re-parent this channel.

Detaches from the current parent and links to parent. All sounds and subchannels move along.

channel &attachReverb()#

Move the global reverb effect onto this channel.

libYSE runs a single reverb instance for performance reasons. By default it sits on MainMix and affects every channel; call this to restrict reverb to a subtree.

channel &setVirtual(bool value)#

Allow or disallow sounds on this channel to be virtualised.

Virtualised sounds keep their playback state but stop consuming DSP budget — the engine uses this to stay within System().maxSounds(...).

bool getVirtual()#

Whether virtualisation is permitted on this channel.

bool isValid()#

Whether this channel has a live implementation.

inline const char *getName()#

Channel name (the value passed to create).

channel()#

Construct an empty channel.

Channels are only usable after create has been called.

~channel()#

Private Functions

void createGlobal()#

Private Members

Flt volume#
Bool allowVirtual#
std::string name#
CHANNEL::implementationObject *pimpl#

Friends

friend class YSE::system