Skip to content

Zero Hour rebuilt from EA's source: x64, Direct3D 11, VS2022/CMake, ~60 original bugs fixed, an AI that builds a base. Bring your own game.

fix(audio): travelling stops, faster jets bend more, duck log

Olcay Seyganfd088566700c
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7ed631ded..019ccb0a0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -10,9 +10,9 @@ found and fixed — EA's own, not port damage.**
## Sound that travels
-- Sound takes time to cross the battlefield now. An explosion at the edge of the screen is heard about a quarter of a second after it is seen, one at the far end of a long view half a second after, at the speed of sound on the scale the units are drawn at. The wait never runs past a second, and unit replies, the interface, music, speech and every sound a mission script waits on still play the moment they are asked for.
+- Sound takes time to cross the battlefield now. An explosion at the edge of the screen is heard about a quarter of a second after it is seen, one at the far end of a long view half a second after, at the speed of sound on the scale the units are drawn at. The wait never runs past a second. A sound also ends as late as it started: a missile's roar carries on until its boom arrives, instead of cutting out at the visible impact and leaving a hole seven decibels deep before the boom. Unit replies, the interface, music, speech and every sound a mission script waits on still play the moment they are asked for.
- Distance takes the top off a sound as air does, twelve decibels an octave. Fighting in the middle of the screen keeps its crack, a blast across a long view arrives with its crack gone, mostly thump, and a nuke across the map is low thunder and nothing else. The muffling EA gave sixteen explosions for when they go off out of view used to be only a drop in volume; it is a real muffling now, so those blasts are no quieter off screen than on it, only duller.
-- Jets, helicopters and the Nuke Cannon's shell rise in pitch as they come in and drop as they pass, by how fast they move towards you. Units cross the map far slower than the real machines would, so the bend is worked out at three times their speed: a Raptor run comes in six semitones high and leaves five low, and an Aurora screams in a full octave up.
+- Jets, helicopters and the Nuke Cannon's shell rise in pitch as they come in and drop as they pass, by how fast they move towards you. Units cross the map far slower than the real machines would, and the faster the unit the bigger the gap, so the bend is worked out at three times a tank's speed and more for anything quicker: a Raptor or a MiG is heard at five times its speed and comes in several semitones high on a normal pass, up to an octave dead overhead, and an Aurora screams in a full octave up.
- Every map has an echo of its own, worked out from how much of it is built over. A city rings for nearly two seconds with a slap straight back off the buildings. Open desert answers a quarter of a second late from the hills, a distinct second crack and then a long, thin, dark tail. Snow kills it: a short dead tail, no echo, and air that takes the top end off a sound sooner. Far sounds carry more of the room than near ones. Unit replies take none of this, no muffling, no pitch bend and no echo: a tank answering from across the map sounds like a radio in your ear, as it always has.
- A nuke, a Particle Cannon sweep, a Daisy Cutter, a MOAB or a Nuke Cannon shell that lands within earshot leaves you half deaf. The rest of the battle drops to a sixth of its volume and is muffled down to a few hundred hertz for a second, then comes back over three more, all of it by how close the blast was.
- Nothing clips any more. A dense tank fight in a city used to drive one sample in twenty past full scale, and the city's echo made it worse; a limiter at the end of the mix now looks two milliseconds ahead and turns the whole mix down just enough, so the loudest moment is as loud as the speakers go and no louder.
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioEventRTS.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioEventRTS.h
index 81d7cb76f..1a9d59193 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioEventRTS.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioEventRTS.h
@@ -154,6 +154,8 @@ public:
Bool getUninterruptable( ) const { return m_uninterruptable; }
void setUninterruptable( Bool uninterruptable ) { m_uninterruptable = uninterruptable; }
void setSkipAttack( Bool skipAttack ) { m_skipAttack = skipAttack; } ///< start on the loop itself, for a loop picked up again mid-way
+ Bool getTravels( void ) const { return m_travels; }
+ void setTravels( Bool travels ) { m_travels = travels; } ///< started late by its distance, so it stops late by it too
/** LOGIC-THREAD.md M5. A random list remembers its last pick in the caller's event so it does not
* play one variant twice running, and a sound a tick asks for picks after the tick. The caller is
@@ -204,6 +206,7 @@ protected:
Bool m_isLogicalAudio; ///< Should probably only be true for scripted sounds
Bool m_uninterruptable;
Bool m_skipAttack;
+ Bool m_travels;
// Playing attributes
Real m_pitchShift; ///< Pitch shift that should occur on this piece of audio
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h
index cea033924..9a6ea4d67 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h
@@ -48,6 +48,7 @@ struct AudioSettings
m_speedOfSound( 1700.0f ),
m_maxSoundDelay( 1000.0f ),
m_dopplerScale( 3.0f ),
+ m_dopplerFastSpeed( 100.0f ),
m_airAbsorptionDistance( 300.0f ),
m_reverbLevel( 1.0f ),
m_duckVolume( 0.15f ),
@@ -91,7 +92,9 @@ struct AudioSettings
* by doppler. The ground is drawn at about 0.2 m a unit (a Ranger stands 13 units, a Crusader
* is 30 long), so 343 m/s is 1700. Zero is neither. `DopplerScale` multiplies the speed doppler
* hears, zero switching doppler alone off: 3, since a Raptor crosses the map at 35 m/s on that
- * scale and a real jet's pitch bend needs it about ten times faster.
+ * scale and a real jet's pitch bend needs it about ten times faster. `DopplerFastSpeed`, units
+ * a second: past it the scale grows with the speed, so at 100 a Raptor at 175 is heard at 5.25
+ * times its speed and a tank at 30 at 3. Zero keeps one scale for everything.
* `AirAbsorptionDistance`, game units: where air has taken the top end down from 20 kHz to 10,
* falling with the square of the distance past it, through two stages. Zero is no air. A snow
* map takes it at 60%.
@@ -101,6 +104,7 @@ struct AudioSettings
Real m_speedOfSound;
Real m_maxSoundDelay;
Real m_dopplerScale;
+ Real m_dopplerFastSpeed;
Real m_airAbsorptionDistance;
Real m_reverbLevel;
Real m_duckVolume;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
index db094e19e..e00124ddd 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
@@ -271,6 +271,8 @@ class AudioManager : public SubsystemInterface
const AudioSettings *getAudioSettings( void ) const;
const MiscAudio *getMiscAudio( void ) const;
+ /// how long a sound from there takes to reach the microphone, milliseconds, at most MaxSoundDelay
+ Real getTravelMs( const Coord3D *position ) const;
// This function should only be called by AudioManager, MusicManager and SoundManager
virtual void releaseAudioEventRTS( AudioEventRTS *eventToRelease );
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/AudioEventRTS.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/AudioEventRTS.cpp
index 09455b4e2..5ec4659f2 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/AudioEventRTS.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/AudioEventRTS.cpp
@@ -85,7 +85,8 @@ AudioEventRTS::AudioEventRTS()
m_playerIndex(-1),
m_delay(0.0f),
m_uninterruptable(FALSE),
- m_skipAttack(FALSE)
+ m_skipAttack(FALSE),
+ m_travels(FALSE)
{
m_attackName.clear();
m_decayName.clear();
@@ -113,7 +114,8 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName )
m_playerIndex(-1),
m_delay(0.0f),
m_uninterruptable(FALSE),
- m_skipAttack(FALSE)
+ m_skipAttack(FALSE),
+ m_travels(FALSE)
{
m_attackName.clear();
m_decayName.clear();
@@ -142,7 +144,8 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, ObjectID ownerID )
m_playerIndex(-1),
m_delay(0.0f),
m_uninterruptable(FALSE),
- m_skipAttack(FALSE)
+ m_skipAttack(FALSE),
+ m_travels(FALSE)
{
m_attackName.clear();
m_decayName.clear();
@@ -179,7 +182,8 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, DrawableID drawableI
m_playerIndex(-1),
m_delay(0.0f),
m_uninterruptable(FALSE),
- m_skipAttack(FALSE)
+ m_skipAttack(FALSE),
+ m_travels(FALSE)
{
m_attackName.clear();
m_decayName.clear();
@@ -215,7 +219,8 @@ AudioEventRTS::AudioEventRTS( const AsciiString& eventName, const Coord3D *posit
m_playerIndex(-1),
m_delay(0.0f),
m_uninterruptable(FALSE),
- m_skipAttack(FALSE)
+ m_skipAttack(FALSE),
+ m_travels(FALSE)
{
m_positionOfAudio.set( positionOfAudio );
m_attackName.clear();
@@ -248,6 +253,7 @@ AudioEventRTS::AudioEventRTS( const AudioEventRTS& right )
m_portionToPlayNext = right.m_portionToPlayNext;
m_uninterruptable = right.m_uninterruptable;
m_skipAttack = right.m_skipAttack;
+ m_travels = right.m_travels;
if( m_ownerType == OT_Positional || m_ownerType == OT_Dead )
{
@@ -290,6 +296,7 @@ AudioEventRTS& AudioEventRTS::operator=( const AudioEventRTS& right )
m_portionToPlayNext = right.m_portionToPlayNext;
m_uninterruptable = right.m_uninterruptable;
m_skipAttack = right.m_skipAttack;
+ m_travels = right.m_travels;
if( m_ownerType == OT_Positional || m_ownerType == OT_Dead )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
index 6ed67b5c1..5d5d7ace1 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
@@ -133,6 +133,7 @@ static const FieldParse audioSettingsFieldParseTable[] =
{ "SpeedOfSound", INI::parseReal, NULL, offsetof( AudioSettings, m_speedOfSound) },
{ "MaxSoundDelay", INI::parseReal, NULL, offsetof( AudioSettings, m_maxSoundDelay) },
{ "DopplerScale", INI::parseReal, NULL, offsetof( AudioSettings, m_dopplerScale) },
+ { "DopplerFastSpeed", INI::parseReal, NULL, offsetof( AudioSettings, m_dopplerFastSpeed) },
{ "AirAbsorptionDistance", INI::parseReal, NULL, offsetof( AudioSettings, m_airAbsorptionDistance) },
{ "ReverbLevel", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_reverbLevel) },
{ "DuckVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_duckVolume) },
@@ -568,17 +569,14 @@ AudioHandle AudioManager::addAudioEventNow(const AudioEventRTS *eventToAdd, Audi
// Sound takes time to arrive: a world sound starts late by its distance to the microphone over
// SpeedOfSound, at most MaxSoundDelay, on top of the delay its INI gives it. Not a unit's voice,
// which answers the player, and not a script's sound, which logic waits on in the same frame. The
- // request list counts the delay down in logic time (MilesAudioManager::processRequestList).
+ // request list counts the delay down in logic time (MilesAudioManager::processRequestList). Such a
+ // sound is marked as travelling, and its stop is held back the same way (stopAudioEvent).
const AudioEventInfo *info = eventToAdd->getAudioEventInfo();
- const Real speedOfSound = getAudioSettings()->m_speedOfSound;
if (info->m_soundType == AT_SoundEffect && audioEvent->isPositionalAudio() && !eventToAdd->getIsLogicalAudio()
- && !BitTest(info->m_type, ST_VOICE) && speedOfSound > 0.0f)
+ && !BitTest(info->m_type, ST_VOICE) && getAudioSettings()->m_speedOfSound > 0.0f)
{
- Coord3D toMicrophone = *audioEvent->getCurrentPosition();
- toMicrophone.sub(&m_listenerPosition);
- const Real travelMs = toMicrophone.length() / speedOfSound * MSEC_PER_SECOND;
- const Real maxMs = getAudioSettings()->m_maxSoundDelay;
- audioEvent->setDelay(audioEvent->getDelay() + (travelMs < maxMs ? travelMs : maxMs));
+ audioEvent->setDelay(audioEvent->getDelay() + getTravelMs(audioEvent->getCurrentPosition()));
+ audioEvent->setTravels(TRUE);
}
std::list<std::pair<AsciiString, Real> >::iterator it;
@@ -1090,6 +1088,15 @@ const AudioSettings *AudioManager::getAudioSettings( void ) const
return m_audioSettings;
}
+//-------------------------------------------------------------------------------------------------
+Real AudioManager::getTravelMs( const Coord3D *position ) const
+{
+ Coord3D toMicrophone = *position;
+ toMicrophone.sub(&m_listenerPosition);
+ const Real travelMs = toMicrophone.length() / m_audioSettings->m_speedOfSound * MSEC_PER_SECOND;
+ return travelMs < m_audioSettings->m_maxSoundDelay ? travelMs : m_audioSettings->m_maxSoundDelay;
+}
+
//-------------------------------------------------------------------------------------------------
AudioSettings *AudioManager::friend_getAudioSettings( void )
{
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
index f2a6128f0..2573de4ef 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GameEngine.cpp
@@ -1158,7 +1158,9 @@ void GameEngine::init( int argc, char *argv[] )
if (!TheGlobalData->m_audioOn)
DEBUG_LOG(("TheAudio: audio off, no device opened\n"));
else
- DEBUG_LOG(("TheAudio: audio on, device handle %s\n", TheAudio->getDevice() != NULL ? "set" : "none (no device could be opened)"));
+ DEBUG_LOG(("TheAudio: audio on, %s\n", TheAudio->getDevice() == NULL ? "no device (none could be opened), nothing is heard"
+ : TheGlobalData->m_wavEndFrame > 0 ? "no output device: the -wav mix runs offline on the logic clock, into the file only"
+ : "output device open"));
//
// Missing music used to end the process here, with setQuitting and not one word anywhere: the
// game started, the window appeared for a moment and it closed again. A player who deleted
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h b/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h
index efc9560fa..4ed88a60b 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h
@@ -90,6 +90,10 @@ struct PlayingAudio
Bool m_tracked;
Coord3D m_lastPosition;
Coord3D m_velocity;
+ /// A sound that started late by its distance stops late by it too: the stop is held here, in
+ /// logic milliseconds still to wait, and m_stopHeld stays set once it has gone through.
+ Bool m_stopHeld;
+ Real m_stopInMs;
PlayingAudio() :
m_type(PAT_INVALID),
@@ -102,7 +106,9 @@ struct PlayingAudio
m_3DSample(0),
m_stream(0),
m_framesFaded(0),
- m_tracked(false)
+ m_tracked(false),
+ m_stopHeld(false),
+ m_stopInMs(0.0f)
{
m_lastPosition.zero();
m_velocity.zero();
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
index 11f2d0890..60c798940 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
@@ -1152,6 +1152,19 @@ void MilesAudioManager::stopAudioEvent( AudioHandle handle )
#ifdef INTENSIVE_AUDIO_DEBUG
DEBUG_LOG((" (%s)\n", audio->m_audioEventRTS->getEventName()));
#endif
+ // What is heard is what happened a travel time ago, so a sound that started late by its
+ // distance ends late by it too: a missile's flight loop runs on until its boom arrives,
+ // rather than going quiet the moment it is seen to hit. processPlayingList lets it go.
+ if (audio->m_stopHeld) {
+ break;
+ }
+ const Real travelMs = audio->m_audioEventRTS->getTravels()
+ ? getTravelMs(audio->m_audioEventRTS->getCurrentPosition()) : 0.0f;
+ if (travelMs > 0.0f) {
+ audio->m_stopHeld = true;
+ audio->m_stopInMs = travelMs;
+ break;
+ }
audio->m_requestStop = true;
endLoopPassNow( audio );
break;
@@ -2703,13 +2716,24 @@ void MilesAudioManager::processPlayingList( void )
}
else
{
- if (m_volumeHasChanged)
+ if (m_volumeHasChanged)
{
adjustPlayingVolume(playing);
}
+ // a held stop (stopAudioEvent) goes through once its travel time has passed
+ if (playing->m_stopHeld && playing->m_stopInMs > 0.0f)
+ {
+ playing->m_stopInMs -= m_clockElapsedMs;
+ if (playing->m_stopInMs <= 0.0f)
+ {
+ playing->m_requestStop = true;
+ endLoopPassNow( playing );
+ }
+ }
+
const Coord3D *pos = getCurrentPositionFromEvent(playing->m_audioEventRTS);
- if (pos)
+ if (pos)
{
if( playing->m_audioEventRTS->isDead() )
{
@@ -2948,7 +2972,12 @@ void MilesAudioManager::trackVelocity( PlayingAudio *playing, const Coord3D *pos
playing->m_velocity.x += 0.5f * ((pos->x - playing->m_lastPosition.x) * perSecond - playing->m_velocity.x);
playing->m_velocity.y += 0.5f * ((pos->y - playing->m_lastPosition.y) * perSecond - playing->m_velocity.y);
playing->m_velocity.z += 0.5f * ((pos->z - playing->m_lastPosition.z) * perSecond - playing->m_velocity.z);
- const Real scale = m_audioSettings->m_dopplerScale;
+ // The faster a unit, the further its game speed is below the real machine's: a tank is drawn at
+ // about half its real speed, a Raptor at a tenth. Past DopplerFastSpeed the scale grows with the
+ // speed, so a jet's pass bends as far as a helicopter's does and further.
+ const Real fastSpeed = m_audioSettings->m_dopplerFastSpeed;
+ const Real speed = playing->m_velocity.length();
+ const Real scale = m_audioSettings->m_dopplerScale * (fastSpeed > 0.0f && speed > fastSpeed ? speed / fastSpeed : 1.0f);
AIL_set_3D_velocity_vector( playing->m_3DSample, playing->m_velocity.x * scale, playing->m_velocity.y * scale,
playing->m_velocity.z * scale );
}
@@ -3029,12 +3058,27 @@ void MilesAudioManager::duckForBlast( AudioEventRTS *event, H3DSAMPLE sample3D )
const Bool global = BitTest(info->m_type, ST_GLOBAL);
Coord3D toMicrophone = *getCurrentPositionFromEvent(event);
toMicrophone.sub(&m_listenerPosition);
- const Real nearness = sqrtf(AIL_ex_3D_distance_gain(toMicrophone.length(),
+ const Real distance = toMicrophone.length();
+ const Real nearness = sqrtf(AIL_ex_3D_distance_gain(distance,
global ? (Real)settings->m_globalMinRange : info->m_minDistance,
global ? (Real)settings->m_globalMaxRange : info->m_maxDistance, settings->m_rangeVolumeFade));
if (nearness <= 0.0f)
+ {
+ DEBUG_LOG(("AUDIO: duck by %s at %.0f units: out of earshot, none\n", event->getEventName().str(), distance));
return;
- AIL_ex_duck(sample3D, 1.0f - (1.0f - settings->m_duckVolume) * nearness, settings->m_duckTime / MSEC_PER_SECOND);
+ }
+ const Real gain = 1.0f - (1.0f - settings->m_duckVolume) * nearness;
+ const Real seconds = settings->m_duckTime / MSEC_PER_SECOND;
+ AIL_ex_duck(sample3D, gain, seconds);
+ // AIL_ex_duck_gain's shape: down by 0.05 s, held to a quarter of the time, back to full at its end
+ const Real DUCK_ATTACK_SECONDS = 0.05f;
+ const Real heldTo = 0.25f * seconds > DUCK_ATTACK_SECONDS ? 0.25f * seconds : DUCK_ATTACK_SECONDS;
+ const Real halfway = 0.5f * (heldTo + seconds);
+ const Real halfwayGain = AIL_ex_duck_gain(halfway, gain, seconds);
+ DEBUG_LOG(("AUDIO: duck by %s at %.0f units, nearness %.2f: the rest at %.2f (%.1f dB) muffled to %.0f Hz, "
+ "held to %.2f s, at %.2f s %.2f and %.0f Hz, full at %.2f s, frame %u\n",
+ event->getEventName().str(), distance, nearness, gain, 20.0f * log10f(gain), AIL_ex_duck_cutoff(gain),
+ heldTo, halfway, halfwayGain, AIL_ex_duck_cutoff(halfwayGain), seconds, TheGameLogic->getFrame()));
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp
index 6133f5131..bd091a172 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp
@@ -1383,7 +1383,8 @@ S32 AILCALL AIL_quick_startup(S32 use_digital, S32, U32, S32, S32)
void AILCALL AIL_quick_handles(HDIGDRIVER *pdig, HMDIDRIVER *pmdi, HDLSDEVICE *pdls)
{
- if (pdig != NULL) *pdig = DIGITAL_DRIVER;
+ // a driver only when AIL_quick_startup opened a device, the null one of an offline mix included
+ if (pdig != NULL) *pdig = g_engine.deviceReady ? DIGITAL_DRIVER : NULL;
if (pmdi != NULL) *pmdi = NULL;
if (pdls != NULL) *pdls = NULL;
}
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/xaudio2/miles_xaudio2.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/xaudio2/miles_xaudio2.cpp
index 386726b61..91d2cde98 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/xaudio2/miles_xaudio2.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/xaudio2/miles_xaudio2.cpp
@@ -1228,7 +1228,8 @@ S32 AILCALL AIL_quick_startup(S32 use_digital, S32, U32, S32, S32)
void AILCALL AIL_quick_handles(HDIGDRIVER *pdig, HMDIDRIVER *pmdi, HDLSDEVICE *pdls)
{
- if (pdig != NULL) *pdig = DIGITAL_DRIVER;
+ // a driver only when AIL_quick_startup opened a device
+ if (pdig != NULL) *pdig = g_engine.master != NULL ? DIGITAL_DRIVER : NULL;
if (pmdi != NULL) *pmdi = NULL;
if (pdls != NULL) *pdls = NULL;
}