/*****************************************************************************
 * $LastChangedDate: 2011-04-09 21:58:06 -0400 (Sat, 09 Apr 2011) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Base class for a sound sample.
 *//*
 * LEGAL:   COPYRIGHT (C) 2009 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
 *****************************************************************************/

#ifndef SOUND_SOUND_SAMPLE_HH
#define SOUND_SOUND_SAMPLE_HH 1

#include "sound/defs.hh"

namespace sound {

////////////////////////////////////////////////////////////////////////////
/// @brief Base class for a sound sample.
///
/// Class design:
/// -------------
/// See SoundBase.
///
/// Notes:
/// ------
/// Samples don't know if sound is disabled (responsibility of Sound class).
///
class Sample : public Shared
{
PREVENT_COPYING(Sample)
friend class shptr<Sample>;
public:
    typedef string Name;  ///< filename

protected:
                        Sample( const Sample::Name& sampleName )
                        : mName(sampleName)
                        { SET_TYPESIG(this,TYPESIG_SOUND_SAMPLE); }
    virtual             ~Sample()
                        { INVALIDATE_TYPESIG(this,TYPESIG_SOUND_SAMPLE); }
public:
    const Name          GetName( void ) { return mName; }
    virtual bool        IfPlaying( void ) = 0;
    virtual bool        Play( const defs::ePlayLoop playLoop, const fp volume = sound::defs::DEFAULT_VOLUME ) = 0;
    virtual bool        Stop( void ) = 0;
    virtual bool        SetVolume( const fp volume ) = 0;
    virtual fp          GetVolume( void ) = 0;

private:
    const Name      mName;          ///< filename
public:
    DECLARE_TYPESIG(TYPESIG_SOUND_SAMPLE)
};

} // namespace sound

#endif // SOUND_SOUND_SAMPLE_HH
