1 /* ScummVM - Graphic Adventure Engine
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.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 2
10 * of the License, or (at your option) any later version.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 #ifndef SWORD1_SOUND_H
27 #define SWORD1_SOUND_H
29 #include "sword1/object.h"
30 #include "sword1/sworddefs.h"
31 #include "common/file.h"
32 #include "sound/mixer.h"
33 #include "common/util.h"
41 #define TOTAL_FX_PER_ROOM 7 // total loop & random fx per room (see fx_list.c)
42 #define MAX_ROOMS_PER_FX 7 // max no. of rooms in the fx's room,vol list
43 #define MAX_FXQ_LENGTH 32 // max length of sound queue - ie. max number of fx that can be stored up/playing together
51 Audio::SoundHandle handle
;
55 int32 roomNo
, leftVol
, rightVol
;
59 uint32 sampleId
, type
, delay
;
60 RoomVol roomVolList
[MAX_ROOMS_PER_FX
];
64 #define WAVE_VOL_TAB_LENGTH 480
65 #define WAVE_VOL_THRESHOLD 190000 //120000
78 Sound(const char *searchPath
, Audio::Mixer
*mixer
, ResMan
*pResMan
);
80 void setSpeechVol(uint8 volL
, uint8 volR
) { _speechVolL
= volL
; _speechVolR
= volR
; }
81 void setSfxVol(uint8 volL
, uint8 volR
) { _sfxVolL
= volL
; _sfxVolR
= volR
; }
82 void giveSpeechVol(uint8
*volL
, uint8
*volR
) { *volL
= _speechVolL
; *volR
= _speechVolR
; }
83 void giveSfxVol(uint8
*volL
, uint8
*volR
) { *volL
= _sfxVolL
; *volR
= _sfxVolR
; }
84 void newScreen(uint32 screen
);
85 void quitScreen(void);
86 void closeCowSystem(void);
88 bool startSpeech(uint16 roomNo
, uint16 localNo
);
89 bool speechFinished(void);
91 bool amISpeaking(void);
93 void fnStopFx(int32 fxNo
);
94 int addToQueue(int32 fxNo
);
98 void checkSpeechFileEndianness();
101 uint8 _sfxVolL
, _sfxVolR
, _speechVolL
, _speechVolR
;
102 void playSample(QueueElement
*elem
);
103 void initCowSystem(void);
105 int16
*uncompressSpeech(uint32 index
, uint32 cSize
, uint32
*size
);
106 void calcWaveVolume(int16
*data
, uint32 length
);
107 bool _waveVolume
[WAVE_VOL_TAB_LENGTH
];
109 Common::File _cowFile
;
111 uint32 _cowHeaderSize
;
112 uint8 _currentCowFile
;
114 Audio::SoundHandle _speechHandle
, _fxHandle
;
115 Common::RandomSource _rnd
;
117 QueueElement _fxQueue
[MAX_FXQ_LENGTH
];
119 Audio::Mixer
*_mixer
;
121 bool _bigEndianSpeech
;
123 static const char _musicList
[270];
124 static const uint16 _roomsFixedFx
[TOTAL_ROOMS
][TOTAL_FX_PER_ROOM
];
125 static const FxDef _fxList
[312];
129 } // End of namespace Sword1