scummvm/engines/dragons/sound.h

127 lines
3 KiB
C
Raw Normal View History

2019-06-17 19:41:54 +10:00
/* ScummVM - Graphic Adventure Engine
*
* ScummVM is the legal property of its developers, whose names
* are too numerous to list here. Please refer to the COPYRIGHT
* file distributed with this source distribution.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
*/
#ifndef DRAGONS_SOUND_H
#define DRAGONS_SOUND_H
#include "common/scummsys.h"
#include "audio/mixer.h"
#include "audio/audiostream.h"
#include "midimusicplayer.h"
2019-06-17 19:41:54 +10:00
namespace Dragons {
class DragonsEngine;
2019-12-11 20:23:56 +00:00
class BigfileArchive;
class DragonRMS;
class VabSound;
2019-06-17 19:41:54 +10:00
struct SpeechLocation;
typedef struct Voice {
int16 soundID;
Audio::SoundHandle handle;
Voice() {
soundID = -1;
}
} Voice;
#define NUM_VOICES 25
2019-12-11 20:23:56 +00:00
class SoundManager {
public:
SoundManager(DragonsEngine *vm, BigfileArchive* bigFileArchive, DragonRMS *dragonRms);
~SoundManager();
void loadMsf(uint32 sceneId);
void playOrStopSound(uint16 soundId);
void playMusic(int16 song);
2019-12-16 10:21:02 +11:00
void playSpeech(uint32 textIndex);
bool isSpeechPlaying();
void resumeMusic();
void syncSoundSettings();
2019-12-16 10:21:02 +11:00
public:
uint16 _dat_8006bb60_sound_related;
2019-12-16 10:21:02 +11:00
2019-12-11 20:23:56 +00:00
private:
2019-12-16 10:21:02 +11:00
DragonsEngine *_vm;
2019-12-11 20:23:56 +00:00
BigfileArchive *_bigFileArchive;
DragonRMS *_dragonRMS;
uint8 _speechVolume;
uint8 _sfxVolume;
uint8 _musicVolume;
2020-09-05 23:04:35 +10:00
uint8 _sfxVolumeTbl[0x780];
2019-12-11 20:23:56 +00:00
VabSound* _vabMusx;
VabSound* _vabMsf;
2019-12-11 20:23:56 +00:00
VabSound* _vabGlob;
2019-12-16 10:21:02 +11:00
Audio::SoundHandle _speechHandle;
MidiMusicPlayer *_midiPlayer;
Voice _voice[NUM_VOICES];
int16 _currentSong;
2019-12-16 10:21:02 +11:00
2019-12-11 20:23:56 +00:00
private:
void SomeInitSound_FUN_8003f64c();
void initVabData();
2019-12-11 20:23:56 +00:00
void playSound(uint16 soundId, uint16 i);
void stopSound(uint16 id, uint16 i);
uint16 getVabFromSoundId(uint16 id);
VabSound * loadVab(const char *headerFilename, const char *bodyFilename);
2019-12-16 10:21:02 +11:00
bool getSpeechLocation(uint32 talkId, struct SpeechLocation *location);
bool isVoicePlaying(uint16 soundID);
Audio::SoundHandle *getVoiceHandle(uint16 soundID);
void stopVoicePlaying(uint16 soundID);
void stopAllVoices();
2019-12-16 10:21:02 +11:00
private:
class PSXAudioTrack {
private:
struct ADPCMStatus {
int16 sample[2];
} _adpcmStatus[2];
public:
PSXAudioTrack();
Audio::QueuingAudioStream *createNewAudioStream(Common::File *fd, uint16 sectorStart, int8 startOffset, uint16 sectorEnd);
private:
void queueAudioFromSector(Audio::QueuingAudioStream *audStream, Common::SeekableReadStream *sector);
2019-12-16 10:21:02 +11:00
};
2019-12-11 20:23:56 +00:00
};
2019-06-17 19:41:54 +10:00
} // End of namespace Dragons
#endif //DRAGONS_SOUND_H