Qmmp
Loading...
Searching...
No Matches
SoundCore Class Reference

#include <qmmp/soundcore.h>

Public Slots

void setVolumePerChannel (int left, int right)
void setMuted (bool mute)
void changeVolume (int delta)
void setVolume (int volume)
void volumeUp ()
void volumeDown ()
void setBalance (int balance)
bool play (const QString &source, bool queue=false, qint64 offset=-1)
void stop ()
void pause ()
void seek (qint64 pos)
void seekRelative (qint64 offset)

Signals

void bufferingProgress (int progress)
void elapsedChanged (qint64 time)
void bitrateChanged (int bitrate)
void audioParametersChanged (const AudioParameters &p)
void streamInfoChanged ()
void trackInfoChanged ()
void stateChanged (Qmmp::State newState)
void finished ()
void mutedChanged (bool muted)
void volumeChanged (int volume)
void balanceChanged (int balance)
void eqSettingsChanged ()
void nextTrackRequest ()

Public Member Functions

 SoundCore (QObject *parent=nullptr)
 ~SoundCore ()
qint64 duration () const
EqSettings eqSettings () const
void setEqSettings (const EqSettings &settings)
int leftVolume () const
int rightVolume () const
int volume () const
int balance () const
bool isMuted () const
qint64 elapsed () const
int bitrate () const
AudioParameters audioParameters () const
Qmmp::State state () const
const QMap< Qmmp::MetaData, QString > & metaData () const
QString metaData (Qmmp::MetaData key) const
const QHash< QString, QString > & streamInfo () const
const TrackInfotrackInfo () const
bool nextTrackAccepted () const
const QString path () const

Static Public Member Functions

static SoundCoreinstance ()

Detailed Description

The SoundCore class provides a simple interface for audio playback.

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

Constructor & Destructor Documentation

◆ SoundCore()

SoundCore ( QObject * parent = nullptr)

Object constructor.

Parameters
parentParent object.

◆ ~SoundCore()

~SoundCore ( )

Destructor.

Member Function Documentation

◆ audioParameters()

AudioParameters audioParameters ( ) const

Returns output audio parameters.

◆ audioParametersChanged

void audioParametersChanged ( const AudioParameters & p)
signal

Emitted when audio parameters have changed.

Parameters
pNew audio parameters for output.

◆ balance()

int balance ( ) const

Returns the balance between left and right channels.

◆ balanceChanged

void balanceChanged ( int balance)
signal

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

Parameters
balancenew balance value.

◆ bitrate()

int bitrate ( ) const

Returns current bitrate (in kbps)

◆ bitrateChanged

void bitrateChanged ( int bitrate)
signal

Emitted when bitrate has changed.

Parameters
bitrateNew bitrate (in kbps)

◆ bufferingProgress

void bufferingProgress ( int progress)
signal

This signal is emitted when the stream reader fills it's buffer. The argument progress indicates the current percentage of buffering completed.

◆ changeVolume

void changeVolume ( int delta)
slot

Changes volume by delta percent

◆ duration()

qint64 duration ( ) const

Returns length in milliseconds

◆ elapsed()

qint64 elapsed ( ) const

Returns the current time (in milliseconds).

◆ elapsedChanged

void elapsedChanged ( qint64 time)
signal

Tracks elapesed time.

Parameters
timeNew track position in milliseconds.

◆ eqSettings()

EqSettings eqSettings ( ) const

Returns equalizer settings

◆ eqSettingsChanged

void eqSettingsChanged ( )
signal

Emitted when equalizer settings has changed.

◆ finished

void finished ( )
signal

Emitted when playback has finished.

◆ instance()

SoundCore * instance ( )
static

Returns a pointer to the SoundCore instance.

◆ isMuted()

bool isMuted ( ) const

Returns true if volume is unmuted, otherwise returns false

◆ leftVolume()

int leftVolume ( ) const

Returns left volume level.

◆ metaData() [1/2]

const QMap< Qmmp::MetaData, QString > & metaData ( ) const

Returns all meta data in map.

◆ metaData() [2/2]

QString metaData ( Qmmp::MetaData key) const

Returns the metdata string associated with the given key.

◆ mutedChanged

void mutedChanged ( bool muted)
signal

Emitted when volume has muted or restored

Parameters
mutednew state of the volume (true - muted, false - unmuted)

◆ nextTrackAccepted()

bool nextTrackAccepted ( ) const

Indicates that the current active engine will be used for the next queued track. May be useful for some effect plugins.

◆ nextTrackRequest

void nextTrackRequest ( )
signal

Emitted before playback ends. Use this signal to append new url to the queue.

◆ path()

const QString path ( ) const

This function returns file path or stream url.

◆ pause

void pause ( )
slot

Pauses/resumes playback

◆ play

bool play ( const QString & source,
bool queue = false,
qint64 offset = -1 )
slot

This function plays file or stream with the given path source. Returns true if playback has been started successful or source is not a local file, otherwise returns false. Useful for invalid files skipping.

◆ rightVolume()

int rightVolume ( ) const

Returns left volume level.

◆ seek

void seek ( qint64 pos)
slot

This function sets the current play position to pos in milliseconds.

◆ seekRelative

void seekRelative ( qint64 offset)
slot

This function seeks relatively from the current playback position.

Parameters
offsetOffset from the current playback possition in millisecnds (positive or negative value).

◆ setBalance

void setBalance ( int balance)
slot

Sets the balance between left and right channels.

Parameters
balancebalance between left and right channels [-100..100].

◆ setEqSettings()

void setEqSettings ( const EqSettings & settings)

Chages equalizer settings to settings.

◆ setMuted

void setMuted ( bool mute)
slot

Mutes/Restores volume

Parameters
mute- state of volume (true - mute, false - restore)

◆ setVolume

void setVolume ( int volume)
slot

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

Parameters
volumevolume of the left and right channels [0..100].

◆ setVolumePerChannel

void setVolumePerChannel ( int left,
int right )
slot

Sets volume.

Parameters
left- volume of the left channel [0..100].
right- volume of the right channel [0..100].

◆ state()

Qmmp::State state ( ) const

Returns the current state.

◆ stateChanged

void stateChanged ( Qmmp::State newState)
signal

This signal is emitted when the state of the SoundCore has changed.

◆ stop

void stop ( )
slot

Stops playback

◆ streamInfo()

const QHash< QString, QString > & streamInfo ( ) const

Returns a hash of stream information if available

◆ streamInfoChanged

void streamInfoChanged ( )
signal

Emitted when new stream information is available.

◆ trackInfo()

const TrackInfo & trackInfo ( ) const

Returns current track information.

◆ trackInfoChanged

void trackInfoChanged ( )
signal

Emitted when new track information is available.

◆ volume()

int volume ( ) const

Returns the highest volume of the left and right channels.

◆ volumeChanged

void 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.

◆ volumeDown

void volumeDown ( )
slot

Decreases volume by volume adjustment step.

◆ volumeUp

void volumeUp ( )
slot

Increases volume by volume adjustment step.


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