From b64622744f480b04dab9603fe0c09fb76e8e25b3 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Mon, 1 Aug 2016 12:21:35 +0200 Subject: MACVENTURE: Add infrastructure to support sound system --- engines/macventure/sound.h | 85 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 85 insertions(+) create mode 100644 engines/macventure/sound.h (limited to 'engines/macventure/sound.h') diff --git a/engines/macventure/sound.h b/engines/macventure/sound.h new file mode 100644 index 0000000000..3c7a68fc2b --- /dev/null +++ b/engines/macventure/sound.h @@ -0,0 +1,85 @@ +/* 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 MACVENTURE_SOUND_H +#define MACVENTURE_SOUND_H + +#include "macventure/macventure.h" +#include "macventure/container.h" + +#include "common/file.h" +#include "common/hashmap.h" + +namespace MacVenture { + +enum SoundType { + kSound10 = 0x10, + kSound12 = 0x12, + kSound18 = 0x18, + kSound1a = 0x1a, + kSound44 = 0x44, + kSound78 = 0x78, + kSound7e = 0x7e +}; + +class SoundAsset { + +public: + SoundAsset(Container *container, ObjID id); + ~SoundAsset(); + + void play(); + uint32 getPlayLength(); + +private: + + void decode10(Common::SeekableReadStream *stream); + +private: + + Container *_container; + ObjID _id; + + Common::Array _data; + uint32 _length; + uint32 _frequency; +}; + +class SoundManager { +public: + SoundManager(MacVentureEngine *engine); + ~SoundManager(); + + uint32 playSound(ObjID sound); + +private: + void ensureLoaded(ObjID sound); + +private: + + Container *_container; + Common::HashMap _assets; + +}; +} // End of namespace MacVenture + +#endif -- cgit v1.2.3 From 2ff5dad423efd34085876dd8acb6b68046751aed Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Mon, 1 Aug 2016 12:53:31 +0200 Subject: MACVENTURE: Add decoding for 0x10 and 0x7e sounds --- engines/macventure/sound.h | 1 + 1 file changed, 1 insertion(+) (limited to 'engines/macventure/sound.h') diff --git a/engines/macventure/sound.h b/engines/macventure/sound.h index 3c7a68fc2b..d3fb1360a3 100644 --- a/engines/macventure/sound.h +++ b/engines/macventure/sound.h @@ -53,6 +53,7 @@ public: private: void decode10(Common::SeekableReadStream *stream); + void decode7e(Common::SeekableReadStream *stream); private: -- cgit v1.2.3 From f5338f4beb5069ebfbab1d09e8a839e65eeaf8a7 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Mon, 1 Aug 2016 13:40:30 +0200 Subject: MACVENTURE: Add decoding for the rest of the sounds --- engines/macventure/sound.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'engines/macventure/sound.h') diff --git a/engines/macventure/sound.h b/engines/macventure/sound.h index d3fb1360a3..58fc650b00 100644 --- a/engines/macventure/sound.h +++ b/engines/macventure/sound.h @@ -53,6 +53,11 @@ public: private: void decode10(Common::SeekableReadStream *stream); + void decode12(Common::SeekableReadStream *stream); + void decode18(Common::SeekableReadStream *stream); + void decode1a(Common::SeekableReadStream *stream); + void decode44(Common::SeekableReadStream *stream); + void decode78(Common::SeekableReadStream *stream); void decode7e(Common::SeekableReadStream *stream); private: -- cgit v1.2.3 From dd2908fe42d54037436e7b3a05bc275d11822a93 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Mon, 1 Aug 2016 17:19:29 +0200 Subject: MACVENTURE: Add basic audio playback --- engines/macventure/sound.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'engines/macventure/sound.h') diff --git a/engines/macventure/sound.h b/engines/macventure/sound.h index 58fc650b00..d1b1bb8a37 100644 --- a/engines/macventure/sound.h +++ b/engines/macventure/sound.h @@ -29,6 +29,8 @@ #include "common/file.h" #include "common/hashmap.h" +#include "audio/mixer.h" + namespace MacVenture { enum SoundType { @@ -47,7 +49,7 @@ public: SoundAsset(Container *container, ObjID id); ~SoundAsset(); - void play(); + void play(Audio::Mixer *mixer, Audio::SoundHandle *soundHandle); uint32 getPlayLength(); private: @@ -72,7 +74,7 @@ private: class SoundManager { public: - SoundManager(MacVentureEngine *engine); + SoundManager(MacVentureEngine *engine, Audio::Mixer *mixer); ~SoundManager(); uint32 playSound(ObjID sound); @@ -84,6 +86,8 @@ private: Container *_container; Common::HashMap _assets; + Audio::SoundHandle _handle; + Audio::Mixer *_mixer; }; } // End of namespace MacVenture -- cgit v1.2.3