diff options
author | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-09 07:28:56 +0000 |
---|---|---|
committer | lvw <lvw@e10066b5-e1e2-0310-b819-94efdf66514b> | 2004-10-09 07:28:56 +0000 |
commit | 0793421773dd5740ddf81300b29b42cdb2350382 (patch) | |
tree | 2391248f89d3b1ee023c4f86045d71f385b46358 | |
parent | 4c3eea2b9b678538bfd1f9ff7b1ec0c43dd1154b (diff) | |
download | vdr-plugin-muggle-0793421773dd5740ddf81300b29b42cdb2350382.tar.gz vdr-plugin-muggle-0793421773dd5740ddf81300b29b42cdb2350382.tar.bz2 |
Modes for loop and shuffle added
git-svn-id: https://vdr-muggle.svn.sourceforge.net/svnroot/vdr-muggle/trunk/muggle-plugin@212 e10066b5-e1e2-0310-b819-94efdf66514b
-rw-r--r-- | mg_playlist.c | 50 | ||||
-rw-r--r-- | mg_playlist.h | 56 |
2 files changed, 73 insertions, 33 deletions
diff --git a/mg_playlist.c b/mg_playlist.c index 86d3d8e..7480563 100644 --- a/mg_playlist.c +++ b/mg_playlist.c @@ -42,14 +42,54 @@ mgPlaylist::~mgPlaylist() { } -void mgPlaylist::setLoopMode( LoopMode lm ) -{ - m_loop_mode = lm; +mgPlaylist::LoopMode mgPlaylist::toggleLoopMode( ) +{ + switch( m_loop_mode ) + { + case LM_NONE: + { + m_loop_mode = LM_SINGLE; + } break; + case LM_SINGLE: + { + m_loop_mode = LM_FULL; + } break; + case LM_FULL: + { + m_loop_mode = LM_NONE; + } break; + default: + { + m_loop_mode = LM_NONE; + } + } + + return m_loop_mode; } -void mgPlaylist::setShuffleMode( ShuffleMode sm ) +mgPlaylist::ShuffleMode mgPlaylist::toggleShuffleMode( ) { - m_shuffle_mode = sm; + switch( m_shuffle_mode ) + { + case SM_NONE: + { + m_shuffle_mode = SM_NORMAL; + } break; + case SM_NORMAL: + { + m_shuffle_mode = SM_PARTY; + } break; + case SM_PARTY: + { + m_shuffle_mode = SM_NONE; + } break; + default: + { + m_shuffle_mode = SM_NONE; + } + } + + return m_shuffle_mode; } void mgPlaylist::initialize() diff --git a/mg_playlist.h b/mg_playlist.h index a0ff4c2..975458a 100644 --- a/mg_playlist.h +++ b/mg_playlist.h @@ -1,6 +1,6 @@ /*! * \file mg_playlist.c - * \brief defines functions to be executed on playlists for the vdr muggle plugindatabase + * \brief defines functions to be executed on playlists for the vdr muggle plugin * * \version $Revision: 1.6 $ * \date $Date$ @@ -30,42 +30,23 @@ class mgPlaylist : public mgTracklist { -private: - - //! \brief current index in the playlist - // TODO: should be a property of the player? - int m_current_idx; - - //! \brief the current loop mode - LoopMode m_loop_mode; - - //! \brief the current shuffle mode - ShuffleMode m_shuffle_mode; - -protected: - - // TODO: Why not make these private? Subclasses should use access functions. LVW - - //! \brief the name of the playlist - std::string m_listname; - public: //! \brief define various ways to play music in random order - enum + enum ShuffleMode { SM_NONE, //!< \brief play normal sequence SM_NORMAL, //!< \brief a shuffle with a fair distribution SM_PARTY //!< \brief select the next few songs randomly, continue forever - } ShuffleMode; + }; //! \brief define various ways to play music in a neverending loop - enum + enum LoopMode { LM_NONE, //!< \brief do not loop LM_SINGLE, //!< \brief loop a single track LM_FULL //!< \brief loop the whole playlist - } LoopMode; + }; //! \brief object construction and destruction //@{ @@ -90,10 +71,10 @@ public: //@{ //! \brief toggle the loop mode. - void setLoopMode( LoopMode lm ); + LoopMode toggleLoopMode( ); //! \brief toggle the shuffle mode. - void setShuffleMode( ShuffleMode sm ); + ShuffleMode toggleShuffleMode( ); //@} @@ -121,7 +102,7 @@ public: virtual void insert(mgContentItem* item, unsigned int position); //! \brief clear all tracks -m virtual void clear(); + virtual void clear(); /*! \brief move tracks within playlist * @@ -195,7 +176,26 @@ m virtual void clear(); //! \brief obtain the next item without skipping the current position virtual mgContentItem* sneakNext(); //@} - + +private: + + //! \brief current index in the playlist + // TODO: should be a property of the player? + int m_current_idx; + + //! \brief the current loop mode + LoopMode m_loop_mode; + + //! \brief the current shuffle mode + ShuffleMode m_shuffle_mode; + +protected: + + // TODO: Why not make these private? Subclasses should use access functions. LVW + + //! \brief the name of the playlist + std::string m_listname; + }; #endif |