ScummVM API documentation
sound.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 
22 /*
23  * This code is based on original Mortville Manor DOS source code
24  * Copyright (c) 1987-1989 Lankhor
25  */
26 
27 #ifndef MORTEVIELLE_SOUND_H
28 #define MORTEVIELLE_SOUND_H
29 
30 #include "audio/mixer.h"
31 #include "common/mutex.h"
32 #include "common/queue.h"
33 #include "common/text-to-speech.h"
34 
35 namespace Audio {
36 class QueuingAudioStream;
37 }
38 
39 namespace Mortevielle {
40 class MortevielleEngine;
41 
42 const int kNullValue = 255;
43 const int kTempoMusic = 71;
44 const int kTempoNoise = 78;
45 const int kTempoF = 80;
46 const int kTempoM = 89;
47 
48 struct SpeechQueue {
49  int _val;
50  int _code;
51  int _acc;
52  int _freq;
53  int _rep;
54 };
55 
56 typedef int tablint[256];
57 
58 class SoundManager {
59 private:
60  MortevielleEngine *_vm;
61 
62  byte *_ambiantNoiseBuf;
63  byte *_noiseBuf;
64  int _phonemeNumb;
65  int _soundType;
66  SpeechQueue _queue[3];
67  byte _wordBuf[1712];
68  byte _troctBuf[10576];
69  bool _buildingSentence;
70  int _ptr_oct;
71  int _tbi[256];
72 
73  Audio::QueuingAudioStream *_audioStream;
74 
75  void loadPhonemeSounds();
76  void moveQueue();
77  void initQueue();
78  void handlePhoneme();
79 
80  void spfrac(int wor);
81  void charg_car(int &currWordNumb);
82  void entroct(byte o);
83  void cctable(tablint &t);
84  void trait_car();
85 
86  void regenbruit();
87  void litph(tablint &t, int typ, int tempo);
88 
89 public:
91  ~SoundManager();
92 
93  Audio::Mixer *_mixer;
95  Audio::SoundHandle _soundHandle;
96  uint16 *_cfiphBuffer;
97 
98  int decodeMusic(const byte *PSrc, byte *PDest, int size);
99  void playSong(const byte *buf, uint usize, uint loops);
100  void loadAmbiantSounds();
101  void loadNoise();
102  void startSpeech(int rep, int character, int typ);
103  void waitSpeech();
104 };
105 
106 } // End of namespace Mortevielle
107 
108 #endif
Definition: debugger.h:28
Definition: sound.h:58
Definition: mixer.h:49
Definition: mixer.h:59
Definition: text-to-speech.h:145
Definition: audiostream.h:370
Definition: sound.h:48
Definition: mortevielle.h:156
Definition: system.h:38