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::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.-
namespace CHANNEL#
-
namespace CHANNEL#
-
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::DSPfor signal processing,YSE::MIDIfor MIDI I/O,YSE::MUSICfor note / chord / motif primitives.Note
Apart from their constructors, the oscillator and
vcfclasses must only be invoked from inside a DSP callback /processbody.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.
-
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:
ChannelMaster()— the root of the tree.ChannelFX()— short sound effects.ChannelMusic()— playlists and music.ChannelAmbient()— environmental loops.ChannelVoice()— dialogue.ChannelGui()— UI feedback.
Use them as-is or as roots for your own subtrees.
See also
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).
Prereads the peak measured at the end ofdsp()(after reverb/underwater FX, before the channel volume is applied);Postreads the peak measured immediately afteradjustVolume()— 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 (
-120floor for silence).
-
float getPeakDbPost()#
Combined post-volume peak in dBFS (
-120floor 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 (
-120floor for silence).
-
float getPeakDbPost(int outputIdx)#
Per-output post-volume peak in dBFS (
-120floor 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 (
ChannelFXetc.) call this internally.- Parameters:
name – Channel name, used for log output.
parent – Existing channel to attach to. Use
ChannelMaster()for a top-level channel.
-
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
MainMixand 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
createhas been called.
-
~channel()#
Private Functions
-
void createGlobal()#
Friends
- friend class YSE::system
-
channel &ChannelMaster()#