/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */

#ifndef NMM_ICDDAImpl_HPP
#define NMM_ICDDAImpl_HPP

#include "nmm/nmm_prefix.hpp"

#include "nmm/comm/NMMObject.hpp"
#include "ICDDA.hpp"

#include "nmm/multimedia/IDeviceImpl.hpp"

#include "visibility.hpp"

namespace NMM
{
  /** Interface for configuring and managing playback of audio cds.
   */  

  class DLLEXPORT ICDDAImpl  : virtual public IDeviceImpl { 
  public:
    ICDDAImpl() { addInterface(new ICDDA(*this)); registerEvents(); };

    virtual ~ICDDAImpl() {};

  protected:
    /** Sets track to play.
     *  @param track id of track to be played
     *  @return SUCCESS if setting of track number was successful, FAILURE otherwise.
     *
     */

    virtual Result setTrack(const nmm_int32& track) = 0;
    /** Returns track to play.
     *
     * @return Number of current track.
     */

    virtual nmm_int32 getTrack() = 0;
     /** Returns total number of tracks.
     *
     * @return Total number of tracks.
     */

    virtual nmm_int32 getTotalTracks() = 0;

    virtual void numberTracks(const nmm_bool& number) = 0;
    /**
     *  @brief get duration of track with given id
     *  @param id of track
     *  @return duration of track with id given as parameter
     *
     */

    virtual Interval getTrackDuration(const nmm_int32& track) = 0;
    /**
     *  @brief get duration of complete CD
     *  @return duration of complete CD
     *
     */

    virtual Interval getTotalDuration() = 0;
    /** Tests if playback is finished.
     *
     * @return True if playback of current CD is enabled, false otherwise.
     */

    virtual nmm_bool isFinished() = 0;
     /** Switches repeat mode on/off.
     *
     *  @param  repeat If true repeat mode gets enabled and disabled otherwise.
     *
     * If repeat mode and oneTrackOnly mode are enabled, repeat this track infinitely.
     * If repeat mode is enabled and oneTrackOnly mode is disabled, repeat the complete CD.
     */

    virtual void setRepeat(const nmm_bool& repeat) = 0;
     /** Returns repeat mode state.
     *
     * @return True if repeat mode is enabled, false otherwise.
     */

    virtual nmm_bool getRepeat() = 0;
     /** Switches status of one track only mode.
     *
     * If one track only mode is enabled, playback stops after playback of current track.
     *
     * @param enable True if one track only is enabled, false otherwise.
     */

    virtual void setOneTrackOnly(const nmm_bool& enable) = 0;
     /** Returns state of one track only mode.
     *
     * @return true if one track only is enabled, false otherwise.
     */

    virtual nmm_bool getOneTrackOnly() = 0;


  private:
    void registerEvents();
  };

}

#include "nmm/nmm_suffix.hpp"

#endif
