TTKMusicPlayer
4.1.3.0
TTKMusicPlayer imitates Kugou UI, the music player uses of qmmp core library based on Qt for windows and linux
|
The class of the music player. More...
#include <musicplayer.h>
Public Types | |
enum | Enhance { Enhance::Off, Enhance::M3D, Enhance::NICAM, Enhance::Subwoofer, Enhance::Vocal } |
Public Slots | |
void | play () |
void | pause () |
void | stop () |
void | setEqualizerEffect (const TTKIntList &hz) |
void | setEnabledEffect (bool enabled) |
void | setEqualizerConfig () |
Signals | |
void | stateChanged (TTK::PlayState state) |
void | durationChanged (qint64 duration) |
void | positionChanged (qint64 position) |
Public Member Functions | |
MusicPlayer (QObject *parent=nullptr) | |
~MusicPlayer () | |
bool | isPlaying () const |
TTK::PlayState | state () const |
void | setPlaylist (MusicPlaylist *playlist) |
qint64 | duration () const |
qint64 | position () const |
void | setPosition (qint64 position) |
int | volume () const |
void | setVolume (int volume) |
bool | isMuted () const |
void | setMuted (bool muted) |
void | setEnhanced (Enhance type) |
Enhance | enhanced () const |
Private Slots | |
void | update () |
void | generateDuration () |
Private Member Functions | |
void | setStopState () |
void | setCurrentPlayState (TTK::PlayState state) |
Private Attributes | |
MusicPlaylist * | m_playlist |
TTK::PlayState | m_state |
SoundCore * | m_core |
QTimer | m_timer |
QString | m_currentMedia |
Enhance | m_enhance |
qint64 | m_duration |
int | m_durationTimes |
int | m_volumeMusic3D |
float | m_posOnCircle |
The class of the music player.
Definition at line 31 of file musicplayer.h.
|
strong |
Enumerator | |
---|---|
Off |
enhance off, no any effect |
M3D |
3d music effect |
NICAM |
nicam music effect |
Subwoofer |
subwoofer music effect |
Vocal |
vocal music effect |
Definition at line 36 of file musicplayer.h.
|
explicit |
Object constructor.
Definition at line 9 of file musicplayer.cpp.
References G_CONNECTION_PTR, m_core, m_timer, setEnabledEffect(), TTK_DN_S2MS, and update().
MusicPlayer::~MusicPlayer | ( | ) |
Object destructor.
Definition at line 28 of file musicplayer.cpp.
References m_core, m_timer, and SoundCore::stop().
qint64 MusicPlayer::duration | ( | ) | const |
Get current player duration.
Definition at line 50 of file musicplayer.cpp.
References SoundCore::duration(), and m_core.
Referenced by MusicApplication::duration(), generateDuration(), MusicConsoleModule::positionChanged(), and MusicApplication::positionChanged().
|
signal |
Current duration changed.
Referenced by generateDuration().
MusicPlayer::Enhance MusicPlayer::enhanced | ( | ) | const |
Get current music enhanced effect.
Definition at line 111 of file musicplayer.cpp.
References m_enhance.
Referenced by MusicApplication::writeSystemConfigToFile().
|
privateslot |
Generate current duration by time out.
Definition at line 252 of file musicplayer.cpp.
References duration(), durationChanged(), m_duration, m_durationTimes, position(), positionChanged(), TTK_SIGNLE_SHOT, and TTK_SLOT.
Referenced by play().
bool MusicPlayer::isMuted | ( | ) | const |
Get current player mute state.
Definition at line 76 of file musicplayer.cpp.
References SoundCore::isMuted(), and m_core.
Referenced by update(), volume(), and MusicApplication::volumeMute().
bool MusicPlayer::isPlaying | ( | ) | const |
Get current player is playing or not.
Definition at line 35 of file musicplayer.cpp.
References m_state, and TTK::Playing.
Referenced by MusicApplication::isPlaying(), and MusicConsoleModule::switchToPlayState().
|
slot |
Player to pause.
Definition at line 149 of file musicplayer.cpp.
References m_core, m_state, SoundCore::pause(), TTK::Paused, and setCurrentPlayState().
Referenced by MusicConsoleModule::switchToPlayState(), and MusicApplication::switchToPlayState().
|
slot |
Player to play.
Get the current state of play
When the pause time for recovery
The current playback path
Definition at line 116 of file musicplayer.cpp.
References MusicPlaylist::currentMediaPath(), generateDuration(), MusicPlaylist::isEmpty(), MusicPlaylist::isSameMediaPath(), m_core, m_currentMedia, m_durationTimes, m_playlist, m_timer, SoundCore::pause(), Qmmp::Paused, SoundCore::play(), TTK::Playing, positionChanged(), setCurrentPlayState(), SoundCore::state(), TTK::Stopped, and update().
Referenced by MusicConsoleModule::initialize(), MusicConsoleModule::playNext(), MusicConsoleModule::playPrevious(), MusicConsoleModule::switchToPlayState(), MusicApplication::switchToPlayState(), and update().
qint64 MusicPlayer::position | ( | ) | const |
Get current player position.
Definition at line 55 of file musicplayer.cpp.
References SoundCore::elapsed(), and m_core.
Referenced by generateDuration(), MusicApplication::resetCurrentSongLrcIndex(), and update().
|
signal |
Current position changed.
Referenced by generateDuration(), play(), setStopState(), and update().
|
private |
set current play state.
Definition at line 273 of file musicplayer.cpp.
References m_state, state(), and stateChanged().
Referenced by pause(), play(), setStopState(), and stop().
|
slot |
Set enable to set current equalizer effect.
Definition at line 186 of file musicplayer.cpp.
References setEqualizerEffect().
Referenced by MusicPlayer(), setEqualizerConfig(), and update().
void MusicPlayer::setEnhanced | ( | Enhance | type | ) |
Set current music enhanced effect.
Definition at line 87 of file musicplayer.cpp.
References M3D, m_core, m_enhance, m_volumeMusic3D, NICAM, Off, SoundCore::setBalance(), setEqualizerEffect(), SoundCore::setVolume(), Subwoofer, Vocal, and volume().
Referenced by MusicApplication::enhancedSongChanged(), MusicConsoleModule::setEnhanced3D(), MusicConsoleModule::setEnhancedNICAM(), MusicConsoleModule::setEnhancedOff(), MusicConsoleModule::setEnhancedSubwoofer(), and MusicConsoleModule::setEnhancedVocal().
|
slot |
Read equalizer effect from config file.
Read the equalizer parameters from a configuration file
Definition at line 194 of file musicplayer.cpp.
References MusicSettingManager::EqualizerEnable, MusicSettingManager::EqualizerValue, G_SETTING_PTR, setEnabledEffect(), and setEqualizerEffect().
Referenced by MusicApplication::readSystemConfigFromFile().
|
slot |
Set current equalizer effect.
Definition at line 168 of file musicplayer.cpp.
References EqSettings::EQ_BANDS_10, SoundCore::eqSettings(), m_core, EqSettings::setEnabled(), SoundCore::setEqSettings(), EqSettings::setGain(), and EqSettings::setPreamp().
Referenced by setEnabledEffect(), setEnhanced(), and setEqualizerConfig().
void MusicPlayer::setMuted | ( | bool | muted | ) |
Set current player mute or not.
Definition at line 81 of file musicplayer.cpp.
References m_core, m_volumeMusic3D, SoundCore::setMuted(), and SoundCore::volume().
Referenced by MusicApplication::volumeMute().
void MusicPlayer::setPlaylist | ( | MusicPlaylist * | playlist | ) |
Set current play list.
Definition at line 45 of file musicplayer.cpp.
References m_playlist.
Referenced by MusicConsoleModule::MusicConsoleModule().
void MusicPlayer::setPosition | ( | qint64 | position | ) |
Set current play pos.
Definition at line 60 of file musicplayer.cpp.
References m_core, and SoundCore::seek().
Referenced by MusicApplication::playAnyTimeAt(), and MusicApplication::updateCurrentTime().
|
private |
set current play state to stop.
Definition at line 266 of file musicplayer.cpp.
References m_core, positionChanged(), setCurrentPlayState(), SoundCore::stop(), and TTK::Stopped.
Referenced by update().
void MusicPlayer::setVolume | ( | int | volume | ) |
Set current player volume.
Definition at line 70 of file musicplayer.cpp.
References m_core, m_volumeMusic3D, SoundCore::setVolume(), and volume().
Referenced by MusicConsoleModule::initialize(), MusicConsoleModule::playNext(), MusicConsoleModule::playPrevious(), MusicConsoleModule::resetVolume(), MusicMPRISPlayerCore::setVolume(), MusicConsoleModule::switchToPlayState(), MusicApplication::volumeChanged(), MusicConsoleModule::volumeDown(), and MusicConsoleModule::volumeUp().
TTK::PlayState MusicPlayer::state | ( | ) | const |
Get current player state.
Definition at line 40 of file musicplayer.cpp.
References m_state.
Referenced by setCurrentPlayState().
|
signal |
Current state changed.
Referenced by setCurrentPlayState().
|
slot |
Player to stop.
Definition at line 158 of file musicplayer.cpp.
References m_core, m_state, m_timer, setCurrentPlayState(), SoundCore::stop(), and TTK::Stopped.
Referenced by MusicConsoleModule::currentIndexChanged(), MusicApplication::playedIndexBy(), MusicApplication::playIndexBy(), MusicApplication::playNext(), MusicApplication::playPrevious(), MusicApplication::removeItemAt(), and MusicApplication::showCurrentSong().
|
privateslot |
Player one second time out.
3D music settings
Definition at line 214 of file musicplayer.cpp.
References MusicPlaylist::currentIndex(), Qmmp::FatalError, isMuted(), M3D, m_core, m_enhance, m_playlist, m_posOnCircle, m_timer, Qmmp::NormalError, TTK::Once, TTK::Order, play(), MusicPlaylist::playbackMode(), position(), positionChanged(), MusicPlaylist::setCurrentIndex(), setEnabledEffect(), setStopState(), SoundCore::setVolume(), SoundCore::state(), Qmmp::Stopped, TTK_LOW_LEVEL, and TTK_RN_MAX.
Referenced by MusicPlayer(), and play().
int MusicPlayer::volume | ( | ) | const |
Get current player volume.
Definition at line 65 of file musicplayer.cpp.
References isMuted(), m_core, and SoundCore::volume().
Referenced by MusicConsoleModule::print(), setEnhanced(), setVolume(), MusicMPRISPlayerCore::volume(), MusicConsoleModule::volumeDown(), MusicApplication::volumeDown(), MusicApplication::volumeMute(), MusicConsoleModule::volumeUp(), and MusicApplication::volumeUp().
|
private |
Definition at line 169 of file musicplayer.h.
Referenced by duration(), isMuted(), MusicPlayer(), pause(), play(), position(), setEnhanced(), setEqualizerEffect(), setMuted(), setPosition(), setStopState(), setVolume(), stop(), update(), volume(), and ~MusicPlayer().
|
private |
Definition at line 171 of file musicplayer.h.
Referenced by play().
|
private |
Definition at line 173 of file musicplayer.h.
Referenced by generateDuration().
|
private |
Definition at line 175 of file musicplayer.h.
Referenced by generateDuration(), and play().
|
private |
Definition at line 172 of file musicplayer.h.
Referenced by enhanced(), setEnhanced(), and update().
|
private |
Definition at line 167 of file musicplayer.h.
Referenced by play(), setPlaylist(), and update().
|
private |
Definition at line 177 of file musicplayer.h.
Referenced by update().
|
private |
Definition at line 168 of file musicplayer.h.
Referenced by isPlaying(), pause(), setCurrentPlayState(), state(), and stop().
|
private |
Definition at line 170 of file musicplayer.h.
Referenced by MusicPlayer(), play(), stop(), update(), and ~MusicPlayer().
|
private |
Definition at line 176 of file musicplayer.h.
Referenced by setEnhanced(), setMuted(), and setVolume().