CoriEngine
Loading...
Searching...
No Matches
Cori::Audio::Mixer Class Reference

Mixer is responsible for mixing all the sounds, it is a global object and there can only be one Mixer. More...

#include <Mixer.hpp>

Classes

struct  Data

Static Public Member Functions

static std::expected< void, Core::CoriError<> > PauseAllTracks ()
 Pauses all Track that are currently playing on the Mixer.
static std::expected< void, Core::CoriError<> > ResumeAllTracks ()
 Resumes all Track that are currently paused on the Mixer.
static std::expected< void, Core::CoriError<> > SetMasterGain (const float gain)
 Sets the master gain of a Mixer.
static float GetMasterGain ()
 Returns the current master gain specified for the Mixer. The default gain for a Mixer is 1.0f.
static std::expected< void, Core::CoriError<> > StartTag (const char *tag, const PlayParams &params=PlayParams{})
 Start (ot restart) mixing all Tracks with a specific tag.
static std::expected< void, Core::CoriError<> > StopTag (const char *tag, const int64_t fadeOutMS=0)
 Stops all Track with a specific tab, possibly fading out over time.
static std::expected< void, Core::CoriError<> > PauseTag (const char *tag)
 Pauses all tracks with a specific tag.
static std::expected< void, Core::CoriError<> > ResumeTag (const char *tag)
 Resumes all Tracks with a specific tag.
static std::expected< void, Core::CoriError<> > SetTagGain (const char *tag, const float gain)
 Sets the gain of all tracks with a specific tag.

Detailed Description

Mixer is responsible for mixing all the sounds, it is a global object and there can only be one Mixer.

Definition at line 82 of file Mixer.hpp.

Member Function Documentation

◆ GetMasterGain()

float Cori::Audio::Mixer::GetMasterGain ( )
static

Returns the current master gain specified for the Mixer. The default gain for a Mixer is 1.0f.

Returns
Current Mixer gain.

Definition at line 45 of file Mixer.cpp.

◆ PauseAllTracks()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::PauseAllTracks ( )
static

Pauses all Track that are currently playing on the Mixer.

Note
Pausing a Track will not fire its stop callback.
Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 18 of file Mixer.cpp.

◆ PauseTag()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::PauseTag ( const char * tag)
static

Pauses all tracks with a specific tag.

Parameters
tagSpecific Track tag.
Note
Pausing a Track will not fire its stop callback.
Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 89 of file Mixer.cpp.

◆ ResumeAllTracks()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::ResumeAllTracks ( )
static

Resumes all Track that are currently paused on the Mixer.

Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 27 of file Mixer.cpp.

◆ ResumeTag()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::ResumeTag ( const char * tag)
static

Resumes all Tracks with a specific tag.

Parameters
tagSpecific Track tag.
Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 98 of file Mixer.cpp.

◆ SetMasterGain()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::SetMasterGain ( const float gain)
static

Sets the master gain of a Mixer.

Parameters
gainSpecified gain, negative values are illegal.

Gain of 0.0f will completely silence the Mixer, value of 1.0f will not change the Mixer volume, values higher than 1.0f will increase the volume. There is no gain limit specified.

Returns
Expected object with void on success or CoriError<> on failure.
Note
Because there is no limit, this can get very load very quickly, be carefully.

Definition at line 36 of file Mixer.cpp.

◆ SetTagGain()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::SetTagGain ( const char * tag,
const float gain )
static

Sets the gain of all tracks with a specific tag.

Parameters
tagSpecific Track tag.
gainSpecified gain, negative values are illegal.

Gain of 0.0f will completely silence the Tracks, value of 1.0f will not change the Tracks volume, values higher than 1.0f will increase the volume. There is no gain limit specified.

Returns
Expected object with void on success or CoriError<> on failure.
Note
Because there is no limit, this can get very loud very quickly, be carefully.

Definition at line 107 of file Mixer.cpp.

◆ StartTag()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::StartTag ( const char * tag,
const PlayParams & params = PlayParams{} )
static

Start (ot restart) mixing all Tracks with a specific tag.

Parameters
tagSpecific Track tag.
paramsA set of parameters to use when starting or restarting Tracks.

This function behaves very similarly to Track::Start, parameters when passed to this function have a 1ms accuracy, no sub millisecond when using this unfortunately.

Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 49 of file Mixer.cpp.

◆ StopTag()

std::expected< void, Core::CoriError<> > Cori::Audio::Mixer::StopTag ( const char * tag,
const int64_t fadeOutMS = 0 )
static

Stops all Track with a specific tab, possibly fading out over time.

Parameters
tagSpecific Track tag.
fadeOutMSNumber of milliseconds to spend fading out to silence before stopping. Optional, 0 by default.

If the Track ends normally while the fade-out is still in progress, the audio stops there. The fade is not adjusted to be shorter if it will last longer than the audio remaining.

Note
If a Track with the specific tag is currently playing a looped sequence, it will not be stoped, only when current Sound that is playing will be.
Returns
Expected object with void on success or CoriError<> on failure.

Definition at line 80 of file Mixer.cpp.


The documentation for this class was generated from the following files: