TTKMusicPlayer  3.7.0.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
Public Slots | Signals | Public Member Functions | Static Public Member Functions | Private Attributes | Static Private Attributes | List of all members
VolumeHandler Class Reference

The VolumeHandler class provides volume control access. More...

#include <volumehandler.h>

+ Inheritance diagram for VolumeHandler:

Public Slots

void checkVolume ()
 
void reload ()
 

Signals

void volumeChanged (int volume)
 
void balanceChanged (int balance)
 
void mutedChanged (bool muted)
 

Public Member Functions

 VolumeHandler (QObject *parent=nullptr)
 
 ~VolumeHandler ()
 
void setVolume (int left, int right)
 
void changeVolume (int delta)
 
void setVolume (int volume)
 
void setBalance (int balance)
 
void setMuted (bool muted)
 
int left () const
 
int right () const
 
int volume () const
 
int balance () const
 
bool isMuted () const
 
void apply (Buffer *b, int chan)
 

Static Public Member Functions

static VolumeHandlerinstance ()
 

Private Attributes

VolumeSettings m_settings
 
bool m_prev_block = false
 
std::atomic_bool m_muted = ATOMIC_VAR_INIT(false)
 
std::atomic_bool m_apply = ATOMIC_VAR_INIT(false)
 
QMutex m_mutex
 
double m_scaleLeft = 0
 
double m_scaleRight = 0
 
Volumem_volume = nullptr
 
QTimer * m_timer = nullptr
 

Static Private Attributes

static VolumeHandlerm_instance
 

Detailed Description

The VolumeHandler class provides volume control access.

Author
Ilya Kotov forko.nosp@m.tov0.nosp@m.2@ya..nosp@m.ru

Definition at line 36 of file volumehandler.h.

Constructor & Destructor Documentation

VolumeHandler::VolumeHandler ( QObject *  parent = nullptr)
explicit

Object constructor.

Parameters
parentParent object.
VolumeHandler::~VolumeHandler ( )

Destructor.

Member Function Documentation

void VolumeHandler::apply ( Buffer b,
int  chan 
)

Changes buffer volume (software mode only).

Parameters
bBuffer pointer.
chanNumber of channels.
int VolumeHandler::balance ( ) const

Returns the balance between left and right channels.

void VolumeHandler::balanceChanged ( int  balance)
signal

Emitted when the balance between left and right channels has changed.

Parameters
balanceNew balance value.
void VolumeHandler::changeVolume ( int  delta)

Changes volume by delta percent

void VolumeHandler::checkVolume ( )
slot

Forces the volumeChanged signal to emit.

static VolumeHandler* VolumeHandler::instance ( )
static

Returns a pointer to the global VolumeHandler instance.

bool VolumeHandler::isMuted ( ) const

Returns true if volume is muted, otherwise returns false.

int VolumeHandler::left ( ) const

Returns left channel volume.

void VolumeHandler::mutedChanged ( bool  muted)
signal

Emitted when volume mute state has changed

Parameters
mutedNew volume mute state.
void VolumeHandler::reload ( )
slot

Updates volume configuration

int VolumeHandler::right ( ) const

Returns right channel volume.

void VolumeHandler::setBalance ( int  balance)

Sets the balance between left and right channels.

Parameters
balancebalance between left and right channels [-100..100].
void VolumeHandler::setMuted ( bool  muted)

Sets volume mute state to muted.

void VolumeHandler::setVolume ( int  left,
int  right 
)

Setups volume level. Subclass should reimplement this fucntion.

Parameters
leftLeft channel volume level. It should be 0..100
rightRight channel volume level. It should be 0..100
void VolumeHandler::setVolume ( int  volume)

Sets the volume of the left and right channels with keeping of the balance.

Parameters
volumevolume of the left and right channels [0..100].
int VolumeHandler::volume ( ) const

Returns the maximum volume of the left and right channels.

void VolumeHandler::volumeChanged ( int  volume)
signal

Emitted when the highest volume of the left and right channels has changed.

Parameters
volumeNew value of the highest volume of the left and right channels.

Member Data Documentation

std::atomic_bool VolumeHandler::m_apply = ATOMIC_VAR_INIT(false)
private

Definition at line 137 of file volumehandler.h.

VolumeHandler* VolumeHandler::m_instance
staticprivate

Definition at line 142 of file volumehandler.h.

std::atomic_bool VolumeHandler::m_muted = ATOMIC_VAR_INIT(false)
private

Definition at line 136 of file volumehandler.h.

QMutex VolumeHandler::m_mutex
private

Definition at line 138 of file volumehandler.h.

bool VolumeHandler::m_prev_block = false
private

Definition at line 135 of file volumehandler.h.

double VolumeHandler::m_scaleLeft = 0
private

Definition at line 139 of file volumehandler.h.

double VolumeHandler::m_scaleRight = 0
private

Definition at line 139 of file volumehandler.h.

VolumeSettings VolumeHandler::m_settings
private

Definition at line 134 of file volumehandler.h.

QTimer* VolumeHandler::m_timer = nullptr
private

Definition at line 141 of file volumehandler.h.

Volume* VolumeHandler::m_volume = nullptr
private

Definition at line 140 of file volumehandler.h.


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