/*****************************************************************************
 * $LastChangedDate: 2010-06-28 22:01:32 -0400 (Mon, 28 Jun 2010) $
 * @file
 * @author  Jim E. Brooks  http://www.palomino3d.org
 * @brief   Sound sample (PLIB).
 *//*
 * 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).
 *****************************************************************************/

#if COMPILE_PLIB
#ifndef SOUND_SOUND_SAMPLE_PLIB_HH
#define SOUND_SOUND_SAMPLE_PLIB_HH 1

#include "base/timer.hh"
#include "sound/sound_sample.hh"

class slScheduler;  // alternative to including plib headers here
class smMixer;
class slSample;

namespace sound {

////////////////////////////////////////////////////////////////////////////
/// @brief Sound sample (PLIB).
///
class SamplePLIB : public Sample
{
PREVENT_COPYING(SamplePLIB)
public:
                    SamplePLIB( const Sample::Name& sampleName );
    virtual         ~SamplePLIB();
    virtual bool    IfPlaying( void );
    virtual bool    Play( const defs::ePlayLoop loop, const fp volume );
    virtual bool    Stop( void );
    virtual bool    SetVolume( const fp volume );
    virtual fp      GetVolume( void );

private:
    fp              mVolume;        ///< current volume (PLIB alters waveform data)
    defs::ePlayLoop mPlayLoop;      ///< whether to repeat sample
    slSample*       mSLSample;      ///< PLIB sound object
    string          mBuf;           ///< stored for changing volume
};

} // namespace sound

#endif // SOUND_SOUND_SAMPLE_PLIB_HH
#endif // COMPILE_PLIB
