Phosphor
Qt6 / Wayland library suite for window-management tools
Loading...
Searching...
No Matches
PhosphorAudio::CavaSpectrumProvider Class Reference

#include <PhosphorAudio/CavaSpectrumProvider.h>

Inheritance diagram for PhosphorAudio::CavaSpectrumProvider:
[legend]

Public Member Functions

 CavaSpectrumProvider (QObject *parent=nullptr)
 ~CavaSpectrumProvider () override
bool isAvailable () const override
void start () override
void stop () override
bool isRunning () const override
SpectrumOptions options () const override
 The provider's current (normalized) parameter set.
void setOptions (const SpectrumOptions &options) override
 Apply a full parameter set.
QVector< float > spectrum () const override
Public Member Functions inherited from PhosphorAudio::IAudioSpectrumProvider
 IAudioSpectrumProvider (QObject *parent=nullptr)
 ~IAudioSpectrumProvider () override=default

Static Public Member Functions

static bool isCavaInstalled ()
static QString detectAudioMethod ()
static SpectrumOptions normalizedOptions (SpectrumOptions options)
 Clamp/sanitize an option set to the values the provider would actually run with: integer ranges bounded to AudioDefaults, bar count rounded up to even, control characters stripped from the input strings, and unknown input methods coerced back to auto-detect (empty).
static QString generateConfig (const SpectrumOptions &options)
 The cava config-file text the provider would run options with (normalized first, so hostile or out-of-range values are emitted in their sanitized form).

Additional Inherited Members

Signals inherited from PhosphorAudio::IAudioSpectrumProvider
void spectrumUpdated (const QVector< float > &spectrum)
void runningChanged (bool running)
void errorOccurred (const QString &message)

Constructor & Destructor Documentation

◆ CavaSpectrumProvider()

PhosphorAudio::CavaSpectrumProvider::CavaSpectrumProvider ( QObject * parent = nullptr)
explicit

◆ ~CavaSpectrumProvider()

PhosphorAudio::CavaSpectrumProvider::~CavaSpectrumProvider ( )
override

Member Function Documentation

◆ detectAudioMethod()

QString PhosphorAudio::CavaSpectrumProvider::detectAudioMethod ( )
static

◆ generateConfig()

QString PhosphorAudio::CavaSpectrumProvider::generateConfig ( const SpectrumOptions & options)
static

The cava config-file text the provider would run options with (normalized first, so hostile or out-of-range values are emitted in their sanitized form).

This is what start() writes to cava's stdin; exposed so the generated config is testable without spawning cava.

◆ isAvailable()

bool PhosphorAudio::CavaSpectrumProvider::isAvailable ( ) const
overridevirtual

◆ isCavaInstalled()

bool PhosphorAudio::CavaSpectrumProvider::isCavaInstalled ( )
static

◆ isRunning()

bool PhosphorAudio::CavaSpectrumProvider::isRunning ( ) const
overridevirtual

◆ normalizedOptions()

SpectrumOptions PhosphorAudio::CavaSpectrumProvider::normalizedOptions ( SpectrumOptions options)
static

Clamp/sanitize an option set to the values the provider would actually run with: integer ranges bounded to AudioDefaults, bar count rounded up to even, control characters stripped from the input strings, and unknown input methods coerced back to auto-detect (empty).

Public so callers can preview the applied values before committing a set.

◆ options()

SpectrumOptions PhosphorAudio::CavaSpectrumProvider::options ( ) const
overridevirtual

The provider's current (normalized) parameter set.

Implements PhosphorAudio::IAudioSpectrumProvider.

◆ setOptions()

void PhosphorAudio::CavaSpectrumProvider::setOptions ( const SpectrumOptions & options)
overridevirtual

Apply a full parameter set.

Implementations normalize the values, no-op when nothing changed, and restart capture at most once for however many fields differ.

Implements PhosphorAudio::IAudioSpectrumProvider.

◆ spectrum()

QVector< float > PhosphorAudio::CavaSpectrumProvider::spectrum ( ) const
overridevirtual

◆ start()

void PhosphorAudio::CavaSpectrumProvider::start ( )
overridevirtual

◆ stop()

void PhosphorAudio::CavaSpectrumProvider::stop ( )
overridevirtual

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