Skip to content
Igor Zinken edited this page Apr 28, 2020 · 2 revisions

You can think of a ChannelGroup as a bus or group track. One or more AudioChannels can be assigned to this group which implies that the collective output of these channels goes through the ChannelGroup, before it hits the master bus. This is especially useful if you want to apply the same effects processing to a group of channels without having to duplicate the same ProcessingChain over and over.

You can register and unregister a ChannelGroup into the engine using add|removeChannelGroup in either audioengine.cpp (when using MWEngine in C++) or using MWEngine.java (when using MWEngine from Java).

constructors / destructor

ChannelGroup::ChannelGroup();
ChannelGroup::ChannelGroup( float volume );

Creates a new instance of a ChannelGroup. Optional volume is a value in the 0 - 1 range. This defaults to 1.F for full volume. This volume can be used to attenuate the audio of all of the groups channels.

ChannelGroup::~ChannelGroup();

public methods

float getVolume();
float getVolumeLogarithmic();

Retrieves the groups volume. Internally the getVolumeLogarithmic() method is used to provide a more natural, gradual sounding result than the linear result of getVolume().

void setVolume( float value );

Set the volume where value is in the 0 - 1 range.

ProcessingChain* getProcessingChain();

Retrieves the ProcessingChain attached to the group.

bool addAudioChannel( AudioChannel* audioChannel );

Adds given audioChannel to the group. Returns boolean success when added / ignored.

bool removeAudioChannel( AudioChannel* audioChannel );

Removes given audioChannel from the group. Returns boolean success when removed / ignored

bool containsAudioChannel( AudioChannel* audioChannel );

Whether given audioChannel is present in the group.

bool applyEffectsToChannels( AudioBuffer* bufferToMixInto );

Invoked from the AudioEngine, this applies all attached Processors in the ProcessingChain onto the combined output of all AudioChannels, and is written into given bufferToMixInto.

Clone this wiki locally