Gnash  0.8.11dev
NullSoundHandler.h
Go to the documentation of this file.
1 // NullSoundHandler - fake sound handler, for testing gnash
2 //
3 // Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
4 // Free Software Foundation, Inc
5 //
6 // This program is free software; you can redistribute it and/or modify
7 // it under the terms of the GNU General Public License as published by
8 // the Free Software Foundation; either version 3 of the License, or
9 // (at your option) any later version.
10 //
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
15 //
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software
18 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 
20 
21 #ifndef NULL_SOUND_HANDLER_H
22 #define NULL_SOUND_HANDLER_H
23 
24 #include "sound_handler.h" // for inheritance
25 #include "dsodefs.h" // for DSOEXPORT
26 
27 namespace gnash {
28 
29 namespace media {
30  class MediaHandler;
31 }
32 
33 namespace sound {
34 
37 {
38 public:
39 
41 
43  :
44  sound_handler(m),
45  _mixer(mixer)
46  {}
47 
48  // If a _mixer was given, let it do the mixing!
49  void mix(std::int16_t* outSamples, std::int16_t* inSamples,
50  unsigned int nSamples, float volume)
51  {
52  if ( _mixer ) _mixer->mix(outSamples, inSamples, nSamples, volume);
53  else {
54  sound_handler::mix(outSamples, inSamples, nSamples, volume);
55  }
56  }
57 
58 
59 };
60 
61 } // gnash.sound namespace
62 } // namespace gnash
63 
64 #endif // NULL_SOUND_HANDLER_H
65 
66 
67 // Local Variables:
68 // mode: C++
69 // indent-tabs-mode: t
70 // End:
Definition: klash_part.cpp:331
NullSoundHandler(media::MediaHandler *m, sound_handler *mixer=nullptr)
Definition: NullSoundHandler.h:42
Sound mixer.
Definition: sound_handler.h:87
Anonymous namespace for callbacks, local functions, event handlers etc.
Definition: dbus_ext.cpp:40
Null sound_handler, for testing or manual fetching of samples.
Definition: NullSoundHandler.h:36
The MediaHandler class acts as a factory to provide parser and decoders.
Definition: MediaHandler.h:69
void mix(std::int16_t *outSamples, std::int16_t *inSamples, unsigned int nSamples, float volume)
Mix nSamples from inSamples to outSamples, with given volume.
Definition: NullSoundHandler.h:49
sound_handler * _mixer
Definition: NullSoundHandler.h:40
#define DSOEXPORT
Definition: dsodefs.h:55
virtual void mix(std::int16_t *outSamples, std::int16_t *inSamples, unsigned int nSamples, float volume)
Mix nSamples from inSamples to outSamples, with given volume.
Definition: sound_handler.cpp:841
Definition: GnashKey.h:159