1 /*****************************************************************************
2  * $LastChangedDate: 2011-04-09 21:58:06 -0400 (Sat, 09 Apr 2011) $
3  * @file
4  * @author  Jim E. Brooks  http://www.palomino3d.org
5  * @brief   Sound class (NOP).
6  *//*
7  * LEGAL:   COPYRIGHT (C) 2009 JIM E. BROOKS
8  *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
9  *          OF THE GNU GENERAL PUBLIC LICENSE VERSION 2 (GPL 2).
10  *****************************************************************************/
11 
12 #ifndef SOUND_SOUND_NOP_HH
13 #define SOUND_SOUND_NOP_HH 1
14 
15 #include "base/singleton.hh"
16 #include "sound/sound_base.hh"
17 #include "sound/sound_sample.hh"
18 #include "sound/sound_sample_nop.hh"
19 
20 namespace sound {
21 
22 ////////////////////////////////////////////////////////////////////////////////
23 /// @brief Sound class (NOP).
24 ///
25 /// Class design:
26 /// -------------
27 /// See SoundBase.
28 ///
29 class SoundNOP : public SoundBase, public Singleton
30 {
31 PREVENT_COPYING(SoundNOP)
32 private:
SoundNOP(void)33             SoundNOP( void ) { }
~SoundNOP()34     virtual ~SoundNOP() { }
35 
36 public:
DEFINE_GetInstance(SoundNOP)37                             DEFINE_GetInstance( SoundNOP )  // Singleton
38     virtual bool            Enable( const bool enable = true ) { return true; }
IfEnabled(void)39     virtual bool            IfEnabled( void ) { return true; }
GetVolume(void)40     virtual fp              GetVolume( void ) { return 1.0f; }
SetVolume(const fp volume)41     virtual bool            SetVolume( const fp volume ) { return true; }
42     // [SoundBase defines the other methods]
43 
44 private:
CreateSample(const Sample::Name & sampleName)45     virtual shptr<Sample>   CreateSample( const Sample::Name& sampleName )
46                             { return new SampleNOP(sampleName); }
47 private:
48     DECLARE_SINGLETON_CLASS_VARS( SoundNOP )
49 };
50 
51 #if SOUND_MODULE_CC
52 DEFINE_SINGLETON_CLASS_VARS( SoundNOP )
53 #endif
54 
55 } // namespace sound
56 
57 #endif // SOUND_SOUND_NOP_HH
58