MPD: MultipleOutputs Class Reference

MPD 0.20.18

Public Member Functions
MultipleOutputs Class Reference

`#include <MultipleOutputs.hxx>`

## Public Member Functions
| MultipleOutputs (MixerListener &_mixer_listener)
| Load audio outputs from the configuration file and initialize them. More...
| ~MultipleOutputs ()
void | Configure (EventLoop &event_loop, const ReplayGainConfig &replay_gain_config, AudioOutputClient &client)
gcc_pure unsigned | Size () const noexcept
| Returns the total number of audio output devices, including those which are disabled right now. More...
const AudioOutput & | Get (unsigned i) const
| Returns the "i"th audio output device. More...
AudioOutput & | Get (unsigned i)
gcc_pure AudioOutput * | FindByName (const char *name) const noexcept
| Returns the audio output device with the specified name. More...
void | EnableDisable ()
| Checks the "enabled" flag of all audio outputs, and if one has changed, commit the change. More...
void | Open (const AudioFormat audio_format, MusicBuffer &_buffer)
| Opens all audio outputs which are not disabled. More...
void | Close ()
| Closes all audio outputs. More...
void | Release ()
| Closes all audio outputs. More...
void | SetReplayGainMode (ReplayGainMode mode)
void | Play (MusicChunk *chunk)
| Enqueue a MusicChunk object for playing, i.e. More...
unsigned | Check ()
| Checks if the output devices have drained their music pipe, and returns the consumed music chunks to the #music_buffer. More...
void | Pause ()
| Puts all audio outputs into pause mode. More...
void | Drain ()
| Drain all audio outputs. More...
void | Cancel ()
| Try to cancel data which may still be in the device's buffers. More...
void | SongBorder ()
| Indicate that a new song will begin now. More...
gcc_pure SignedSongTime | GetElapsedTime () const noexcept
| Returns the "elapsed_time" stamp of the most recently finished chunk. More...
gcc_pure int | GetVolume () const noexcept
| Returns the average volume of all available mixers (range 0..100). More...
bool | SetVolume (unsigned volume) noexcept
| Sets the volume on all available mixers. More...
gcc_pure int | GetSoftwareVolume () const noexcept
| Similar to GetVolume(), but gets the volume only for software mixers. More...
void | SetSoftwareVolume (unsigned volume) noexcept
| Similar to SetVolume(), but sets the volume only for software mixers. More...

## Detailed Description

Definition at line 47 of file MultipleOutputs.hxx.

## Constructor & Destructor Documentation

## ◆ MultipleOutputs()

MultipleOutputs::MultipleOutputs | ( | MixerListener & | _mixer_listener | ) |

Load audio outputs from the configuration file and initialize them.

## ◆ ~MultipleOutputs()

MultipleOutputs::~MultipleOutputs | ( |  | ) |

## Member Function Documentation

## ◆ Cancel()

void MultipleOutputs::Cancel | ( |  | ) |

Try to cancel data which may still be in the device's buffers.

## ◆ Check()

unsigned MultipleOutputs::Check | ( |  | ) |

Checks if the output devices have drained their music pipe, and returns the consumed music chunks to the #music_buffer.

Returns
  the number of chunks to play left in the MusicPipe

## ◆ Close()

void MultipleOutputs::Close | ( |  | ) |

Closes all audio outputs.

## ◆ Configure()

void MultipleOutputs::Configure | ( | EventLoop & | event_loop,
|  | const ReplayGainConfig & | replay_gain_config,
|  | AudioOutputClient & | client
| ) |  |

## ◆ Drain()

void MultipleOutputs::Drain | ( |  | ) |

Drain all audio outputs.

## ◆ EnableDisable()

void MultipleOutputs::EnableDisable | ( |  | ) |

Checks the "enabled" flag of all audio outputs, and if one has changed, commit the change.

## ◆ FindByName()

gcc_pure AudioOutput* MultipleOutputs::FindByName | ( | const char * | name | ) | const
| noexcept

Returns the audio output device with the specified name.

Returns nullptr if the name does not exist.

## ◆ Get() [1/2]

const AudioOutput& MultipleOutputs::Get | ( | unsigned | i | ) | const
| inline

Returns the "i"th audio output device.

Definition at line 95 of file MultipleOutputs.hxx.

## ◆ Get() [2/2]

AudioOutput& MultipleOutputs::Get | ( | unsigned | i | ) |
| inline

Definition at line 101 of file MultipleOutputs.hxx.

## ◆ GetElapsedTime()

gcc_pure SignedSongTime MultipleOutputs::GetElapsedTime | ( |  | ) | const
| inlinenoexcept

Returns the "elapsed_time" stamp of the most recently finished chunk.

A negative value is returned when no chunk has been finished yet.

Definition at line 189 of file MultipleOutputs.hxx.

## ◆ GetSoftwareVolume()

gcc_pure int MultipleOutputs::GetSoftwareVolume | ( |  | ) | const
| noexcept

Similar to GetVolume(), but gets the volume only for software mixers.

See software_mixer_plugin. This function fails if no software mixer is configured.

## ◆ GetVolume()

gcc_pure int MultipleOutputs::GetVolume | ( |  | ) | const
| noexcept

Returns the average volume of all available mixers (range 0..100).

Returns -1 if no mixer can be queried.

## ◆ Open()

void MultipleOutputs::Open | ( | const AudioFormat | audio_format,
|  | MusicBuffer & | _buffer
| ) |  |

Opens all audio outputs which are not disabled.

Throws #std::runtime_error on error.

Parameters

  audio_format | the preferred audio format
  _buffer | the #music_buffer where consumed MusicChunk objects should be returned

## ◆ Pause()

void MultipleOutputs::Pause | ( |  | ) |

Puts all audio outputs into pause mode.

Most implementations will simply close it then.

## ◆ Play()

void MultipleOutputs::Play | ( | MusicChunk * | chunk | ) |

Enqueue a MusicChunk object for playing, i.e.

pushes it to a MusicPipe.

Throws #std::runtime_error on error (all closed then).

Parameters

  chunk | the MusicChunk object to be played

## ◆ Release()

void MultipleOutputs::Release | ( |  | ) |

Closes all audio outputs.

Outputs with the "always_on" flag are put into pause mode.

## ◆ SetReplayGainMode()

void MultipleOutputs::SetReplayGainMode | ( | ReplayGainMode | mode | ) |

## ◆ SetSoftwareVolume()

void MultipleOutputs::SetSoftwareVolume | ( | unsigned | volume | ) |
| noexcept

Similar to SetVolume(), but sets the volume only for software mixers.

See software_mixer_plugin. This function cannot fail, because the underlying software mixers cannot fail either.

## ◆ SetVolume()

bool MultipleOutputs::SetVolume | ( | unsigned | volume | ) |
| noexcept

Sets the volume on all available mixers.

Parameters

  volume | the volume (range 0..100)

Returns
  true on success, false on failure

## ◆ Size()

gcc_pure unsigned MultipleOutputs::Size | ( |  | ) | const
| inlinenoexcept

Returns the total number of audio output devices, including those which are disabled right now.

Definition at line 88 of file MultipleOutputs.hxx.

## ◆ SongBorder()

void MultipleOutputs::SongBorder | ( |  | ) |

Indicate that a new song will begin now.

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

- output/MultipleOutputs.hxx