[Scummvm-git-logs] scummvm master -> 971dd0f0d3b7caa3311fe9ff34a21b889d7028ba
a-yyg
76591232+a-yyg at users.noreply.github.com
Fri Jul 2 18:12:34 UTC 2021
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
971dd0f0d3 SAGA2: Merge audiosys.h and audiosmp.h into audio.h
Commit: 971dd0f0d3b7caa3311fe9ff34a21b889d7028ba
https://github.com/scummvm/scummvm/commit/971dd0f0d3b7caa3311fe9ff34a21b889d7028ba
Author: a/ (yuri.kgpps at gmail.com)
Date: 2021-07-03T03:08:56+09:00
Commit Message:
SAGA2: Merge audiosys.h and audiosmp.h into audio.h
Changed paths:
R engines/saga2/audiosmp.h
R engines/saga2/audiosys.h
engines/saga2/audio.cpp
engines/saga2/audio.h
engines/saga2/noise.cpp
engines/saga2/uidialog.cpp
diff --git a/engines/saga2/audio.cpp b/engines/saga2/audio.cpp
index 0c313f8ab0..a0e339d932 100644
--- a/engines/saga2/audio.cpp
+++ b/engines/saga2/audio.cpp
@@ -31,10 +31,7 @@
#include "saga2/hresmgr.h"
#include "saga2/rect.h"
-#include "saga2/queues.h"
#include "saga2/idtypes.h"
-#include "saga2/audiosmp.h"
-#include "saga2/audiosys.h"
namespace Saga2 {
diff --git a/engines/saga2/audio.h b/engines/saga2/audio.h
index 3d0c1f391b..20c9b59cd3 100644
--- a/engines/saga2/audio.h
+++ b/engines/saga2/audio.h
@@ -28,6 +28,7 @@
#define SAGA2_AUDIO_H
#include "audio/mixer.h"
+#include "saga2/queues.h"
namespace Saga2 {
@@ -35,52 +36,440 @@ namespace Saga2 {
the library(s) must be recompiled if you change these settings
* ===================================================================== */
-#define DEBUG_AUDIO 2
-#define STATUS_MESSAGES DEBUG
#define QUEUES_EXTERNAL_ALLOCATION 1
-#define USE_REAL_WAIL 1
// TODO: FIXME. STUB
typedef int HDIGDRIVER;
typedef int HTIMER;
typedef int HMDIDRIVER;
-typedef int HSAMPLE;
-typedef int HSEQUENCE;
-
-// AIL stubs
-#define SMP_DONE 0x0002
-#define SMP_STOPPED 0x0008
-
-void AIL_init_sample(HSAMPLE S);
-HSAMPLE AIL_allocate_sample_handle(HDIGDRIVER dig);
-void AIL_release_sample_handle(HSAMPLE S);
-HSEQUENCE AIL_allocate_sequence_handle(HMDIDRIVER mdi);
-void AIL_end_sample(HSAMPLE S);
-void AIL_set_sample_type(HSAMPLE S, int32 format, uint32 flags);
-uint32 AIL_sample_status(HSAMPLE S);
-void AIL_set_sample_address(HSAMPLE S, void *start, uint32 len);
-int32 AIL_sample_buffer_ready(HSAMPLE S);
-void AIL_end_sequence(HSEQUENCE S);
-void AIL_load_sample_buffer(HSAMPLE S, uint32 buff_num, void *buffer, uint32 len);
-void AIL_start_sample(HSAMPLE S);
-uint32 AIL_sequence_status(HSEQUENCE S);
-void AIL_set_sample_loop_count (HSAMPLE S, int32 loop_count);
-void AIL_set_sequence_loop_count(HSEQUENCE S, int32 loop_count);
-void AIL_start_sequence(HSEQUENCE S);
-void AIL_set_sample_volume(HSAMPLE S, int32 volume);
-void AIL_set_sample_playback_rate(HSAMPLE S, int32 playback_rate);
-void AIL_lock(void);
-void AIL_unlock(void);
-void AIL_release_sequence_handle(HSEQUENCE S);
-int32 AIL_init_sequence(HSEQUENCE S, void *start, int32 sequence_num);
-int32 AIL_sample_volume(HSAMPLE S);
-int32 AIL_sequence_volume(HSEQUENCE S);
-void AIL_set_sequence_volume(HSEQUENCE S, int32 volume, int32 milliseconds);
inline void audioFatal(char *msg) {
error("Sound error %s", msg);
}
+typedef int8 Volume;
+typedef Point32 sampleLocation;
+
+enum soundSampleRate {
+ soundRate11K = 11025,
+ soundRate22K = 22050,
+ soundRate44K = 44100
+};
+
+class soundSample { //: private DList
+public:
+ // sampleFlags
+ enum soundSampleStatus {
+ sampleNone,
+ sampleMore,
+ sampleStop,
+ samplePart,
+ sampleDone,
+ sampleKill
+ };
+
+ enum soundSampleChannels {
+ channelMono,
+ channelStereo,
+ channelLeftOnly,
+ channelRightOnly
+ };
+
+ enum soundSampleGranularity {
+ granularity8Bit,
+ granularity16Bit
+ };
+
+
+ // sampleFlags
+ enum soundSampleFlags {
+ sampleLooped = 0x0001,
+ sampleSigned = 0x0002,
+ sampleRvrsed = 0x0004
+ };
+private:
+ bool initialized;
+ soundSampleChannels defaultChannels;
+ soundSampleRate defaultSpeed;
+ soundSampleGranularity defaultDataSize;
+protected:
+ Volume volume;
+
+public:
+ soundSampleChannels channels;
+ soundSampleRate speed;
+ soundSampleGranularity dataSize;
+ uint32 sampleFlags;
+ uint32 loopCount;
+ soundSampleStatus status;
+ soundSegment curSeg;
+ soundSegment headSeg;
+ void *sourceBuffer;
+ PublicQueue<uint32> segmentList;
+
+ soundSample(soundSegment sa[]); //, sampleLocation pos=Point32( 0, 0 ));
+ soundSample(soundSegment seg); //, sampleLocation pos=Point32( 0, 0 ));
+ virtual ~soundSample();
+
+ soundSample &operator=(const soundSample &src);
+ soundSample(const soundSample &src);
+ bool operator==(const soundSample &src2) const;
+
+ virtual Volume getVolume(void);
+ virtual void setVolume(Volume v);
+
+ virtual void moveTo(Point32) {}
+
+ int init(void) {
+ defaultChannels = channelMono;
+ defaultSpeed = soundRate22K;
+ defaultDataSize = granularity16Bit;
+ initialized = true;
+ return 0;
+ }
+
+ void setDefaultProfile(soundSampleChannels c, soundSampleRate r, soundSampleGranularity g) {
+ if (initialized != true) init();
+ defaultChannels = c;
+ defaultSpeed = r;
+ defaultDataSize = g;
+ }
+
+ soundSampleChannels getDefaultChannels(void) {
+ return defaultChannels;
+ }
+ soundSampleRate getDefaultSpeed(void) {
+ return defaultSpeed;
+ }
+ soundSampleGranularity getDefaultDataSize(void) {
+ return defaultDataSize;
+ }
+
+ uint32 format(void);
+ uint32 flags(void);
+};
+
+typedef Volume(*audioAttenuationFunction)(sampleLocation loc, Volume maxVol);
+#define ATTENUATOR( name ) Volume name( sampleLocation loc, Volume maxVol )
+
+class positionedSample : public soundSample {
+ sampleLocation Pos;
+public:
+ positionedSample(soundSegment sa[], sampleLocation pos = Point32(0, 0));
+ positionedSample(soundSegment seg, sampleLocation pos = Point32(0, 0));
+ virtual Volume getVolume(void);
+ void moveTo(Point32 newLoc) {
+ Pos = newLoc;
+ }
+ virtual void setVolume(Volume v);
+
+};
+
+
+/*******************************************************************/
+/* DRIVERS subdirectory */
+
+#define DRIVER_PATH "DRIVERS"
+#define UNDRIVER_PATH ".."
+
+/*******************************************************************/
+/* typedefs */
+
+typedef positionedSample *pSAMPLE;
+
+/*******************************************************************/
+/* Volume controls */
+
+#define Here Point32(0,0)
+
+typedef int8 Volume;
+
+enum volumeTarget {
+ volSound = 1L << 0, // sound volume
+ volVoice = 1L << 1, // voice volume
+ volSandV, // sound & voice
+ volLoops = 1L << 2, // looped sounds
+ volSandL, // sound and music
+ volVandL, // voice and music
+ volSVandL, // voice and music
+ volMusic = 1L << 3, // music
+ volSandM, // sound and music
+ volVandM, // voice and music
+ volSVandM, // sound voice and music
+ volLandM, // loops and music
+ volSLandM, // sound loops and music
+ volVLandM, // voice loops and music
+ volAll, // all four
+ volSoundMaster = 1L << 4, // master sound volume level
+ volMusicMaster = 1L << 5 // master music volume level
+};
+
+enum volumeMode {
+ volumeSetTo = 0L, // absolute mode
+ volumeUpDown // relative mode
+};
+
+/*******************************************************************/
+/* Audio Fade */
+
+struct audioFade {
+ int16 fadeOutTime,
+ fadeInTime, // Actually it starts fading in immediately
+ overlapTime;
+};
+
+
+/*******************************************************************/
+/* Audio Interface Settings */
+
+struct audioInterfaceSettings {
+ int16 soundBuffers; // Buffers aside from Music, Voice & loop buffers
+ uint32 voiceBufferSize; // Size of voice buffer
+ uint32 musicBufferSize; // Size of music buffers
+ uint32 soundBufferSize; // Size of sound effects buffers
+ uint32 loopBufferSize; // Size of looped effect buffer
+
+ audioInterfaceSettings(int16 sb, uint32 vbs, uint32 mbs, uint32 sbs, uint32 lbs) {
+ soundBuffers = sb;
+ voiceBufferSize = vbs;
+ musicBufferSize = mbs;
+ soundBufferSize = sbs;
+ loopBufferSize = lbs;
+ }
+
+private:
+ audioInterfaceSettings();
+};
+
+
+/*******************************************************************/
+/* */
+/* Audio Interface Class */
+/* */
+/*******************************************************************/
+struct SoundInstance {
+ soundSegment seg;
+ bool loop;
+ sampleLocation loc;
+};
+
+class audioInterface {
+public:
+ enum BufferRequest {
+ requestRecycled = -2L,
+ requestFailed = -1L,
+ requestVoice = 0L,
+ requestMusic0 = 1L,
+ requestMusic1 = 2L,
+ requestLoop = 3L,
+ requestSound0 = 4L,
+ requestSound1 = 5L,
+ requestSound2 = 6L,
+ maxBuffers = 7L,
+ requestMusic = 8L,
+ requestSound = 9L
+ };
+
+private:
+ enum sampleFlags {
+ sampleClear = 0L,
+ sampleMoving = 1L << 0,
+ sampleQueued = 1L << 1
+ };
+
+ enum sampleStopLevel {
+ sStopCleanup = 0L,
+ sStopSegment = 1L,
+ sStopSample = 2L,
+ sStopQueue = 3L
+ };
+
+ enum queueFlags {
+ qrQueueEmpty = 0L,
+ qrBufNotAlloc = 1L,
+ qrSegNotOpen = 2L,
+ qrBufNotReady = 3L,
+ qrWaiting = 4L,
+ qrPlayDone = 5L,
+ qrFinishing = 6L,
+ qrFinished = 7L,
+ qrCleanup = 8L
+ };
+
+ int16 instance;
+ int16 initialized;
+
+ HTIMER gameTimer;
+
+ queueFlags queueRes;
+
+ BufferRequest numBuffers;
+
+ int16 flags[maxBuffers];
+ int16 state[maxBuffers];
+ pSAMPLE samples[maxBuffers];
+ soundSegment lastID[maxBuffers]; // ID of music currently playing
+
+ BufferRequest voiceBuffer; // buffer to feed voice into
+ BufferRequest activeLoop; // currently playing loop
+ BufferRequest activeMusic;
+
+ BufferRequest nextMBuf;
+ soundSegment playing; // ID of music currently playing
+ soundSegment looping; // ID of music currently playing
+
+
+ audioFade fader;
+
+
+ Volume SoundVolume, // Sound Master Volume
+ MusicVolume, // Music Master Volume
+ mVolume, // music volume
+ sVolume, // sound volume
+ vVolume, // voice volume
+ lVolume; // loops volume
+
+ int16 sEnabled, // sound enabled
+ vEnabled, // voice enabled
+ mEnabled, // music enabled
+ lEnabled; // loops enabled
+ bool suspended;
+
+ int32 mQuality; // MIDI driver quality
+ int32 suspendCalls;
+
+public:
+ Audio::SoundHandle _speechSoundHandle;
+ Audio::SoundHandle _sfxSoundHandle;
+ Audio::SoundHandle _bgmSoundHandle;
+ Common::Queue<SoundInstance> _speechQueue;
+ Common::Queue<SoundInstance> _sfxQueue;
+ Common::Queue<SoundInstance> _bgmQueue;
+ HDIGDRIVER dig; // AIL sample driver
+ HMDIDRIVER mid; // AIL MIDI driver
+ audioAttenuationFunction attenuator;
+
+
+private:
+ char status[256]; // audio status messages
+ int16 verbosity;
+
+public:
+ // ctor, dtor, initialization
+ audioInterface(const char *driver_path = DRIVER_PATH, const char *undriver_path = UNDRIVER_PATH);
+ ~audioInterface();
+
+ // init, cleanup
+ void initAudioInterface(audioInterfaceSettings &ais);
+ void cleanupAudioInterface(void);
+
+ // timer calls
+ void adjustGameSpeed(int32 multiplyBy, int32 thenDivideBy);
+ void suspendGameClock(void);
+ void resumeGameClock(void);
+
+ // event loop calls
+ bool playFlag(void);
+ void playMe(void);
+
+ // music calls
+ void playMusic(soundSegment s, int16 loopFactor = 1, sampleLocation where = Here);
+ void stopMusic(void);
+ soundSegment currentMusic(void) {
+ return playing; // ID of music currently playing
+ }
+ bool goodMIDICard(void);
+
+ // sound calls
+ void queueSound(soundSegment s, int16 loopFactor = 1, sampleLocation where = Here);
+ void queueSoundSample(positionedSample *ss, int16 loopFactor);
+
+ // loop calls
+ void queueLoop(soundSegment s, int16 loopFactor = 0, sampleLocation where = Here);
+ void queueLoopSample(positionedSample *ss, int16 loopFactor = 0);
+ void stopLoop(void);
+ void setLoopPosition(sampleLocation newLoc);
+ soundSegment currentLoop(void) {
+ return looping; // ID of music currently playing
+ }
+
+ // voice calls
+ void queueVoice(soundSegment s, sampleLocation where = Here);
+ void queueVoice(soundSegment s[], sampleLocation where = Here);
+ void stopVoice(void);
+ void endVoice(sampleStopLevel ssl = sStopCleanup);
+ void resetState(BufferRequest br);
+ bool talking(void);
+ bool saying(soundSegment s);
+
+ // volume and enabled calls
+ bool active(void);
+ bool activeDIG(void) {
+ return true;
+ }
+ bool enabled(volumeTarget i);
+ void enable(volumeTarget i, bool onOff);
+ void disable(volumeTarget i) {
+ enable(i, false);
+ }
+ void setVolume(volumeTarget targ, volumeMode op, Volume val);
+ Volume getVolume(volumeTarget src);
+ void setMusicFadeStyle(int16 tOut, int16 tIn, int16 tOver);
+ void suspend(void);
+ void resume(void);
+
+ //debugging calls
+ char *statusMessage(void);
+ void shutoffAudio(void);
+ void setVerbosity(int16 n) {
+ verbosity = n;
+ }
+ int16 getQueueSize(void) {
+ return _speechQueue.size() + _sfxQueue.size() + _bgmQueue.size();
+ }
+
+ // moving sample calls
+ audioAttenuationFunction setAttenuator(audioAttenuationFunction newAF);
+
+
+private:
+ void playMusic(BufferRequest targBuffer, positionedSample *ss, int16 loopFactor);
+
+ void setSoundMasterVolume(Volume val);
+ void setMusicMasterVolume(Volume val);
+ void setBufferVolume(BufferRequest, Volume val);
+ void setMusicVolume(Volume val);
+ void setSoundVolume(Volume val);
+ void setVoiceVolume(Volume val);
+ void setLoopsVolume(Volume val);
+ inline bool checkMask(volumeTarget t, volumeTarget m, bool e, volumeTarget vtm) {
+ if ((t & m) && (getVolume(m) > 0) && (getVolume(vtm) > 0))
+ return e;
+ return true;
+ }
+
+ void audioFatalError(char *s);
+ void audioError(char *s);
+ void audioEPrintf(char *s, ...);
+ void audioErrorID(int);
+ void audioStatus(char *s);
+ void audioStatCat(char *s);
+
+ void setSample(BufferRequest sampNo, positionedSample *ss);
+
+#ifdef __WATCOMC__
+#pragma off ( unreferenced ) ;
+#endif
+ static ATTENUATOR(defaultAttenuator) {
+ return maxVol;
+ }
+#ifdef __WATCOMC__
+#pragma on ( unreferenced ) ;
+#endif
+};
+
+void disableAudio(void);
+
} // end of namespace Saga2
#endif
diff --git a/engines/saga2/audiosmp.h b/engines/saga2/audiosmp.h
deleted file mode 100644
index d7388500ed..0000000000
--- a/engines/saga2/audiosmp.h
+++ /dev/null
@@ -1,196 +0,0 @@
-/* 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.
- *
- *
- * Based on the original sources
- * Faery Tale II -- The Halls of the Dead
- * (c) 1993-1996 The Wyrmkeep Entertainment Co.
- */
-
-#ifndef SAGA2_AUDIOSMP_H
-#define SAGA2_AUDIOSMP_H
-
-namespace Saga2 {
-
-/* ===================================================================== *
-
- Sound Sample Attributes
-
- id - resource id, file offset, etc
- status - processing status
-
- channels - mono or stereo
- rate - sampling rate 11K/22K/44K
- granularity - 8 bit or 16 bit
-
- flags:
- looped - keep playing that song Sam
-
- * ===================================================================== */
-
-#define ENDSAMP 0xFFFFFFFF
-
-typedef uint32 soundSampleID;
-typedef soundSegment *segmentArray;
-typedef int8 Volume;
-typedef Point32 sampleLocation;
-
-enum soundSampleRate {
- soundRate11K = 11025,
- soundRate22K = 22050,
- soundRate44K = 44100
-};
-
-
-class soundSample { //: private DList
-public:
- // sampleFlags
- enum soundSampleStatus {
- sampleNone,
- sampleMore,
- sampleStop,
- samplePart,
- sampleDone,
- sampleKill
- };
-
- enum soundSampleChannels {
- channelMono,
- channelStereo,
- channelLeftOnly,
- channelRightOnly
- };
-
- enum soundSampleGranularity {
- granularity8Bit,
- granularity16Bit
- };
-
-
- // sampleFlags
- enum soundSampleFlags {
- sampleLooped = 0x0001,
- sampleSigned = 0x0002,
- sampleRvrsed = 0x0004
- };
-private:
- bool initialized;
- soundSampleChannels defaultChannels;
- soundSampleRate defaultSpeed;
- soundSampleGranularity defaultDataSize;
-protected:
-// sampleLocation location;
- Volume volume;
-
-public:
- soundSampleChannels channels;
- soundSampleRate speed;
- soundSampleGranularity dataSize;
- uint32 sampleFlags;
- uint32 loopCount;
- soundSampleStatus status;
- soundSegment curSeg;
- soundSegment headSeg;
- void *sourceBuffer;
- PublicQueue<uint32> segmentList;
-
- soundSample(soundSegment sa[]); //, sampleLocation pos=Point32( 0, 0 ));
- soundSample(soundSegment seg); //, sampleLocation pos=Point32( 0, 0 ));
- virtual ~soundSample();
-
- soundSample &operator=(const soundSample &src);
- soundSample(const soundSample &src);
- bool operator==(const soundSample &src2) const;
-
- virtual Volume getVolume(void);
- virtual void setVolume(Volume v);
-
- virtual void moveTo(Point32) {}
-
- int init(void) {
- defaultChannels = channelMono;
- defaultSpeed = soundRate22K;
- defaultDataSize = granularity16Bit;
- initialized = true;
- return 0;
- }
-
- void setDefaultProfile(soundSampleChannels c, soundSampleRate r, soundSampleGranularity g) {
- if (initialized != true) init();
- defaultChannels = c;
- defaultSpeed = r;
- defaultDataSize = g;
- }
-
- soundSampleChannels getDefaultChannels(void) {
- return defaultChannels;
- }
- soundSampleRate getDefaultSpeed(void) {
- return defaultSpeed;
- }
- soundSampleGranularity getDefaultDataSize(void) {
- return defaultDataSize;
- }
-
- uint32 format(void);
- uint32 flags(void);
-};
-
-/* ===================================================================== *
- A moving sample class (not currently enabled)
- * ===================================================================== */
-
-typedef Volume(*audioAttenuationFunction)(sampleLocation loc, Volume maxVol);
-#define ATTENUATOR( name ) Volume name( sampleLocation loc, Volume maxVol )
-typedef Point32 sampleVelocity;
-typedef Point32 sampleAcceleration;
-
-
-class positionedSample : public soundSample {
- sampleLocation Pos;
-public:
- positionedSample(soundSegment sa[], sampleLocation pos = Point32(0, 0));
- positionedSample(soundSegment seg, sampleLocation pos = Point32(0, 0));
- virtual Volume getVolume(void);
- void moveTo(Point32 newLoc) {
- Pos = newLoc;
- }
- virtual void setVolume(Volume v);
-
-};
-
-class movingSample : public positionedSample {
-private:
- sampleLocation Pos;
- sampleVelocity dPos;
- sampleAcceleration ddPos;
- uint32 t0;
- void updateLocation(void);
-public:
- movingSample(soundSegment sa[], sampleLocation pos, sampleVelocity vel, sampleAcceleration acc);
- movingSample(soundSegment seg, sampleLocation pos, sampleVelocity vel, sampleAcceleration acc);
- ~movingSample() {};
-
- Volume getVolume(void);
-};
-
-} // end of namespace Saga2
-
-#endif
diff --git a/engines/saga2/audiosys.h b/engines/saga2/audiosys.h
deleted file mode 100644
index 25802fb3c3..0000000000
--- a/engines/saga2/audiosys.h
+++ /dev/null
@@ -1,363 +0,0 @@
-/* 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.
- *
- *
- * Based on the original sources
- * Faery Tale II -- The Halls of the Dead
- * (c) 1993-1996 The Wyrmkeep Entertainment Co.
- */
-
-#ifndef SAGA2_AUDIOSYS_H
-#define SAGA2_AUDIOSYS_H
-
-namespace Saga2 {
-
-class Buffer;
-class musicBuffer;
-
-/*******************************************************************/
-/* DRIVERS subdirectory */
-
-#define DRIVER_PATH "DRIVERS"
-#define UNDRIVER_PATH ".."
-
-/*******************************************************************/
-/* typedefs */
-
-typedef Buffer *pSBUFFER;
-typedef positionedSample *pSAMPLE;
-
-/*******************************************************************/
-/* Debug handling */
-
-#define STATUS_MESSAGES DEBUG
-#define ALLOW_MOVING_SAMPLES 0
-#define ZERO_VOLUME_DISABLES 1
-#define ALLOW_AUDIO_RECYCLING 1
-
-
-/*******************************************************************/
-/* Volume controls */
-
-#define Here Point32(0,0)
-
-/*******************************************************************/
-/* Volume controls */
-
-typedef int8 Volume;
-
-enum volumeTarget {
- volSound = 1L << 0, // sound volume
- volVoice = 1L << 1, // voice volume
- volSandV, // sound & voice
- volLoops = 1L << 2, // looped sounds
- volSandL, // sound and music
- volVandL, // voice and music
- volSVandL, // voice and music
- volMusic = 1L << 3, // music
- volSandM, // sound and music
- volVandM, // voice and music
- volSVandM, // sound voice and music
- volLandM, // loops and music
- volSLandM, // sound loops and music
- volVLandM, // voice loops and music
- volAll, // all four
- volSoundMaster = 1L << 4, // master sound volume level
- volMusicMaster = 1L << 5 // master music volume level
-};
-
-enum volumeMode {
- volumeSetTo = 0L, // absolute mode
- volumeUpDown // relative mode
-};
-
-/*******************************************************************/
-/* Audio Fade */
-
-struct audioFade {
- int16 fadeOutTime,
- fadeInTime, // Actually it starts fading in immediately
- overlapTime;
-};
-
-
-/*******************************************************************/
-/* Audio Interface Settings */
-
-struct audioInterfaceSettings {
- int16 soundBuffers; // Buffers aside from Music, Voice & loop buffers
- uint32 voiceBufferSize; // Size of voice buffer
- uint32 musicBufferSize; // Size of music buffers
- uint32 soundBufferSize; // Size of sound effects buffers
- uint32 loopBufferSize; // Size of looped effect buffer
-
- audioInterfaceSettings(int16 sb, uint32 vbs, uint32 mbs, uint32 sbs, uint32 lbs) {
- soundBuffers = sb;
- voiceBufferSize = vbs;
- musicBufferSize = mbs;
- soundBufferSize = sbs;
- loopBufferSize = lbs;
- }
-
-private:
- audioInterfaceSettings();
-};
-
-
-/*******************************************************************/
-/* */
-/* Audio Interface Class */
-/* */
-/*******************************************************************/
-struct SoundInstance {
- soundSegment seg;
- bool loop;
- sampleLocation loc;
-};
-
-class audioInterface {
-public:
- enum BufferRequest {
- requestRecycled = -2L,
- requestFailed = -1L,
- requestVoice = 0L,
- requestMusic0 = 1L,
- requestMusic1 = 2L,
- requestLoop = 3L,
- requestSound0 = 4L,
- requestSound1 = 5L,
- requestSound2 = 6L,
- maxBuffers = 7L,
- requestMusic = 8L,
- requestSound = 9L
- };
-
-private:
- enum sampleFlags {
- sampleClear = 0L,
- sampleMoving = 1L << 0,
- sampleQueued = 1L << 1
- };
-
- enum sampleStopLevel {
- sStopCleanup = 0L,
- sStopSegment = 1L,
- sStopSample = 2L,
- sStopQueue = 3L
- };
-
- enum queueFlags {
- qrQueueEmpty = 0L,
- qrBufNotAlloc = 1L,
- qrSegNotOpen = 2L,
- qrBufNotReady = 3L,
- qrWaiting = 4L,
- qrPlayDone = 5L,
- qrFinishing = 6L,
- qrFinished = 7L,
- qrCleanup = 8L
- };
-
- int16 instance;
- int16 initialized;
-
- HTIMER gameTimer;
-
- queueFlags queueRes;
-
- BufferRequest numBuffers;
-
- int16 flags[maxBuffers];
- int16 state[maxBuffers];
- pSBUFFER SampHand[maxBuffers];
- pSAMPLE samples[maxBuffers];
- soundSegment lastID[maxBuffers]; // ID of music currently playing
-
- BufferRequest voiceBuffer; // buffer to feed voice into
- BufferRequest activeLoop; // currently playing loop
- BufferRequest activeMusic;
-
- BufferRequest nextMBuf;
- soundSegment playing; // ID of music currently playing
- soundSegment looping; // ID of music currently playing
-
-
- audioFade fader;
-
-
- Volume SoundVolume, // Sound Master Volume
- MusicVolume, // Music Master Volume
- mVolume, // music volume
- sVolume, // sound volume
- vVolume, // voice volume
- lVolume; // loops volume
-
- int16 sEnabled, // sound enabled
- vEnabled, // voice enabled
- mEnabled, // music enabled
- lEnabled; // loops enabled
- bool suspended;
-
- int32 mQuality; // MIDI driver quality
- int32 suspendCalls;
-
-public:
- Audio::SoundHandle _speechSoundHandle;
- Audio::SoundHandle _sfxSoundHandle;
- Audio::SoundHandle _bgmSoundHandle;
- Common::Queue<SoundInstance> _speechQueue;
- Common::Queue<SoundInstance> _sfxQueue;
- Common::Queue<SoundInstance> _bgmQueue;
- HDIGDRIVER dig; // AIL sample driver
- HMDIDRIVER mid; // AIL MIDI driver
- audioAttenuationFunction attenuator;
-
-
-private:
- char status[256]; // audio status messages
- int16 verbosity;
-
-public:
- // ctor, dtor, initialization
- audioInterface(const char *driver_path = DRIVER_PATH, const char *undriver_path = UNDRIVER_PATH);
- ~audioInterface();
-
- // init, cleanup
- void initAudioInterface(audioInterfaceSettings &ais);
- void cleanupAudioInterface(void);
-
- // timer calls
- void adjustGameSpeed(int32 multiplyBy, int32 thenDivideBy);
- void suspendGameClock(void);
- void resumeGameClock(void);
-
- // event loop calls
- bool playFlag(void);
- void playMe(void);
-
- // music calls
- void playMusic(soundSegment s, int16 loopFactor = 1, sampleLocation where = Here);
- void stopMusic(void);
- soundSegment currentMusic(void) {
- return playing; // ID of music currently playing
- }
- bool goodMIDICard(void);
-
- // sound calls
- void queueSound(soundSegment s, int16 loopFactor = 1, sampleLocation where = Here);
- void queueSoundSample(positionedSample *ss, int16 loopFactor);
-
- // loop calls
- void queueLoop(soundSegment s, int16 loopFactor = 0, sampleLocation where = Here);
- void queueLoopSample(positionedSample *ss, int16 loopFactor = 0);
- void stopLoop(void);
- void setLoopPosition(sampleLocation newLoc);
- soundSegment currentLoop(void) {
- return looping; // ID of music currently playing
- }
-
- // voice calls
- void queueVoice(soundSegment s, sampleLocation where = Here);
- void queueVoice(soundSegment s[], sampleLocation where = Here);
- void stopVoice(void);
- void endVoice(sampleStopLevel ssl = sStopCleanup);
- void resetState(BufferRequest br);
- bool talking(void);
- bool saying(soundSegment s);
-
- // volume and enabled calls
- bool active(void);
- bool activeDIG(void) {
- return true;
- }
- bool enabled(volumeTarget i);
- void enable(volumeTarget i, bool onOff);
- void disable(volumeTarget i) {
- enable(i, false);
- }
- void setVolume(volumeTarget targ, volumeMode op, Volume val);
- Volume getVolume(volumeTarget src);
- void setMusicFadeStyle(int16 tOut, int16 tIn, int16 tOver);
- void suspend(void);
- void resume(void);
-
- //debugging calls
- char *statusMessage(void);
- void shutoffAudio(void);
- void setVerbosity(int16 n) {
- verbosity = n;
- }
- int16 getQueueSize(void) {
- return _speechQueue.size() + _sfxQueue.size() + _bgmQueue.size();
- }
-
- // moving sample calls
- audioAttenuationFunction setAttenuator(audioAttenuationFunction newAF);
-
-
-private:
- void playMusic(BufferRequest targBuffer, positionedSample *ss, int16 loopFactor);
-
- void setSoundMasterVolume(Volume val);
- void setMusicMasterVolume(Volume val);
- void setBufferVolume(BufferRequest, Volume val);
- void setMusicVolume(Volume val);
- void setSoundVolume(Volume val);
- void setVoiceVolume(Volume val);
- void setLoopsVolume(Volume val);
- inline bool checkMask(volumeTarget t, volumeTarget m, bool e, volumeTarget vtm) {
- if ((t & m)
-#if ZERO_VOLUME_DISABLES
- && (getVolume(m) > 0) && (getVolume(vtm) > 0)
-#endif
- )
- return e;
- return true;
- }
-
-
- void crossFade(musicBuffer *mbOut, musicBuffer *mbIn);
- void fadeIn(musicBuffer *mbIn);
-
- void audioFatalError(char *s);
- void audioError(char *s);
- void audioEPrintf(char *s, ...);
- void audioErrorID(int);
- void audioStatus(char *s);
- void audioStatCat(char *s);
-
- void setSample(BufferRequest sampNo, positionedSample *ss);
-
-#ifdef __WATCOMC__
-#pragma off ( unreferenced ) ;
-#endif
- static ATTENUATOR(defaultAttenuator) {
- return maxVol;
- }
-#ifdef __WATCOMC__
-#pragma on ( unreferenced ) ;
-#endif
-};
-
-void disableAudio(void);
-
-} // end of namespace Saga2
-
-#endif
diff --git a/engines/saga2/noise.cpp b/engines/saga2/noise.cpp
index 649203b9c5..ed1639a6f3 100644
--- a/engines/saga2/noise.cpp
+++ b/engines/saga2/noise.cpp
@@ -32,9 +32,6 @@
#include "saga2/audio.h"
#include "saga2/annoy.h"
#include "saga2/player.h"
-#include "saga2/queues.h"
-#include "saga2/audiosmp.h"
-#include "saga2/audiosys.h"
#include "saga2/hresmgr.h"
#include "saga2/shorten.h"
diff --git a/engines/saga2/uidialog.cpp b/engines/saga2/uidialog.cpp
index 0a7f5466fc..f180cd61c3 100644
--- a/engines/saga2/uidialog.cpp
+++ b/engines/saga2/uidialog.cpp
@@ -37,10 +37,6 @@
#include "saga2/script.h"
#include "saga2/audio.h"
-#include "saga2/queues.h"
-#include "saga2/audiosmp.h"
-#include "saga2/audiosys.h"
-
#include "saga2/uidialog.h"
#include "saga2/document.h"
#include "saga2/tilemode.h"
More information about the Scummvm-git-logs
mailing list