MythTV  0.28pre
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
Public Types | Public Slots | Public Member Functions | Protected Member Functions | Private Member Functions | Private Attributes | List of all members
MusicPlayer Class Reference

#include <musicplayer.h>

Inheritance diagram for MusicPlayer:
Inheritance graph
[legend]
Collaboration diagram for MusicPlayer:
Collaboration graph
[legend]

Public Types

enum  PlayMode { PLAYMODE_TRACKSPLAYLIST = 0, PLAYMODE_TRACKSEDITOR, PLAYMODE_RADIO }
 
enum  RepeatMode { REPEAT_OFF = 0, REPEAT_TRACK, REPEAT_ALL, MAX_REPEAT_MODES }
 
enum  ShuffleMode {
  SHUFFLE_OFF = 0, SHUFFLE_RANDOM, SHUFFLE_INTELLIGENT, SHUFFLE_ALBUM,
  SHUFFLE_ARTIST, MAX_SHUFFLE_MODES
}
 
enum  ResumeMode {
  RESUME_OFF, RESUME_FIRST, RESUME_TRACK, RESUME_EXACT,
  MAX_RESUME_MODES
}
 

Public Slots

void StartPlayback (void)
 
void StopPlayback (void)
 

Public Member Functions

 MusicPlayer (QObject *parent)
 
 ~MusicPlayer (void)
 
void setPlayMode (PlayMode mode)
 
PlayMode getPlayMode (void)
 
void playFile (const MusicMetadata &meta)
 
void addListener (QObject *listener)
 
void removeListener (QObject *listener)
 
void addVisual (MainVisual *visual)
 
void removeVisual (MainVisual *visual)
 
void toggleMute (void)
 
MuteState getMuteState (void) const
 
bool isMuted (void) const
 
void setVolume (int volume)
 
void incVolume (void)
 
void decVolume (void)
 
uint getVolume (void) const
 
void setSpeed (float speed)
 
void incSpeed ()
 
void decSpeed ()
 
float getSpeed ()
 
void play (void)
 
void stop (bool stopAll=false)
 
void pause (void)
 
void next (void)
 
void previous (void)
 
void nextAuto (void)
 
bool isPlaying (void)
 
bool isPaused (void)
 
bool isStopped (void)
 
bool hasClient (void)
 
void autoShowPlayer (bool autoShow)
 This will allow/disallow the mini player showing on track changes. More...
 
bool getAutoShowPlayer (void)
 
void canShowPlayer (bool canShow)
 This will allow/disallow the mini player showing even using its jumppoint. More...
 
bool getCanShowPlayer (void)
 
DecodergetDecoder (void)
 
DecoderHandlergetDecoderHandler (void)
 
AudioOutputgetOutput (void)
 
void loadPlaylist (void)
 
void loadStreamPlaylist (void)
 
PlaylistgetCurrentPlaylist (void)
 
StreamListgetStreamList (void)
 
void removeTrack (int trackID)
 
void addTrack (int trackID, bool updateUI)
 
void moveTrackUpDown (bool moveUp, int whichTrack)
 
QList< MusicMetadata * > & getPlayedTracksList (void)
 
int getCurrentTrackPos (void)
 
bool setCurrentTrackPos (int pos)
 
void changeCurrentTrack (int trackNo)
 change the current track to the given track More...
 
void activePlaylistChanged (int trackID, bool deleted)
 
void playlistChanged (int playlistID)
 
void savePosition (void)
 
void restorePosition (void)
 
void setAllowRestorePos (bool allow)
 
void seek (int pos)
 
MusicMetadatagetCurrentMetadata (void)
 get the metadata for the current track in the playlist More...
 
MusicMetadatagetNextMetadata (void)
 get the metadata for the next track in the playlist More...
 
void sendMetadataChangedEvent (int trackID)
 
void sendTrackStatsChangedEvent (int trackID)
 
void sendAlbumArtChangedEvent (int trackID)
 
void sendTrackUnavailableEvent (int trackID)
 
void sendCDChangedEvent (void)
 
void toMap (InfoMap &infoMap)
 
void showMiniPlayer (void)
 
RepeatMode getRepeatMode (void)
 
void setRepeatMode (RepeatMode mode)
 
RepeatMode toggleRepeatMode (void)
 
ShuffleMode getShuffleMode (void)
 
void setShuffleMode (ShuffleMode mode)
 
ShuffleMode toggleShuffleMode (void)
 
ResumeMode getResumeMode (void)
 
void getBufferStatus (int *bufferAvailable, int *bufferSize)
 
- Public Member Functions inherited from MythObservable
 MythObservable ()
 
virtual ~MythObservable ()
 
void addListener (QObject *listener)
 Add a listener to the observable. More...
 
void removeListener (QObject *listener)
 Remove a listener to the observable. More...
 
void dispatch (const MythEvent &event)
 Dispatch an event to all listeners. More...
 
bool hasListeners (void)
 

Protected Member Functions

void customEvent (QEvent *event)
 

Private Member Functions

void loadSettings (void)
 
void stopDecoder (void)
 
bool openOutputDevice (void)
 
void updateLastplay (void)
 
void updateVolatileMetadata (void)
 
void sendVolumeChangedEvent (void)
 
int getNotificationID (const QString &hostname)
 
void sendNotification (int notificationID, const QString &title, const QString &author, const QString &desc)
 
void setupDecoderHandler (void)
 
void decoderHandlerReady (void)
 

Private Attributes

int m_currentTrack
 
int m_currentTime
 
MusicMetadatam_oneshotMetadata
 
AudioOutputm_output
 
DecoderHandlerm_decoderHandler
 
QSet< QObject * > m_visualisers
 
PlayMode m_playMode
 
bool m_isPlaying
 
bool m_isAutoplay
 
bool m_canShowPlayer
 
bool m_autoShowPlayer
 
bool m_wasPlaying
 
bool m_updatedLastplay
 
bool m_allowRestorePos
 
int m_lastplayDelay
 
ShuffleMode m_shuffleMode
 
RepeatMode m_repeatMode
 
ResumeMode m_resumeModePlayback
 
ResumeMode m_resumeModeEditor
 
ResumeMode m_resumeModeRadio
 
float m_playSpeed
 
bool m_showScannerNotifications
 
QMap< QString, intm_notificationMap
 
QList< MusicMetadata * > m_playedList
 
int m_lastTrackStart
 
int m_bufferAvailable
 
int m_bufferSize
 
int m_errorCount
 

Additional Inherited Members

- Protected Attributes inherited from MythObservable
QMutex * m_lock
 
QSet< QObject * > m_listeners
 

Detailed Description

Definition at line 51 of file musicplayer.h.

Member Enumeration Documentation

Enumerator
PLAYMODE_TRACKSPLAYLIST 
PLAYMODE_TRACKSEDITOR 
PLAYMODE_RADIO 

Definition at line 59 of file musicplayer.h.

Enumerator
REPEAT_OFF 
REPEAT_TRACK 
REPEAT_ALL 
MAX_REPEAT_MODES 

Definition at line 152 of file musicplayer.h.

Enumerator
SHUFFLE_OFF 
SHUFFLE_RANDOM 
SHUFFLE_INTELLIGENT 
SHUFFLE_ALBUM 
SHUFFLE_ARTIST 
MAX_SHUFFLE_MODES 

Definition at line 158 of file musicplayer.h.

Enumerator
RESUME_OFF 
RESUME_FIRST 
RESUME_TRACK 
RESUME_EXACT 
MAX_RESUME_MODES 

Definition at line 167 of file musicplayer.h.

Constructor & Destructor Documentation

MusicPlayer::MusicPlayer ( QObject *  parent)

Definition at line 54 of file musicplayer.cpp.

MusicPlayer::~MusicPlayer ( void  )

Definition at line 113 of file musicplayer.cpp.

Member Function Documentation

void MusicPlayer::setPlayMode ( PlayMode  mode)

Definition at line 957 of file musicplayer.cpp.

Referenced by StreamView::Create(), and MusicCommon::init().

PlayMode MusicPlayer::getPlayMode ( void  )
inline
void MusicPlayer::playFile ( const MusicMetadata meta)

Definition at line 251 of file musicplayer.cpp.

Referenced by customEvent(), and ImportMusicDialog::playPressed().

void MusicPlayer::addListener ( QObject *  listener)

Definition at line 170 of file musicplayer.cpp.

Referenced by MusicCommon::init().

void MusicPlayer::removeListener ( QObject *  listener)
void MusicPlayer::addVisual ( MainVisual visual)

Definition at line 202 of file musicplayer.cpp.

Referenced by MusicCommon::startVisualizer().

void MusicPlayer::removeVisual ( MainVisual visual)

Definition at line 216 of file musicplayer.cpp.

Referenced by MusicCommon::stopVisualizer().

void MusicPlayer::toggleMute ( void  )

Definition at line 1406 of file musicplayer.cpp.

Referenced by MusicCommon::toggleMute(), and MythMusicVolumeDialog::toggleMute().

MuteState MusicPlayer::getMuteState ( void  ) const

Definition at line 1415 of file musicplayer.cpp.

Referenced by isMuted().

bool MusicPlayer::isMuted ( void  ) const
inline
void MusicPlayer::setVolume ( int  volume)

Definition at line 1390 of file musicplayer.cpp.

Referenced by customEvent().

void MusicPlayer::incVolume ( void  )
void MusicPlayer::decVolume ( void  )
uint MusicPlayer::getVolume ( void  ) const
void MusicPlayer::setSpeed ( float  speed)

Definition at line 1315 of file musicplayer.cpp.

Referenced by decSpeed(), and incSpeed().

void MusicPlayer::incSpeed ( )

Definition at line 1324 of file musicplayer.cpp.

Referenced by MusicCommon::changeSpeed().

void MusicPlayer::decSpeed ( )

Definition at line 1330 of file musicplayer.cpp.

Referenced by MusicCommon::changeSpeed().

float MusicPlayer::getSpeed ( )
inline

Definition at line 89 of file musicplayer.h.

void MusicPlayer::play ( void  )
void MusicPlayer::stop ( bool  stopAll = false)
void MusicPlayer::pause ( void  )

Definition at line 310 of file musicplayer.cpp.

Referenced by customEvent(), MusicCommon::pause(), and stop().

void MusicPlayer::next ( void  )

Definition at line 444 of file musicplayer.cpp.

Referenced by MusicCommon::customEvent(), MusicCommon::next(), nextAuto(), and play().

void MusicPlayer::previous ( void  )

Definition at line 481 of file musicplayer.cpp.

Referenced by MusicCommon::previous().

void MusicPlayer::nextAuto ( void  )

Definition at line 512 of file musicplayer.cpp.

Referenced by customEvent().

bool MusicPlayer::isPlaying ( void  )
inline
bool MusicPlayer::isPaused ( void  )
inline
bool MusicPlayer::isStopped ( void  )
inline

Definition at line 101 of file musicplayer.h.

Referenced by MusicCommon::init().

bool MusicPlayer::hasClient ( void  )
inline

Definition at line 102 of file musicplayer.h.

Referenced by handleCDMedia(), showMiniPlayer(), and ~MusicPlayer().

void MusicPlayer::autoShowPlayer ( bool  autoShow)
inline

This will allow/disallow the mini player showing on track changes.

Definition at line 105 of file musicplayer.h.

Referenced by MiniPlayer::keyPressEvent().

bool MusicPlayer::getAutoShowPlayer ( void  )
inline

Definition at line 106 of file musicplayer.h.

Referenced by MiniPlayer::keyPressEvent().

void MusicPlayer::canShowPlayer ( bool  canShow)
inline

This will allow/disallow the mini player showing even using its jumppoint.

Definition at line 109 of file musicplayer.h.

bool MusicPlayer::getCanShowPlayer ( void  )
inline

Definition at line 110 of file musicplayer.h.

Decoder* MusicPlayer::getDecoder ( void  )
inline
DecoderHandler* MusicPlayer::getDecoderHandler ( void  )
inline

Definition at line 113 of file musicplayer.h.

Referenced by activePlaylistChanged(), Decoder::input(), play(), and stopDecoder().

AudioOutput* MusicPlayer::getOutput ( void  )
inline
void MusicPlayer::loadPlaylist ( void  )

Definition at line 969 of file musicplayer.cpp.

Referenced by MusicData::loadMusic(), and setPlayMode().

void MusicPlayer::loadStreamPlaylist ( void  )
Playlist * MusicPlayer::getCurrentPlaylist ( void  )
StreamList * MusicPlayer::getStreamList ( void  )

Definition at line 1626 of file musicplayer.cpp.

void MusicPlayer::removeTrack ( int  trackID)
void MusicPlayer::addTrack ( int  trackID,
bool  updateUI 
)

Definition at line 1604 of file musicplayer.cpp.

Referenced by treeItemClicked().

void MusicPlayer::moveTrackUpDown ( bool  moveUp,
int  whichTrack 
)

Definition at line 1017 of file musicplayer.cpp.

Referenced by MusicCommon::keyPressEvent().

QList<MusicMetadata*>& MusicPlayer::getPlayedTracksList ( void  )
inline

Definition at line 127 of file musicplayer.h.

Referenced by StreamView::customEvent(), and MusicCommon::updateUIPlayedList().

int MusicPlayer::getCurrentTrackPos ( void  )
inline
bool MusicPlayer::setCurrentTrackPos ( int  pos)
void MusicPlayer::changeCurrentTrack ( int  trackNo)

change the current track to the given track

Definition at line 1134 of file musicplayer.cpp.

Referenced by MusicCommon::customEvent(), next(), previous(), and setCurrentTrackPos().

void MusicPlayer::activePlaylistChanged ( int  trackID,
bool  deleted 
)
void MusicPlayer::playlistChanged ( int  playlistID)

Definition at line 1494 of file musicplayer.cpp.

Referenced by MusicCommon::customEvent(), and Playlist::resync().

void MusicPlayer::savePosition ( void  )
void MusicPlayer::restorePosition ( void  )

Definition at line 1067 of file musicplayer.cpp.

Referenced by MusicCommon::init(), and MusicData::reloadMusic().

void MusicPlayer::setAllowRestorePos ( bool  allow)
inline

Definition at line 138 of file musicplayer.h.

Referenced by MusicCommon::switchView().

void MusicPlayer::seek ( int  pos)

Definition at line 1106 of file musicplayer.cpp.

Referenced by decoderHandlerReady(), restorePosition(), and StartPlayback().

MusicMetadata * MusicPlayer::getCurrentMetadata ( void  )
MusicMetadata * MusicPlayer::getNextMetadata ( void  )

get the metadata for the next track in the playlist

Definition at line 1168 of file musicplayer.cpp.

Referenced by TrackInfoPopup::Create(), MusicCommon::customEvent(), and MusicCommon::updateTrackInfo().

void MusicPlayer::sendMetadataChangedEvent ( int  trackID)

Definition at line 1342 of file musicplayer.cpp.

Referenced by customEvent(), and EditMetadataCommon::saveToDatabase().

void MusicPlayer::sendTrackStatsChangedEvent ( int  trackID)

Definition at line 1348 of file musicplayer.cpp.

Referenced by MusicCommon::changeRating(), and updateVolatileMetadata().

void MusicPlayer::sendAlbumArtChangedEvent ( int  trackID)

Definition at line 1354 of file musicplayer.cpp.

Referenced by EditMetadataCommon::~EditMetadataCommon().

void MusicPlayer::sendTrackUnavailableEvent ( int  trackID)

Definition at line 1360 of file musicplayer.cpp.

Referenced by play().

void MusicPlayer::sendCDChangedEvent ( void  )

Definition at line 1366 of file musicplayer.cpp.

Referenced by handleCDMedia().

void MusicPlayer::toMap ( InfoMap infoMap)
void MusicPlayer::showMiniPlayer ( void  )

Definition at line 1117 of file musicplayer.cpp.

Referenced by showMiniPlayer().

RepeatMode MusicPlayer::getRepeatMode ( void  )
inline

Definition at line 175 of file musicplayer.h.

Referenced by MusicCommon::createRepeatMenu(), and MusicCommon::updateRepeatMode().

void MusicPlayer::setRepeatMode ( RepeatMode  mode)
inline

Definition at line 176 of file musicplayer.h.

Referenced by MusicCommon::customEvent(), and MusicPlayer().

MusicPlayer::RepeatMode MusicPlayer::toggleRepeatMode ( void  )

Definition at line 1198 of file musicplayer.cpp.

Referenced by MusicCommon::keyPressEvent().

ShuffleMode MusicPlayer::getShuffleMode ( void  )
inline
void MusicPlayer::setShuffleMode ( ShuffleMode  mode)
MusicPlayer::ShuffleMode MusicPlayer::toggleShuffleMode ( void  )

Definition at line 1219 of file musicplayer.cpp.

Referenced by MusicCommon::keyPressEvent().

MusicPlayer::ResumeMode MusicPlayer::getResumeMode ( void  )

Definition at line 230 of file musicplayer.cpp.

Referenced by decoderHandlerReady(), loadPlaylist(), and restorePosition().

void MusicPlayer::getBufferStatus ( int bufferAvailable,
int bufferSize 
)

Definition at line 951 of file musicplayer.cpp.

Referenced by MusicCommon::updateProgressBar().

void MusicPlayer::StartPlayback ( void  )
slot

Definition at line 551 of file musicplayer.cpp.

Referenced by MusicPlayer().

void MusicPlayer::StopPlayback ( void  )
slot

Definition at line 564 of file musicplayer.cpp.

Referenced by MusicPlayer().

void MusicPlayer::customEvent ( QEvent *  event)
protected

Definition at line 575 of file musicplayer.cpp.

void MusicPlayer::loadSettings ( void  )
private

Definition at line 240 of file musicplayer.cpp.

Referenced by customEvent(), and MusicPlayer().

void MusicPlayer::stopDecoder ( void  )
private

Definition at line 377 of file musicplayer.cpp.

Referenced by play(), and stop().

bool MusicPlayer::openOutputDevice ( void  )
private

Definition at line 383 of file musicplayer.cpp.

Referenced by play().

void MusicPlayer::updateLastplay ( void  )
private

Definition at line 1277 of file musicplayer.cpp.

Referenced by customEvent().

void MusicPlayer::updateVolatileMetadata ( void  )
private

Definition at line 1288 of file musicplayer.cpp.

Referenced by changeCurrentTrack().

void MusicPlayer::sendVolumeChangedEvent ( void  )
private

Definition at line 1336 of file musicplayer.cpp.

Referenced by decVolume(), incVolume(), setVolume(), and toggleMute().

int MusicPlayer::getNotificationID ( const QString &  hostname)
private

Definition at line 1631 of file musicplayer.cpp.

Referenced by customEvent().

void MusicPlayer::sendNotification ( int  notificationID,
const QString &  title,
const QString &  author,
const QString &  desc 
)
private

Definition at line 1639 of file musicplayer.cpp.

Referenced by customEvent().

void MusicPlayer::setupDecoderHandler ( void  )
private

Definition at line 1500 of file musicplayer.cpp.

Referenced by play().

void MusicPlayer::decoderHandlerReady ( void  )
private

Definition at line 1516 of file musicplayer.cpp.

Referenced by customEvent().

Member Data Documentation

int MusicPlayer::m_currentTrack
private
int MusicPlayer::m_currentTime
private

Definition at line 208 of file musicplayer.h.

Referenced by customEvent(), decoderHandlerReady(), MusicPlayer(), and savePosition().

MusicMetadata* MusicPlayer::m_oneshotMetadata
private
AudioOutput* MusicPlayer::m_output
private
DecoderHandler* MusicPlayer::m_decoderHandler
private
QSet<QObject*> MusicPlayer::m_visualisers
private

Definition at line 215 of file musicplayer.h.

Referenced by addVisual(), decoderHandlerReady(), openOutputDevice(), and removeVisual().

PlayMode MusicPlayer::m_playMode
private
bool MusicPlayer::m_isPlaying
private

Definition at line 218 of file musicplayer.h.

Referenced by decoderHandlerReady(), isPlaying(), MusicPlayer(), pause(), stop(), and StopPlayback().

bool MusicPlayer::m_isAutoplay
private

Definition at line 219 of file musicplayer.h.

Referenced by addListener(), customEvent(), MusicPlayer(), nextAuto(), and removeListener().

bool MusicPlayer::m_canShowPlayer
private
bool MusicPlayer::m_autoShowPlayer
private
bool MusicPlayer::m_wasPlaying
private

Definition at line 222 of file musicplayer.h.

Referenced by MusicPlayer(), StartPlayback(), and StopPlayback().

bool MusicPlayer::m_updatedLastplay
private

Definition at line 223 of file musicplayer.h.

Referenced by customEvent(), decoderHandlerReady(), MusicPlayer(), and updateLastplay().

bool MusicPlayer::m_allowRestorePos
private

Definition at line 224 of file musicplayer.h.

Referenced by MusicPlayer(), restorePosition(), and setAllowRestorePos().

int MusicPlayer::m_lastplayDelay
private

Definition at line 226 of file musicplayer.h.

Referenced by customEvent(), and loadSettings().

ShuffleMode MusicPlayer::m_shuffleMode
private

Definition at line 228 of file musicplayer.h.

Referenced by getShuffleMode(), setShuffleMode(), toggleShuffleMode(), and ~MusicPlayer().

RepeatMode MusicPlayer::m_repeatMode
private
ResumeMode MusicPlayer::m_resumeModePlayback
private

Definition at line 230 of file musicplayer.h.

Referenced by getResumeMode(), and loadSettings().

ResumeMode MusicPlayer::m_resumeModeEditor
private

Definition at line 231 of file musicplayer.h.

Referenced by getResumeMode(), and loadSettings().

ResumeMode MusicPlayer::m_resumeModeRadio
private

Definition at line 232 of file musicplayer.h.

Referenced by getResumeMode(), and loadSettings().

float MusicPlayer::m_playSpeed
private

Definition at line 234 of file musicplayer.h.

Referenced by decSpeed(), getSpeed(), incSpeed(), MusicPlayer(), and setSpeed().

bool MusicPlayer::m_showScannerNotifications
private

Definition at line 237 of file musicplayer.h.

Referenced by MusicPlayer().

QMap<QString, int> MusicPlayer::m_notificationMap
private

Definition at line 238 of file musicplayer.h.

Referenced by getNotificationID(), and ~MusicPlayer().

QList<MusicMetadata*> MusicPlayer::m_playedList
private

Definition at line 241 of file musicplayer.h.

Referenced by customEvent(), getPlayedTracksList(), and ~MusicPlayer().

int MusicPlayer::m_lastTrackStart
private

Definition at line 242 of file musicplayer.h.

Referenced by customEvent(), decoderHandlerReady(), and MusicPlayer().

int MusicPlayer::m_bufferAvailable
private

Definition at line 243 of file musicplayer.h.

Referenced by customEvent(), getBufferStatus(), and MusicPlayer().

int MusicPlayer::m_bufferSize
private

Definition at line 244 of file musicplayer.h.

Referenced by customEvent(), getBufferStatus(), and MusicPlayer().

int MusicPlayer::m_errorCount
private

Definition at line 246 of file musicplayer.h.

Referenced by customEvent(), MusicPlayer(), and play().


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