ScummVM API documentation
soundblaster.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  *
21  * This file is dual-licensed.
22  * In addition to the GPLv3 license mentioned above, this code is also
23  * licensed under LGPL 2.1. See LICENSES/COPYING.LGPL file for the
24  * full text of the license.
25  *
26  */
27 
28 #ifndef GOB_SOUND_SOUNDBLASTER_H
29 #define GOB_SOUND_SOUNDBLASTER_H
30 
31 #include "common/mutex.h"
32 
33 #include "gob/sound/soundmixer.h"
34 
35 namespace Audio {
36 class Mixer;
37 }
38 
39 namespace Gob {
40 
41 class SoundDesc;
42 
43 class SoundBlaster : public SoundMixer {
44 public:
45  SoundBlaster(Audio::Mixer &mixer);
46  ~SoundBlaster() override;
47 
48  void playSample(SoundDesc &sndDesc, int16 repCount,
49  int16 frequency, int16 fadeLength = 0);
50  void stopSound(int16 fadeLength, SoundDesc *sndDesc = 0);
51 
52  void playComposition(const int16 *composition, int16 freqVal,
53  SoundDesc *sndDescs = 0, int8 sndCount = 60);
54  void stopComposition();
55  void endComposition();
56 
57  void repeatComposition(int32 repCount);
58 
59 protected:
60  Common::Mutex _mutex;
61 
62  SoundDesc *_compositionSamples;
63  int8 _compositionSampleCount;
64  int16 _composition[50];
65  int8 _compositionPos;
66 
67  int32 _compositionRepCount;
68 
69  SoundDesc *_curSoundDesc;
70 
71  void setSample(SoundDesc &sndDesc, int16 repCount,
72  int16 frequency, int16 fadeLength) override;
73  void checkEndSample() override;
74  void endFade() override;
75 
76  void nextCompositionPos();
77 };
78 
79 } // End of namespace Gob
80 
81 #endif // GOB_SOUND_SOUNDBLASTER_H
Definition: mixer.h:59
Definition: anifile.h:40
Definition: mutex.h:67
Definition: sounddesc.h:43
Definition: soundblaster.h:43
Definition: soundmixer.h:40
Definition: system.h:38