|
TTKMusicPlayer
4.3.0.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>
Inheritance diagram for MusicPlayer:Classes | |
| struct | Data |
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 noexcept |
| TTK::PlayState | state () const noexcept |
| void | setPlaylist (MusicPlaylist *playlist) noexcept |
| qint64 | duration () const |
| qint64 | position () const |
| void | setPosition (qint64 position) |
| int | volume () const |
| void | setVolume (int volume) |
| bool | isMuted () const noexcept |
| void | setMuted (bool muted) |
| void | setEnhance (TTK::Enhance type) |
| TTK::Enhance | enhance () const noexcept |
Private Slots | |
| void | update () |
| void | generateDuration () |
Private Member Functions | |
| void | setStopState () |
| void | setCurrentPlayState (TTK::PlayState state) noexcept |
Private Attributes | |
| MusicPlaylist * | m_playlist |
| TTK::PlayState | m_state |
| SoundCore * | m_core |
| QTimer | m_timer |
| QString | m_currentMedia |
| qint64 | m_duration |
| int | m_durationTimes |
| struct MusicPlayer::Data | m_enhance |
The class of the music player.
Definition at line 46 of file musicplayer.h.
|
explicit |
Object constructor.
Definition at line 10 of file musicplayer.cpp.
References m_core, m_timer, setEnabledEffect(), TTK_CONNECTIONPOOL_REGISTER, TTK_DN_S2MS, and update().
| MusicPlayer::~MusicPlayer | ( | ) |
Object destructor.
Definition at line 27 of file musicplayer.cpp.
References m_core, m_timer, and SoundCore::stop().
| qint64 MusicPlayer::duration | ( | ) | const |
Get current player duration.
Definition at line 49 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().
|
noexcept |
Get current media enhance effect.
Definition at line 110 of file musicplayer.cpp.
References m_enhance, and MusicPlayer::Data::m_type.
Referenced by MusicApplication::writeSystemConfigToFile().
|
privateslot |
Generate current duration by time out.
Definition at line 271 of file musicplayer.cpp.
References MusicPlaylist::currentItem(), duration(), durationChanged(), TTK::generateNetworkSongTime(), m_duration, m_durationTimes, MusicPlayItem::m_path, m_playlist, MusicPlayItem::m_playlistRow, MUSIC_NETWORK_LIST, position(), positionChanged(), TTK_SIGNLE_SHOT, and TTK_SLOT.
Referenced by play().
|
noexcept |
Get current player mute state.
Definition at line 75 of file musicplayer.cpp.
References SoundCore::isMuted(), and m_core.
Referenced by update(), volume(), and MusicApplication::volumeMute().
|
noexcept |
Get current player is playing or not.
Definition at line 34 of file musicplayer.cpp.
References m_state, and TTK::Playing.
Referenced by MusicApplication::isPlaying(), and MusicConsoleModule::switchToPlayState().
|
slot |
Player to pause.
Definition at line 160 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 115 of file musicplayer.cpp.
References MusicPlaylist::currentItem(), generateDuration(), TTK::generateNetworkSongPath(), MusicPlaylist::isEmpty(), m_core, m_currentMedia, m_durationTimes, MusicPlayItem::m_path, m_playlist, MusicPlayItem::m_playlistRow, m_timer, MUSIC_NETWORK_LIST, SoundCore::pause(), Qmmp::Paused, SoundCore::play(), TTK::Playing, positionChanged(), setCurrentPlayState(), SoundCore::state(), Qmmp::Stopped, 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 54 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().
|
privatenoexcept |
set current play state.
Definition at line 303 of file musicplayer.cpp.
Referenced by pause(), play(), setStopState(), and stop().
|
slot |
Set enable to set current equalizer effect.
Definition at line 198 of file musicplayer.cpp.
References setEqualizerEffect().
Referenced by MusicPlayer(), setEqualizerConfig(), and update().
| void MusicPlayer::setEnhance | ( | TTK::Enhance | type | ) |
Set current media enhance effect.
Definition at line 86 of file musicplayer.cpp.
References TTK::M3D, m_core, m_enhance, MusicPlayer::Data::m_type, MusicPlayer::Data::m_volume3D, TTK::NICAM, TTK::Off, SoundCore::setBalance(), setEqualizerEffect(), SoundCore::setVolumePerChannel(), TTK::Subwoofer, TTK::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 206 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 180 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(), setEnhance(), and setEqualizerConfig().
| void MusicPlayer::setMuted | ( | bool | muted | ) |
Set current player mute or not.
Definition at line 80 of file musicplayer.cpp.
References m_core, m_enhance, MusicPlayer::Data::m_volume3D, SoundCore::setMuted(), and SoundCore::volume().
Referenced by MusicApplication::volumeMute().
|
noexcept |
Set current play list.
Definition at line 44 of file musicplayer.cpp.
Referenced by MusicConsoleModule::MusicConsoleModule().
| void MusicPlayer::setPosition | ( | qint64 | position | ) |
Set current play pos.
Definition at line 59 of file musicplayer.cpp.
References m_core, and SoundCore::seek().
Referenced by MusicApplication::playTimePosition(), and MusicApplication::updateCurrentTime().
|
private |
set current play state to stop.
Definition at line 296 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 69 of file musicplayer.cpp.
References m_core, m_enhance, MusicPlayer::Data::m_volume3D, SoundCore::setVolume(), and volume().
Referenced by MusicConsoleModule::initialize(), MusicConsoleModule::playNext(), MusicConsoleModule::playPrevious(), MusicMPRISPlayerCore::setVolume(), MusicConsoleModule::switchToPlayState(), MusicApplication::volumeChanged(), MusicConsoleModule::volumeDown(), and MusicConsoleModule::volumeUp().
|
noexcept |
|
signal |
Current state changed.
|
slot |
Player to stop.
Definition at line 169 of file musicplayer.cpp.
References m_core, m_currentMedia, 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 226 of file musicplayer.cpp.
References MusicPlaylist::currentIndex(), Qmmp::FatalError, isMuted(), TTK::M3D, MusicPlayer::Data::m_circlePos, m_core, m_currentMedia, m_enhance, m_playlist, m_state, m_timer, MusicPlayer::Data::m_type, Qmmp::NormalError, TTK::Once, TTK::Order, TTK::Paused, play(), MusicPlaylist::playbackMode(), position(), positionChanged(), MusicPlaylist::setCurrentIndex(), setEnabledEffect(), setStopState(), SoundCore::setVolumePerChannel(), 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 64 of file musicplayer.cpp.
References isMuted(), m_core, and SoundCore::volume().
Referenced by MusicConsoleModule::print(), setEnhance(), setVolume(), MusicMPRISPlayerCore::volume(), MusicConsoleModule::volumeDown(), MusicApplication::volumeDown(), MusicApplication::volumeMute(), MusicConsoleModule::volumeUp(), and MusicApplication::volumeUp().
|
private |
Definition at line 175 of file musicplayer.h.
Referenced by duration(), isMuted(), MusicPlayer(), pause(), play(), position(), setEnhance(), setEqualizerEffect(), setMuted(), setPosition(), setStopState(), setVolume(), stop(), update(), volume(), and ~MusicPlayer().
|
private |
Definition at line 177 of file musicplayer.h.
|
private |
Definition at line 178 of file musicplayer.h.
Referenced by generateDuration().
|
private |
Definition at line 179 of file musicplayer.h.
Referenced by generateDuration(), and play().
|
private |
Referenced by enhance(), setEnhance(), setMuted(), setVolume(), and update().
|
private |
Definition at line 173 of file musicplayer.h.
Referenced by generateDuration(), play(), and update().
|
private |
Definition at line 174 of file musicplayer.h.
Referenced by isPlaying(), pause(), state(), stop(), and update().
|
private |
Definition at line 176 of file musicplayer.h.
Referenced by MusicPlayer(), play(), stop(), update(), and ~MusicPlayer().
1.8.8