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.

feat(audio): headphones, surround, device picker and map ambience

Olcay Seygan5e0bcedcdc47
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 24cc6a829..cf4dda563 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -28,7 +28,7 @@ found and fixed, EA's own, not port damage.**
## Music that follows the fight
- In a skirmish or an online match the music now answers the battle. While nothing happens one of your side's calmer tracks plays; once guns open up near the camera or on your own forces it crossfades to a harder one, and to the hardest when the fight is big. Six Crusaders against six Scorpions and four Technicals: the first shots brought in a tense track, the battle track followed four seconds later, and twelve seconds after the shooting died down a calm one was back. Two Rangers against three Rebels only gets the middle one.
-- The tracks are the game's own: each side's ten or eleven skirmish pieces were measured for loudness and pace and sorted three calm, three or four tense and four for battle. One track plays at a time, a change is a three-second crossfade, and a track keeps the floor for at least twenty seconds, so a skirmish that flares and dies does not make the music lurch.
+- The tracks are the game's own: each side's ten or eleven skirmish pieces were measured for loudness and pace and sorted three calm, three or four tense and four for battle. One track plays at a time, a change is a two-second crossfade that keeps the loudness even through the middle, and a track keeps the floor for at least twenty seconds, so a skirmish that flares and dies does not make the music lurch.
- Music Follows the Fight is on by default and sits under Music Volume on the Audio page. Off, the music plays as the original game had it.
- A Master Volume slider heads the Audio page and turns the whole game down at once: music, effects, voices, ambience and movies. At half it put the music exactly 6.0 decibels lower. Unit replies keep their lift over the battle and are turned down with everything else, and at full volume the loudest moment of a tank fight still stops at the limiter's ceiling.
@@ -41,6 +41,18 @@ found and fixed, EA's own, not port damage.**
- 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.
- On Windows the echo was nearly lost. Windows played it through its own built-in reverb, which answered a shell 12 decibels quieter than intended on open ground, 20 in a city and 31 in snow, with its top end gone. A sound card set to 96 kHz got no echo at all. Windows now plays the very echo macOS, Linux and the recorded videos do, sample for sample.
+- A hill or a big building between you and a fight muffles it. Guns firing behind a cliff lose their crack altogether, their middle comes through ten decibels down and their thump four and a half, and the same guns heard across open ground sound as they always did. It eases in over a quarter of a second as the camera moves. Unit replies and the interface are never muffled.
+- A big battle no longer fills every channel with gunfire. At most 16 battle sounds play at once, and when a seventeenth arrives the quietest, furthest one gives way, or the new one is dropped if it matters less than all of them. The same shot fired by several tanks side by side in the same moment is one louder sound instead of a stack. On a 290 unit crowd fight the busiest second went from 25 voices to 17, with the same peak level. Replies, EVA, the interface and looping sounds are never cut for it.
+- Sounds that travel before they are heard now obey the same limits as the ones that start at once. A rocket's launch heard a second late used to ignore the cap on how many copies of it may play, and a sound limited to one at a time could refuse itself and go silent. Both are EA's, both are fixed.
+- Zoom out and the fight takes a step back. Unit and weapon sounds drop to 60 percent while the camera is high, and the wind, birds and city hum around them do not, so the whole map still sounds like a place.
+- Every map has a bed of ambience now: snow, town, desert or field, chosen from the terrain the map is made of and played from the game's own ambient loops. It sits under the battle and swells as you zoom out.
+- The music crossfade is real. The old fade counted drawn frames, so it ran at the speed of your graphics card; it now runs on game time, two seconds, with no dip in the middle.
+- A mod's music tracks can say whether they are calm, tense or battle music, and for which side, so Music Follows the Fight works with a mod's own soundtrack.
+- Headphones mode, under Options, Audio, Output. Each ear gets its own delay, level and muffling from where a sound is, so a gun to your left is on your left and one behind you is dull. The same page offers 5.1 and 7.1 surround on Windows, and a list of output devices.
+- Mute in Background is an option now and works on Linux and macOS too. Turn it off and the game keeps playing when you click another window.
+- Unplug your headset mid-match, switch Windows to another output or start with no sound device at all, and the game picks up the new device or waits for one, instead of going silent or dying. This may also be the cause of the crashes inside xaudio2_9.dll in our crash reports.
+- A Turkiye rank perk that detects stealth now behaves like a detector: the radar pings the spot, the discovery sound plays and EVA says so.
+- Clicking through your army no longer stacks a dozen replies on top of each other. A unit that just answered stays quiet for a second and a half, a new reply waits until the last has had four tenths of a second, and no more than two talk at once.
- macOS and Linux hear the same, and so does the sound the game records for a video, in step with the picture frame for frame. A mod can retune any of it, or switch a part off, from its audio settings.
## Ukrainian and Russian
@@ -48,9 +60,6 @@ found and fixed, EA's own, not port damage.**
- The language box under Options, Gameplay goes on past Deutsch to Українська and Русский, each written in its own alphabet, so a player finds their language without reading a word of English first. All 4684 lines the game shows are translated in both, menus, tooltips, briefings and the fork's own options included. The launcher's game language box offers the two as well.
- The command bar's one-key shortcuts used to go dead the moment a Russian or Ukrainian keyboard layout was on: the key marked C typed с, and no button answers to с. The game now reads a key from a non-Latin layout by where it sits on the keyboard, so C is C whichever layout Windows has active, in every language.
- The check that refuses a broken Turkish or German line reads both new files on every build. A tooltip whose blanks would not match the English one is turned away before it can crash the game.
-- A hill or a big building between you and a fight muffles it. Guns firing behind a cliff lose their crack altogether, their middle comes through ten decibels down and their thump four and a half, and the same guns heard across open ground sound as they always did. It eases in over a quarter of a second as the camera moves. Unit replies and the interface are never muffled.
-- A big battle no longer fills every channel with gunfire. At most 16 battle sounds play at once, and when a seventeenth arrives the quietest, furthest one gives way, or the new one is dropped if it matters less than all of them. The same shot fired by several tanks side by side in the same moment is one louder sound instead of a stack. On a 290 unit crowd fight the busiest second went from 25 voices to 17, with the same peak level. Replies, EVA, the interface and looping sounds are never cut for it.
-- Clicking through your army no longer stacks a dozen replies on top of each other. A unit that just answered stays quiet for a second and a half, a new reply waits until the last has had four tenths of a second, and no more than two talk at once.
## Trees cast the shadow of their own crowns
@@ -152,13 +161,13 @@ found and fixed, EA's own, not port damage.**
## Every campaign mission is open
- Picking USA, GLA or China now opens a list of that campaign's missions, every one of them open. Pick a mission, then the difficulty, and it starts with its briefing and movie as it always did; win it and the campaign carries on to the next one. Every campaign mission starts at the same rank however you reach it, so starting at the fourth is the same game as playing through to it.
+- The original Generals campaigns from 2003 are back beside Zero Hour's, seven missions a side, each with its spoken briefing and the voices its script cues during the fight. Zero Hour has always read the base game's archives for art and maps, but its own data dropped the 1355 lines of mission speech and the 29 movies the old campaigns call for, and its own campaigns took their names. The movies play when your Generals install has them. Finishing one earns that side's campaign medal, as Zero Hour's does.
- The "Mission Start" saves the campaign makes after each victory load again, from the original game and from every earlier version of Reforged. They hold only the campaign, the mission and the difficulty, none of which the 60-step battle changed. A game saved in the middle of a mission on an earlier version still does not load, and the message that refuses it now says which saves do.
- A mission with moving water (China's third, GLA's first, America's sixth) loads from a save with its water still running and at the height the mission had raised it to. A load used to freeze the water until the next wave came through and drop it back to the level the map started at, and saving while a script was raising it tore the game down.
- Load the same save twice and the same battle plays out both times. The dice, the paths units were waiting for and the computer players' calls to each other are saved now, so two loads no longer drift apart within a minute. A load also stopped switching a powered player's radar off, stopped forgetting which targets a mission's computer player was told to go after, and no longer counts every unit's sight twice for the first seconds. Saves from earlier versions still load; a save from this version does not load in an earlier one.
## Health bars you can read at a glance
-- The original Generals campaigns from 2003 are back beside Zero Hour's, seven missions a side, each with its spoken briefing and the voices its script cues during the fight. Zero Hour has always read the base game's archives for art and maps, but its own data dropped the 1355 lines of mission speech and the 29 movies the old campaigns call for, and its own campaigns took their names. The movies play when your Generals install has them. Finishing one earns that side's campaign medal, as Zero Hour's does.
- The bars over units are a third thinner, so a big fight no longer looks like a sheet of red and green stripes over the units underneath.
- Health a unit has lost now shows as a dark stretch at the end of its bar. It used to be bare ground, so a red bar over red ground, or any team colour over the wrong terrain, looked full when it was half gone.
@@ -306,8 +315,8 @@ found and fixed, EA's own, not port damage.**
- Export and Import on the Hotkeys page take your keys to a file and back, for another PC or a fresh install. Before an import the page tells you how many keys it changes and how many would clash; a file with a line it cannot read changes nothing and quotes that line. Keys for a mod you have not installed come along and wait for it.
- The arrow keys scroll the camera in the German game, as they do in English. German Zero Hour put next and previous unit and worker on the bare arrows, so the arrows picked units and only Ctrl and an arrow moved the camera; those four now sit on Ctrl and an arrow, as the English game ships them. Any language that puts a command on a bare arrow gets the same, and an arrow you gave a command yourself on the Hotkeys page stays where you put it.
- Grid keys are gone. The switch that made a button's key its place on the bar, Q for the first button of every building, is off the Hotkeys page, and the game no longer moves buttons around to give them a place's letter. Each button wears the letter you gave it or the game's own, and the fixed keys above still hold. A hotkeys file saved with grid keys on loads as before, with the switch ignored, so a player who had them on finds the letters of their own buttons back on the bar.
-
- W no longer starts a War Factory. The launcher had moved China's War Factory onto W, which Zero Hour already gives to Select all aircraft. With a tank selected and no aircraft on the map, W dropped the tank, the idle worker's bar took its place, and the same press let go on that bar's War Factory. The launcher now keeps the buttons it moves off every letter a keyboard command holds on its own, W, Q and the idle worker's I among them, and China's War Factory sits on D. Start the launcher once and it rewrites its part of the file. A letter you picked yourself stays where you put it.
+
## The command bar moves to the middle
- ControlBar Pro is the command bar, in every match and for every side, and nothing has to be installed for it. The radar sits in the bottom left corner, the command buttons with your money and power in the middle of the bottom edge, and your selection, rank and general's buttons in the bottom right. Each piece is drawn at your screen's height and keeps the shape it was painted in, so nothing stretches on a 4:3 monitor or a 32:9 one, and the battlefield shows between the three. At 1920x1080 they stand where ControlBar Pro's own layout puts them, to the pixel. Its rank screen, power buttons, chat, quit and disconnect screens come with it. A mod's faction plays on its American bar, with the mod's own buttons and pictures in it, whether the mod brings a bar of its own or not. Thanks to xezon and FAS, whose bar this is.
@@ -1159,10 +1168,10 @@ A third pass went through the generals' powers, promotions and unit abilities.
- The steel between the build buttons, the portrait's grid and the promotion screen's cells is half as wide as it was, so the pictures take the room. The queue's tray has a thinner rim. The portrait and its upgrade icons sit under the portrait's grid, framed the same way as every other picture on the bar.
- Point at Camo Netting's icon beside a GLA unit's portrait and its card used to say MISSING where the description belongs. EA left a second Camo Netting button in the data that no building offers, its text name mistyped, and the card read that one first. It reads the button you buy it from now.
- The arrow between a figure and its upgraded value on a card came out as three stray characters. It is an arrow again.
+- Every figure on a build card says in brackets what it counts. Damage is one shot of the main weapon before the target's armour, attack speed has the reload counted in, damage a second is the two multiplied, a range of 10 is one square of the placement grid, and the build time is what your power and factories give you right now. The upgrade list says which side of the arrow is without the upgrade and which is with it, and an armour upgrade such as Composite Armor says that less of each hit gets through instead of a bare "stronger". English and Turkish.
- The command bar slides up from the bottom of the screen again when a match starts. The new steel frame had been drawn at its final place from the first frame, so the buttons rose into a frame that was already standing.
- A building that is still going up shows Cancel on S, and the seconds it has left across the top of the grid. A map building that hands out units shows that countdown there too, with the bar under it. Sell stands on N. One that sets a rally point puts that on B instead. Both used to stay where the old command panel had drawn them, off the new grid.
- The Escape menu is Zero Hour's own again, the window, the logo, the buttons and the way it opens, along with the box that asks whether you really want to leave. The steel plate that replaced it for a while, and ControlBar Pro's version after that, are gone. Options on it opens the whole options screen. The promotion screen opens across the middle of the screen.
-- Every figure on a build card says in brackets what it counts. Damage is one shot of the main weapon before the target's armour, attack speed has the reload counted in, damage a second is the two multiplied, a range of 10 is one square of the placement grid, and the build time is what your power and factories give you right now. The upgrade list says which side of the arrow is without the upgrade and which is with it, and an armour upgrade such as Composite Armor says that less of each hit gets through instead of a bare "stronger". English and Turkish.
- Watching, click a player's button on the observer bar and you see through his eyes: his fog and his camera. The same button again, the cancel button or Esc gives you the whole map and the camera you had before.
## Placing buildings
@@ -1237,11 +1246,11 @@ A third pass went through the generals' powers, promotions and unit abilities.
- Nor does a booby trap. It cannot be shot and has one hit point, so its bar was a full green line that never moved, hanging over something that is meant to be hidden.
- A soldier killed by toxin or fire no longer melts or runs burning under a full health bar. The game swaps the dead man for a stand-in that plays the death for three seconds, and with bars on for everyone that stand-in wore one, full to the end. Anything you cannot click, which the townsfolk walking about a map also are, goes without a bar now, as it did in the original.
- The planes a general's power calls in wear their health bars again. A-10s, B-52s, B-3s, the MiG napalm strike, the carrier's Raptors, the carpet bomber and every side's cargo plane with its paratroopers or supply crates cannot be clicked either, and the change above took their bars along with the dead soldiers'. Your anti-air is shooting at them, and now you can see it working.
+- A plane that only delivers, the Supply Drop Zone's cargo plane or a paradrop, no longer trails a row of empty passenger boxes. It is a hundred-seat transport nobody can order to unload, and with some game data it drew all hundred boxes in a line across the screen beside its health bar. A transport you cannot select shows no boxes now; your Chinook and your Battle Bus keep theirs.
- The Spy Drone shows its health to its owner. It never had a bar: it is marked as something nothing can interact with, so enemies leave it alone, and the rule that keeps poison clouds bare took the drone's bar along with theirs. EA's own note on the drone's other marking says you can point at it to see its health, and now you can.
- Bridges no longer float a health bar over the middle of the river. There was never anything under it: the span is part of the terrain, and the bar belonged to an invisible marker standing in the water.
- The bar is part of the unit now: click it and you select whoever it belongs to. Zoomed out, an infantryman is a few pixels of helmet under a bar that is far easier to hit, and a unit half behind a building still has its bar in the clear. It only answers clicks that would have missed everything anyway, so it never takes a click away from the unit you were actually pointing at, and right-clicking bare ground under a bar still orders a move. And it stands down the moment you have something selected: with a force in hand your clicks are aimed at the ground, and a bar hanging over that ground used to cost you the whole selection and hand you back a single passer-by.
- The city itself stops wearing them too. A building nobody owns shows a bar only if there is something to do about it - troops can go inside, or it can be taken. A row of houses does not, and neither does the concrete apron each of them stands on, which is a separate two-thousand-point object that was drawing a second bar down at street level.
-- A plane that only delivers, the Supply Drop Zone's cargo plane or a paradrop, no longer trails a row of empty passenger boxes. It is a hundred-seat transport nobody can order to unload, and with some game data it drew all hundred boxes in a line across the screen beside its health bar. A transport you cannot select shows no boxes now; your Chinook and your Battle Bus keep theirs.
## Twenty-two-year-old bugs, found by testing
diff --git a/GeneralsMD/Code/Data/Patch.str b/GeneralsMD/Code/Data/Patch.str
index 805e86e77..c74f56d50 100644
--- a/GeneralsMD/Code/Data/Patch.str
+++ b/GeneralsMD/Code/Data/Patch.str
@@ -637,6 +637,54 @@ TOOLTIP:DynamicMusic
"In a skirmish or online match the music answers the battle: one of your side's calmer tracks while nothing happens, a harder one once guns fire near the camera or at your forces, and back to calm a few seconds after the fight ends. Off leaves the music as the original game played it."
END
+GUI:OptionsGroupOutput
+"Output"
+END
+
+GUI:AudioDevice
+"Output Device"
+END
+
+TOOLTIP:AudioDevice
+"The speakers or headphones the game plays through. Default follows Windows and moves with it when you plug in a headset. Applied when you Accept."
+END
+
+GUI:AudioDeviceDefault
+"Default"
+END
+
+GUI:SpeakerType
+"Speaker Setup"
+END
+
+TOOLTIP:SpeakerType
+"How the battlefield's sounds are placed around you. Headphones give each ear its own timing and tone, so a sound behind or beside you is heard there. 5.1 and 7.1 spread them over surround speakers; on Linux and macOS they play as stereo. Applied when you Accept."
+END
+
+GUI:SpeakerType0
+"Stereo Speakers"
+END
+
+GUI:SpeakerType1
+"Headphones"
+END
+
+GUI:SpeakerType2
+"5.1 Surround"
+END
+
+GUI:SpeakerType3
+"7.1 Surround"
+END
+
+GUI:MuteInBackground
+"Mute in Background"
+END
+
+TOOLTIP:MuteInBackground
+"Silences the game while another window has the focus. Off keeps it playing behind a browser or on a second monitor."
+END
+
GUI:IsometricCamera
"Isometric Camera"
END
diff --git a/GeneralsMD/Code/Data/Turkish/Generals.str b/GeneralsMD/Code/Data/Turkish/Generals.str
index 58970af72..cc2195e6e 100644
--- a/GeneralsMD/Code/Data/Turkish/Generals.str
+++ b/GeneralsMD/Code/Data/Turkish/Generals.str
@@ -1109,10 +1109,6 @@ TOOLTIP:ProviderType
"Ses Sağlayıcınızı seçin"
END
-TOOLTIP:SpeakerType
-"Hoparlör Yapılandırmanızı seçin"
-END
-
TOOLTIP:Resolution
"Oyununuz için bir ekran çözünürlüğü seçin. Çözünürlük yükseldikçe oyun yavaşlayabilir"
END
@@ -15125,6 +15121,54 @@ TOOLTIP:DynamicMusic
"Çatışma ya da çevrim içi maçta müzik savaşa göre değişir: ortalık sakinken tarafının sakin parçalarından biri, kameranın yakınında ya da birliklerine ateş açılınca daha sert bir parça çalar, çarpışma bittikten birkaç saniye sonra sakin müziğe döner. Kapalıyken müzik özgün oyundaki gibi çalar."
END
+GUI:OptionsGroupOutput
+"Çıkış"
+END
+
+GUI:AudioDevice
+"Çıkış Aygıtı"
+END
+
+TOOLTIP:AudioDevice
+"Oyunun sesinin çıktığı hoparlör ya da kulaklık. Varsayılan Windows'u izler, kulaklık takınca onunla birlikte geçer. Kabul Et'e bastığınızda uygulanır."
+END
+
+GUI:AudioDeviceDefault
+"Varsayılan"
+END
+
+GUI:SpeakerType
+"Hoparlör Düzeni"
+END
+
+TOOLTIP:SpeakerType
+"Savaş alanındaki seslerin çevrenize nasıl yerleştiği. Kulaklıkta her kulak kendi zamanlamasını ve tınısını alır, böylece arkanızdaki ya da yanınızdaki bir ses oradan duyulur. 5.1 ve 7.1 sesleri çevresel hoparlörlere dağıtır; Linux ve macOS'ta stereo çalar. Kabul Et'e bastığınızda uygulanır."
+END
+
+GUI:SpeakerType0
+"Stereo Hoparlör"
+END
+
+GUI:SpeakerType1
+"Kulaklık"
+END
+
+GUI:SpeakerType2
+"5.1 Çevresel"
+END
+
+GUI:SpeakerType3
+"7.1 Çevresel"
+END
+
+GUI:MuteInBackground
+"Arka Planda Sessiz"
+END
+
+TOOLTIP:MuteInBackground
+"Başka bir pencere öndeyken oyunu susturur. Kapalıyken oyun bir tarayıcının arkasında ya da ikinci monitörde de duyulur."
+END
+
GUI:IsometricCamera
"İzometrik Kamera"
END
diff --git a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
index 10fa936e5..8af92c1b1 100644
--- a/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
+++ b/GeneralsMD/Code/Data/Window/Menus/OptionsMenuClassic.wnd
@@ -8665,6 +8665,674 @@ WINDOW
IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
END
+ CHILD
+ WINDOW
+ WINDOWTYPE = STATICTEXT;
+ SCREENRECT = UPPERLEFT: 530 150, BOTTOMRIGHT: 754 174, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:GroupHeadingAudio2";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Generals", SIZE: 15, BOLD: 0;
+ HEADERTEMPLATE = "MainButton";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:OptionsGroupOutput";
+ TEXTCOLOR = ENABLED: 186 255 12 255, ENABLEDBORDER: 0 2 0 255, DISABLED: 186 255 12 255, DISABLEDBORDER: 0 2 0 255, HILITE: 186 255 12 255, HILITEBORDER: 0 2 0 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ STATICTEXTDATA = CENTERED: 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = STATICTEXT;
+ SCREENRECT = UPPERLEFT: 530 182, BOTTOMRIGHT: 754 206, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:LabelAudioDevice";
+ TOOLTIPTEXT = "TOOLTIP:AudioDevice";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:AudioDevice";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ STATICTEXTDATA = CENTERED: 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = COMBOBOX;
+ SCREENRECT = UPPERLEFT: 536 206, BOTTOMRIGHT: 760 230, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:ComboBoxAudioDevice";
+ TOOLTIPTEXT = "TOOLTIP:AudioDevice";
+ STATUS = ENABLED+IMAGE;
+ STYLE = MOUSETRACK+COMBOBOX;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
+ HEADERTEMPLATE = "ComboBoxEntry";
+ TOOLTIPDELAY = -1;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ListBoxHiliteSelectedItemLeftEnd, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ListBoxHiliteSelectedItemRightEnd, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXDATA = ISEDITABLE: 0,
+ MAXCHARS: 16,
+ MAXDISPLAY: 5,
+ ASCIIONLY: 0,
+ LETTERSANDNUMBERS: 0;
+ COMBOBOXDROPDOWNBUTTONENABLEDDRAWDATA = IMAGE: VSliderDownButtonEnabled, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXDROPDOWNBUTTONDISABLEDDRAWDATA = IMAGE: VSliderDownButtonDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXDROPDOWNBUTTONHILITEDRAWDATA = IMAGE: VSliderDownButtonHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXEDITBOXENABLEDDRAWDATA = IMAGE: TextEntryEnabledLeftEnd, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: TextEntryEnabledRightEnd, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: TextEntryEnabledRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: TextEntryEnabledSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXEDITBOXDISABLEDDRAWDATA = IMAGE: TextEntryDisabledLeftEnd, COLOR: 128 128 128 255, BORDERCOLOR: 0 0 0 255,
+ IMAGE: TextEntryDisabledRightEnd, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: TextEntryDisabledRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: TextEntryDisabledSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXEDITBOXHILITEDRAWDATA = IMAGE: TextEntryHiliteLeftEnd, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: TextEntryHiliteRightEnd, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: TextEntryHiliteRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: TextEntryHiliteSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXLISTBOXENABLEDDRAWDATA = IMAGE: BlackSquare, COLOR: 0 0 0 255, BORDERCOLOR: 49 55 168 255,
+ IMAGE: ListBoxHiliteItemLeftEnd, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: ListBoxHiliteItemRightEnd, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteItemRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteItemSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXLISTBOXDISABLEDDRAWDATA = IMAGE: BlackSquare, COLOR: 0 0 0 255, BORDERCOLOR: 49 55 168 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXLISTBOXHILITEDRAWDATA = IMAGE: BlackSquare, COLOR: 0 0 0 255, BORDERCOLOR: 49 55 168 255,
+ IMAGE: ListBoxHiliteSelectedItemLeftEnd, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ListBoxHiliteSelectedItemRightEnd, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXENABLEDUPBUTTONDRAWDATA = IMAGE: VSliderUpButtonEnabled, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: VSliderUpButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXDISABLEDUPBUTTONDRAWDATA = IMAGE: VSliderUpButtonDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXHILITEUPBUTTONDRAWDATA = IMAGE: VSliderUpButtonHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: VSliderUpButtonHiliteSelected, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXENABLEDDOWNBUTTONDRAWDATA = IMAGE: VSliderDownButtonEnabled, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXDISABLEDDOWNBUTTONDRAWDATA = IMAGE: VSliderDownButtonDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXHILITEDOWNBUTTONDRAWDATA = IMAGE: VSliderDownButtonHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXENABLEDSLIDERDRAWDATA = IMAGE: NoImage, COLOR: 168 255 12 0, BORDERCOLOR: 47 55 168 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXDISABLEDSLIDERDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 0, BORDERCOLOR: 148 112 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXHILITESLIDERDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 0, BORDERCOLOR: 49 55 168 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ SLIDERTHUMBENABLEDDRAWDATA = IMAGE: ScrollBarThumbEnabled, COLOR: 255 4 0 0, BORDERCOLOR: 255 243 28 255,
+ IMAGE: ScrollBarThumbHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ SLIDERTHUMBDISABLEDDRAWDATA = IMAGE: ScrollBarThumbDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ SLIDERTHUMBHILITEDRAWDATA = IMAGE: ScrollBarThumbHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ScrollBarThumbHiliteSelected, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = STATICTEXT;
+ SCREENRECT = UPPERLEFT: 530 238, BOTTOMRIGHT: 754 262, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:LabelSpeakerType";
+ TOOLTIPTEXT = "TOOLTIP:SpeakerType";
+ STATUS = ENABLED;
+ STYLE = STATICTEXT+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:SpeakerType";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 0 0 0 0, BORDERCOLOR: 0 0 0 0,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 64 64 64 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 128 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 255, BORDERCOLOR: 255 255 255 255;
+ STATICTEXTDATA = CENTERED: 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = COMBOBOX;
+ SCREENRECT = UPPERLEFT: 536 262, BOTTOMRIGHT: 760 286, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:ComboBoxSpeakerType";
+ TOOLTIPTEXT = "TOOLTIP:SpeakerType";
+ STATUS = ENABLED+IMAGE;
+ STYLE = MOUSETRACK+COMBOBOX;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 10, BOLD: 0;
+ HEADERTEMPLATE = "ComboBoxEntry";
+ TOOLTIPDELAY = -1;
+ TEXTCOLOR = ENABLED: 254 254 254 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 128 128 255 255, HILITEBORDER: 0 0 128 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: NoImage, COLOR: 47 55 168 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ListBoxHiliteSelectedItemLeftEnd, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ListBoxHiliteSelectedItemRightEnd, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXDATA = ISEDITABLE: 0,
+ MAXCHARS: 16,
+ MAXDISPLAY: 5,
+ ASCIIONLY: 0,
+ LETTERSANDNUMBERS: 0;
+ COMBOBOXDROPDOWNBUTTONENABLEDDRAWDATA = IMAGE: VSliderDownButtonEnabled, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXDROPDOWNBUTTONDISABLEDDRAWDATA = IMAGE: VSliderDownButtonDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 128 128 128 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXDROPDOWNBUTTONHILITEDRAWDATA = IMAGE: VSliderDownButtonHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXEDITBOXENABLEDDRAWDATA = IMAGE: TextEntryEnabledLeftEnd, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: TextEntryEnabledRightEnd, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: TextEntryEnabledRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: TextEntryEnabledSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXEDITBOXDISABLEDDRAWDATA = IMAGE: TextEntryDisabledLeftEnd, COLOR: 128 128 128 255, BORDERCOLOR: 0 0 0 255,
+ IMAGE: TextEntryDisabledRightEnd, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: TextEntryDisabledRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: TextEntryDisabledSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXEDITBOXHILITEDRAWDATA = IMAGE: TextEntryHiliteLeftEnd, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: TextEntryHiliteRightEnd, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: TextEntryHiliteRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: TextEntryHiliteSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXLISTBOXENABLEDDRAWDATA = IMAGE: BlackSquare, COLOR: 0 0 0 255, BORDERCOLOR: 49 55 168 255,
+ IMAGE: ListBoxHiliteItemLeftEnd, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: ListBoxHiliteItemRightEnd, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteItemRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteItemSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXLISTBOXDISABLEDDRAWDATA = IMAGE: BlackSquare, COLOR: 0 0 0 255, BORDERCOLOR: 49 55 168 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ COMBOBOXLISTBOXHILITEDRAWDATA = IMAGE: BlackSquare, COLOR: 0 0 0 255, BORDERCOLOR: 49 55 168 255,
+ IMAGE: ListBoxHiliteSelectedItemLeftEnd, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ListBoxHiliteSelectedItemRightEnd, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: ListBoxHiliteSelectedItemSmallRepeatingCenter, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXENABLEDUPBUTTONDRAWDATA = IMAGE: VSliderUpButtonEnabled, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: VSliderUpButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXDISABLEDUPBUTTONDRAWDATA = IMAGE: VSliderUpButtonDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXHILITEUPBUTTONDRAWDATA = IMAGE: VSliderUpButtonHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: VSliderUpButtonHiliteSelected, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXENABLEDDOWNBUTTONDRAWDATA = IMAGE: VSliderDownButtonEnabled, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXDISABLEDDOWNBUTTONDRAWDATA = IMAGE: VSliderDownButtonDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXHILITEDOWNBUTTONDRAWDATA = IMAGE: VSliderDownButtonHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: VSliderDownButtonHiliteSelected, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXENABLEDSLIDERDRAWDATA = IMAGE: NoImage, COLOR: 168 255 12 0, BORDERCOLOR: 47 55 168 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXDISABLEDSLIDERDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 0, BORDERCOLOR: 148 112 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ LISTBOXHILITESLIDERDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 0, BORDERCOLOR: 49 55 168 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ SLIDERTHUMBENABLEDDRAWDATA = IMAGE: ScrollBarThumbEnabled, COLOR: 255 4 0 0, BORDERCOLOR: 255 243 28 255,
+ IMAGE: ScrollBarThumbHiliteSelected, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ SLIDERTHUMBDISABLEDDRAWDATA = IMAGE: ScrollBarThumbDisabled, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: NoImage, COLOR: 192 192 192 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ SLIDERTHUMBHILITEDRAWDATA = IMAGE: ScrollBarThumbHilite, COLOR: 0 255 0 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: ScrollBarThumbHiliteSelected, COLOR: 254 254 254 255, BORDERCOLOR: 0 128 0 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ END
+ CHILD
+ WINDOW
+ WINDOWTYPE = CHECKBOX;
+ SCREENRECT = UPPERLEFT: 536 294, BOTTOMRIGHT: 760 318, CREATIONRESOLUTION: 800 600;
+ NAME = "OptionsMenu.wnd:CheckMuteInBackground";
+ STATUS = ENABLED+IMAGE+BORDER;
+ STYLE = CHECKBOX+MOUSETRACK;
+ SYSTEMCALLBACK = "[None]";
+ INPUTCALLBACK = "[None]";
+ TOOLTIPCALLBACK = "[None]";
+ DRAWCALLBACK = "[None]";
+ FONT = NAME: "Arial", SIZE: 14, BOLD: 0;
+ HEADERTEMPLATE = "MinorTitle";
+ TOOLTIPTEXT = "TOOLTIP:MuteInBackground";
+ TOOLTIPDELAY = -1;
+ TEXT = "GUI:MuteInBackground";
+ TEXTCOLOR = ENABLED: 255 255 255 255, ENABLEDBORDER: 0 0 0 255,
+ DISABLED: 192 192 192 255, DISABLEDBORDER: 64 64 64 255,
+ HILITE: 186 255 12 255, HILITEBORDER: 0 0 0 255;
+ ENABLEDDRAWDATA = IMAGE: NoImage, COLOR: 255 0 0 255, BORDERCOLOR: 255 128 128 255,
+ IMAGE: Active-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 0 0 255 255, BORDERCOLOR: 128 128 255 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ DISABLEDDRAWDATA = IMAGE: NoImage, COLOR: 128 128 128 255, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Unchecked, COLOR: 255 255 255 0, BORDERCOLOR: 192 192 192 255,
+ IMAGE: Disabled-Checked, COLOR: 64 64 64 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ HILITEDRAWDATA = IMAGE: NoImage, COLOR: 0 255 0 255, BORDERCOLOR: 128 255 128 255,
+ IMAGE: Active-HiLighted, COLOR: 255 255 255 0, BORDERCOLOR: 128 128 255 255,
+ IMAGE: Active-Checked, COLOR: 255 255 0 255, BORDERCOLOR: 254 254 254 255,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0,
+ IMAGE: NoImage, COLOR: 255 255 255 0, BORDERCOLOR: 255 255 255 0;
+ END
ENDALLCHILDREN
END
CHILD
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h
index 1b8b5c7cc..3e062b561 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioEventInfo.h
@@ -120,7 +120,14 @@ public:
Real m_maxDistance; // greater than this distance and the sound behaves as though it is muted
AudioType m_soundType; // This should be either Music, Streaming or SoundEffect
-
+
+ /// Music Follows the Fight (MusicManager) for a mod's own music: a MusicTrack with
+ /// `MusicMood = Calm`, `Tense` or `Battle` and `MusicSide = <playlist>` joins that playlist at that
+ /// mood, over the retail table where it names a retail track. The playlist is whichever side's
+ /// tracks the skirmish scripts play; an untagged track (0, `None`) is left to the table or to them.
+ Int m_musicMood;
+ AsciiString m_musicSide;
+
// DynamicAudioEventInfo interfacing functions
virtual Bool isLevelSpecific() const { return false; } ///< If true, this sound is only defined on the current level and can be deleted when that level ends
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h b/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h
index 30b2d9cba..ef970e142 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/AudioSettings.h
@@ -65,7 +65,16 @@ struct AudioSettings
m_occlusionVolume( 0.6f ),
m_occlusionDepth( 20.0f ),
m_occlusionTime( 250.0f ),
- m_occlusionRays( 16 )
+ m_occlusionRays( 16 ),
+ m_zoomMixNearHeight( 300.0f ),
+ m_zoomMixFarHeight( 900.0f ),
+ m_zoomMixDetailVolume( 0.6f ),
+ m_ambienceBedNearVolume( 0.3f ),
+ m_ambienceBedFarVolume( 0.8f ),
+ m_ambienceBedSnow( "Amb_WinterNatureWindLoop" ),
+ m_ambienceBedTown( "Amb_UrbanCityAmbientLoop" ),
+ m_ambienceBedDesert( "Amb_DesertNatureWindThinLoop" ),
+ m_ambienceBedField( "Amb_TemperateMeadowAmbientLoop" )
{
m_duckSounds.push_back( "ExplosionNeutron" );
m_duckSounds.push_back( "ExplosionDaisyCutter" );
@@ -159,6 +168,30 @@ struct AudioSettings
Real m_occlusionTime;
Int m_occlusionRays;
+ /** The mix as the camera zooms out, none of which the shipped file carries.
+ *
+ * Between `ZoomMixNearHeight` and `ZoomMixFarHeight`, the camera's height over the ground it looks
+ * at, the 3D sounds that are not ambience (weapons, engines, explosions, voices on the field) fall
+ * to `ZoomMixDetailVolume` of their level, while ambience keeps its own; zoomed back in, the
+ * detail returns. 100% leaves the mix as it was. EA's own zoom bonus (`ZoomSoundVolume...`)
+ * still applies on top, to both.
+ *
+ * The map's ambience bed (MilesAudioManager::updateAmbienceBed): one looping 2D sound chosen
+ * from the map when it starts, `AmbienceBedSnow` on a snow map, `AmbienceBedTown` on a built-up
+ * one, `AmbienceBedDesert` or `AmbienceBedField` by the ground it is painted with. It plays at
+ * `AmbienceBedNearVolume` of its own Volume with the camera at the near height and rises to
+ * `AmbienceBedFarVolume` at the far one, under the Ambience slider. `NoSound`, or any name the loaded
+ * audio data lacks, plays no bed on that kind of map. */
+ Real m_zoomMixNearHeight;
+ Real m_zoomMixFarHeight;
+ Real m_zoomMixDetailVolume;
+ Real m_ambienceBedNearVolume;
+ Real m_ambienceBedFarVolume;
+ AsciiString m_ambienceBedSnow;
+ AsciiString m_ambienceBedTown;
+ AsciiString m_ambienceBedDesert;
+ AsciiString m_ambienceBedField;
+
Int m_drawableAmbientFrames;
Int m_fadeAudioFrames;
UnsignedInt m_maxCacheSize;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
index e06a8b2a9..234ea0e74 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameAudio.h
@@ -314,6 +314,8 @@ class AudioManager : public SubsystemInterface
virtual const AudioEventInfoHash & getAllAudioEvents() const { return m_allAudioEventInfo; }
Real getZoomVolume() const { return m_zoomVolume; }
+ /// how far out the camera is between ZoomMixNearHeight (0) and ZoomMixFarHeight (1)
+ Real getZoomOut() const { return m_zoomOut; }
// Birds, wind, water, a town's murmur: a looping world sound effect at the lowest priority that
// is not hidden by the shroud. These answer to the Ambient slider instead of the effects one.
@@ -386,6 +388,8 @@ class AudioManager : public SubsystemInterface
Real m_systemAmbientVolume;
Real m_systemMasterVolume; ///< the Master slider, folded into the four products by recomputeVolumes
Real m_zoomVolume;
+ Real m_zoomOut; ///< see getZoomOut
+ Real m_zoomDetailVolume; ///< ZoomMixDetailVolume as far as the camera is out, on every 3D sound but ambience
AudioEventRTS *m_silentAudioEvent;
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
index 08c13cea0..bb61fd7d1 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameEngine.h
@@ -121,6 +121,8 @@ struct RateReading
};
// forward declarations
+class AsciiString;
+class UnicodeString;
class AudioManager;
class GameLogic;
class GameClient;
@@ -168,6 +170,11 @@ public:
virtual Bool isActive(void) {return m_isActive;} ///< returns whether app has OS focus.
virtual void setIsActive(Bool isActive) { m_isActive = isActive; };
+ /// The device's audio endpoints, for the options menu: the index-th one's id and name, FALSE past
+ /// the last. An id is what setAudioOutputDevice takes and Options.ini keeps; "" is the default.
+ virtual Bool getAudioOutputDevice(Int index, AsciiString &id, UnicodeString &name) { return FALSE; }
+ virtual void setAudioOutputDevice(const AsciiString &id) {}
+
/** LOGIC-THREAD.md phase 3, step 3b. Called by GameClient::update in front of the draw at
* -logicthread 1 and 2: in a single-player game it runs this pass's message stream and asks the
* pacer here, and answers whether this pass's first tick is due and may run beside the render. */
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h b/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
index 2962e42b9..46f2d5f00 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GameMusic.h
@@ -53,6 +53,7 @@
#include "Common/GameMemory.h"
#include <map>
+#include <vector>
//----------------------------------------------------------------------------
@@ -110,7 +111,8 @@ public:
* or by half when it is the local player's own unit wherever it stands. Those add to an intensity
* that halves about every three and a half seconds, so it reads roughly as weighted shots a second.
* Above a threshold the music moves from calm to tense to battle, each a crossfade to a track of
- * the side's own playlist chosen by a hand table (TheDynamicTracks), and comes back down once the
+ * the side's own playlist chosen by a hand table (TheDynamicTracks) or, for a mod's music, by the
+ * MusicMood and MusicSide its Music.ini gives each track, and comes back down once the
* fight has been over for a few seconds and the track has had its minimum time. While tense or
* battle music plays, the skirmish scripts' own track changes are held; back at calm, they choose
* when the music changes again and a calm track of the side plays whichever they named. Nothing
@@ -137,13 +139,25 @@ class MusicManager
enum Mood { MOOD_CALM, MOOD_TENSE, MOOD_BATTLE, MOOD_COUNT };
private:
+ /// a track of a side's playlist at a mood: the hand table's, or a MusicTrack's MusicMood tag
+ struct MoodTrack
+ {
+ AsciiString name;
+ AsciiString side;
+ Int mood;
+ };
+
Bool engaged( void ) const;
void startMatch( void );
void releaseHeldStop( void );
+ void buildTracks( void );
+ const MoodTrack *findTrack( const AsciiString& name );
AsciiString pickTrack( Mood mood );
void changeTrack( Mood mood );
void buildCombatSounds( void );
+ std::vector<MoodTrack> m_tracks; ///< built at the first track of a match, so a map's music is in it
+
std::map<const AudioEventInfo *, Real> m_combatWeight; ///< weapon fire, damage and fear sounds, built once
Real m_intensity;
UnsignedInt m_lastFrame;
@@ -154,7 +168,7 @@ class MusicManager
Bool m_issuing; ///< our own stop and play are going through
Bool m_stopHeld;
AudioHandle m_heldStop; ///< a script's stop, kept until the play after it says whose track it was
- AsciiString m_side; ///< "USA", "CHI" or "GLA": whose playlist
+ AsciiString m_side; ///< "USA", "CHI", "GLA" or a mod's MusicSide: whose playlist
AsciiString m_track; ///< the track we last started
AudioEventRTS *m_fadeEvent; ///< the device's own copy of the track fading in, NULL when none
AudioHandle m_fadeHandle; ///< its handle: the copy is only touched while the device still has it
diff --git a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
index d8432a2b9..663a74105 100644
--- a/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
+++ b/GeneralsMD/Code/GameEngine/Include/Common/GlobalData.h
@@ -699,6 +699,7 @@ public:
Int m_ambientVolume; ///< "AmbientVolume" in Options.ini: percent for looping world ambience, in place of the effects slider
Int m_masterVolume; ///< "MasterVolume" in Options.ini: percent every other slider is multiplied by, music and speech included
Bool m_dynamicMusic; ///< "DynamicMusic" in Options.ini: a skirmish's music follows the fight (MusicManager::update)
+ Bool m_muteInBackground; ///< "MuteInBackground" in Options.ini: silent while another window has the focus (WinMain's WM_ACTIVATE)
Bool m_3DSoundPref; ///< Whether user wants to use 3DSound or not
Bool m_animateWindows; ///< Should we animate window transitions?
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
index 4363c7db6..ecc7ab221 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameAudio.cpp
@@ -152,6 +152,15 @@ static const FieldParse audioSettingsFieldParseTable[] =
{ "OcclusionDepth", INI::parseReal, NULL, offsetof( AudioSettings, m_occlusionDepth) },
{ "OcclusionTime", INI::parseReal, NULL, offsetof( AudioSettings, m_occlusionTime) },
{ "OcclusionRaysPerFrame", INI::parseInt, NULL, offsetof( AudioSettings, m_occlusionRays) },
+ { "ZoomMixNearHeight", INI::parseReal, NULL, offsetof( AudioSettings, m_zoomMixNearHeight) },
+ { "ZoomMixFarHeight", INI::parseReal, NULL, offsetof( AudioSettings, m_zoomMixFarHeight) },
+ { "ZoomMixDetailVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_zoomMixDetailVolume) },
+ { "AmbienceBedNearVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_ambienceBedNearVolume) },
+ { "AmbienceBedFarVolume", INI::parsePercentToReal, NULL, offsetof( AudioSettings, m_ambienceBedFarVolume) },
+ { "AmbienceBedSnow", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_ambienceBedSnow) },
+ { "AmbienceBedTown", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_ambienceBedTown) },
+ { "AmbienceBedDesert", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_ambienceBedDesert) },
+ { "AmbienceBedField", INI::parseAsciiString, NULL, offsetof( AudioSettings, m_ambienceBedField) },
{ "GlobalMinRange", INI::parseInt, NULL, offsetof( AudioSettings, m_globalMinRange) },
{ "GlobalMaxRange", INI::parseInt, NULL, offsetof( AudioSettings, m_globalMaxRange) },
{ "TimeBetweenDrawableSounds", INI::parseDurationUnsignedInt, NULL, offsetof( AudioSettings, m_drawableAmbientFrames) },
@@ -203,6 +212,8 @@ AudioManager::AudioManager() :
m_systemAmbientVolume = 0.0f;
m_systemMasterVolume = 1.0f;
m_zoomVolume = 1.0f;
+ m_zoomOut = 0.0f;
+ m_zoomDetailVolume = 1.0f;
m_volumeHasChanged = FALSE;
//
@@ -432,6 +443,15 @@ void AudioManager::update()
}
}
+ // Zoomed out over a battle, every gun at full detail is a wall of noise; the detail steps back and
+ // the ambience, which keeps its level, comes forward (ZoomMix* in AudioSettings.h).
+ const AudioSettings *settings = TheAudio->getAudioSettings();
+ const Real span = settings->m_zoomMixFarHeight - settings->m_zoomMixNearHeight;
+ const Real height = cameraPos.z - groundPos.z;
+ m_zoomOut = span > 0.0f ? (height - settings->m_zoomMixNearHeight) / span : (height > settings->m_zoomMixNearHeight ? 1.0f : 0.0f);
+ m_zoomOut = MIN( 1.0f, MAX( 0.0f, m_zoomOut ) );
+ m_zoomDetailVolume = 1.0f - (1.0f - settings->m_zoomMixDetailVolume) * m_zoomOut;
+
set3DVolumeAdjustment( m_zoomVolume );
m_music->update();
@@ -915,7 +935,7 @@ void AudioManager::recomputeVolumes( void )
{
m_musicVolume = m_scriptMusicVolume * m_systemMusicVolume * m_systemMasterVolume;
m_soundVolume = m_scriptSoundVolume * m_systemSoundVolume * m_systemMasterVolume;
- m_sound3DVolume = MIN( 1.0f, MAX( 0.0f, m_zoomVolume * m_scriptSound3DVolume * m_systemSound3DVolume * m_systemMasterVolume ) );
+ m_sound3DVolume = MIN( 1.0f, MAX( 0.0f, m_zoomVolume * m_zoomDetailVolume * m_scriptSound3DVolume * m_systemSound3DVolume * m_systemMasterVolume ) );
m_speechVolume = m_scriptSpeechVolume * m_systemSpeechVolume * m_systemMasterVolume;
// Flagged every frame, changed or not: MilesAudioManager::getEffectiveVolume folds the listener's
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
index 7ef9c16ea..9ae0f52c9 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/Audio/GameMusic.cpp
@@ -51,6 +51,7 @@
#include "Common/AudioEventRTS.h"
#include "Common/AudioHandleSpecialValues.h"
#include "Common/AudioRequest.h"
+#include "Common/AudioSettings.h"
#include "Common/GameAudio.h"
#include "Common/GlobalData.h"
#include "Common/INI.h"
@@ -106,8 +107,8 @@ const FieldParse MusicTrack::m_musicTrackFieldParseTable[] =
* rest of its own side's list: the three lowest calm, the four highest battle, the rest tense
* (experiments/proofs/2026-10-25/audio-music/classify.py in the wrapper). Game_Silent is the sixty
* seconds the scripts leave between two tracks; it has no side and is never picked, but while our
- * music plays it is held like the tracks are. A mod's own tracks are not here, so its music stays
- * the scripts'. */
+ * music plays it is held like the tracks are. A mod's own tracks are not here: its Music.ini tags
+ * them with MusicMood and MusicSide (buildTracks), and an untagged one stays the scripts'. */
struct DynamicTrack
{
const char *name;
@@ -174,14 +175,61 @@ static const Real FEAR_WEIGHT = 3.0f; ///< a unit hit into a worse state or
static const UnsignedInt UP_AFTER = 4 * LOGICFRAMES_PER_SECOND; ///< a crossfade's length: no change cuts one short
static const UnsignedInt DOWN_HOLD = 12 * LOGICFRAMES_PER_SECOND; ///< quieter this long before the music comes down: from battle, past tense to calm
static const UnsignedInt MIN_TRACK = 20 * LOGICFRAMES_PER_SECOND; ///< and never before a track has had this long
-static const UnsignedInt FADE_IN = 3 * LOGICFRAMES_PER_SECOND; ///< the new track's rise; the old one falls over TimeToFadeAudio
-static const Real FADE_FLOOR = 0.05f; ///< where it rises from, above MinSampleVolume's cull
+static const Real FADE_FLOOR = 0.05f; ///< where the new track rises from, above MinSampleVolume's cull
-static const DynamicTrack *findDynamicTrack( const AsciiString& name )
+//-------------------------------------------------------------------------------------------------
+/** The retail table, then every MusicTrack the loaded data tags with a MusicMood, in Music.ini's
+ * order: a tag on a retail track moves it, a tag on a new one adds it. Built at a match's first
+ * track, after any map.ini has added its own. */
+void MusicManager::buildTracks( void )
{
+ m_tracks.clear();
for (Int i = 0; i < ARRAY_SIZE( TheDynamicTracks ); ++i)
- if (name.compareNoCase( TheDynamicTracks[i].name ) == 0)
- return &TheDynamicTracks[i];
+ {
+ MoodTrack track;
+ track.name = TheDynamicTracks[i].name;
+ track.side = TheDynamicTracks[i].side;
+ track.mood = TheDynamicTracks[i].mood;
+ m_tracks.push_back( track );
+ }
+
+ Int tagged = 0;
+ const AsciiString first = TheAudio->nextTrackName( AsciiString::TheEmptyString );
+ AsciiString name = first;
+ while (name.isNotEmpty())
+ {
+ const AudioEventInfo *info = TheAudio->findAudioEventInfo( name );
+ if (info != NULL && info->m_musicMood > 0)
+ {
+ MoodTrack *track = NULL;
+ for (size_t i = 0; i < m_tracks.size() && track == NULL; ++i)
+ if (m_tracks[i].name.compareNoCase( name ) == 0)
+ track = &m_tracks[i];
+ if (track == NULL)
+ {
+ m_tracks.push_back( MoodTrack() );
+ track = &m_tracks.back();
+ track->name = name;
+ }
+ track->side = info->m_musicSide;
+ track->mood = info->m_musicMood - 1;
+ ++tagged;
+ }
+ name = TheAudio->nextTrackName( name );
+ if (name == first)
+ break;
+ }
+ DEBUG_LOG(("MUSIC: %d tracks by mood, %d of them tagged in Music.ini\n", (Int)m_tracks.size(), tagged));
+}
+
+//-------------------------------------------------------------------------------------------------
+const MusicManager::MoodTrack *MusicManager::findTrack( const AsciiString& name )
+{
+ if (m_tracks.empty())
+ buildTracks();
+ for (size_t i = 0; i < m_tracks.size(); ++i)
+ if (name.compareNoCase( m_tracks[i].name ) == 0)
+ return &m_tracks[i];
return NULL;
}
@@ -219,8 +267,8 @@ void MusicManager::stopTrack( AudioHandle eventToRemove )
//-------------------------------------------------------------------------------------------------
void MusicManager::addAudioEvent( AudioEventRTS *eventToAdd )
{
- const DynamicTrack *track = findDynamicTrack( eventToAdd->getEventName() );
- if (track != NULL && track->side[0] != '\0')
+ const MoodTrack *track = findTrack( eventToAdd->getEventName() );
+ if (track != NULL && track->side.isNotEmpty())
m_side = track->side;
if (m_inControl && !m_issuing && engaged())
@@ -239,10 +287,13 @@ void MusicManager::addAudioEvent( AudioEventRTS *eventToAdd )
m_side.clear();
// At calm the cycle's own next track is swapped for a calm one of its side, or a fight's music
- // would play over a quiet base. The scripts' sixty seconds of silence stay as they are.
- if (!m_issuing && !m_inControl && track != NULL && track->side[0] != '\0' && track->mood != MOOD_CALM && engaged())
+ // would play over a quiet base. The scripts' sixty seconds of silence stay as they are, and so
+ // does the track of a mod's side that tagged no calm one.
+ const AsciiString calm = !m_issuing && !m_inControl && track != NULL && track->side.isNotEmpty()
+ && track->mood != MOOD_CALM && engaged() ? pickTrack( MOOD_CALM ) : AsciiString::TheEmptyString;
+ if (calm.isNotEmpty())
{
- m_track = pickTrack( MOOD_CALM );
+ m_track = calm;
DEBUG_LOG(("MUSIC: frame %u the scripts' %s plays as %s\n", TheGameLogic->getFrame(),
eventToAdd->getEventName().str(), m_track.str()));
eventToAdd->setEventName( m_track );
@@ -382,25 +433,29 @@ void MusicManager::noteSound( const AudioEventRTS *event )
/** The side's tracks of this mood in turn, never the one we started last; empty for an unknown side. */
AsciiString MusicManager::pickTrack( Mood mood )
{
+ if (m_tracks.empty())
+ buildTracks();
AsciiString pick;
Int count = 0;
- for (Int i = 0; i < ARRAY_SIZE( TheDynamicTracks ); ++i)
- if (TheDynamicTracks[i].mood == mood && m_side == TheDynamicTracks[i].side)
+ for (size_t i = 0; i < m_tracks.size(); ++i)
+ if (m_tracks[i].mood == mood && m_side == m_tracks[i].side)
++count;
for (Int tries = 0; tries < count && (pick.isEmpty() || pick == m_track); ++tries)
{
const Int want = m_pick[mood]++ % count;
- for (Int i = 0, n = 0; i < ARRAY_SIZE( TheDynamicTracks ); ++i)
- if (TheDynamicTracks[i].mood == mood && m_side == TheDynamicTracks[i].side && n++ == want)
- pick = TheDynamicTracks[i].name;
+ Int n = 0;
+ for (size_t i = 0; i < m_tracks.size(); ++i)
+ if (m_tracks[i].mood == mood && m_side == m_tracks[i].side && n++ == want)
+ pick = m_tracks[i].name;
}
return pick;
}
//-------------------------------------------------------------------------------------------------
-/** Fades out whatever music plays, over TimeToFadeAudio, and brings a track of this mood up from
- * nearly nothing over FADE_IN. The fading track is marked as such, so the one-track rule in the
- * device leaves it alone until it has gone. */
+/** A crossfade: whatever music plays falls over TimeToFadeAudio, in logic time (the device's fading
+ * list), and a track of this mood rises over the same frames from the same frame, so the two overlap
+ * end to end. The fading track is marked as such, so the one-track rule in the device leaves it
+ * alone until it has gone. */
void MusicManager::changeTrack( Mood mood )
{
const UnsignedInt now = TheGameLogic->getFrame();
@@ -436,6 +491,8 @@ void MusicManager::update( void )
const UnsignedInt now = match ? TheGameLogic->getFrame() : 0;
if (!match || now < m_lastFrame)
{
+ // the next match builds the mood table again, with whatever music its map.ini brings
+ m_tracks.clear();
if (m_lastFrame != 0)
startMatch();
m_lastFrame = now;
@@ -451,11 +508,14 @@ void MusicManager::update( void )
// The rise is the device's own copy of the event, which the device frees when the stream ends, so
// it is written only while the device still answers for its handle. The device reads the volume
// back on its next pass, with the music slider on it, in the same update.
+ // The old track falls in a straight line, so the new one rises as sqrt(1 - (1 - t)^2): the two
+ // together keep the power of one track all through, where two straight lines dip 3 dB halfway.
if (m_fadeEvent != NULL)
{
- const Real t = MIN( 1.0f, (Real)(now - m_fadeStart) / FADE_IN );
+ const Real fadeFrames = (Real)MAX( 1, TheAudio->getAudioSettings()->m_fadeAudioFrames );
+ const Real t = MIN( 1.0f, (Real)(now - m_fadeStart) / fadeFrames );
if (TheAudio->isCurrentlyPlaying( m_fadeHandle ))
- m_fadeEvent->setVolume( FADE_FLOOR + (m_fadeTarget - FADE_FLOOR) * t );
+ m_fadeEvent->setVolume( MAX( FADE_FLOOR, m_fadeTarget * sqrtf( t * (2.0f - t) ) ) );
if (t >= 1.0f || !TheAudio->isCurrentlyPlaying( m_fadeHandle ))
m_fadeEvent = NULL;
}
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
index 3e14b2b42..e0d872d47 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/GlobalData.cpp
@@ -1452,6 +1452,7 @@ GlobalData::GlobalData()
m_ambientVolume = 40;
m_masterVolume = 100;
m_dynamicMusic = TRUE;
+ m_muteInBackground = TRUE; // retail's: loseFocus on every deactivation
m_3DSoundPref = false;
m_keyboardDefaultScrollFactor = m_keyboardScrollFactor = 0.5f;
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp
index 202d69f18..26ddc5fda 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/INI/INIAudioEventInfo.cpp
@@ -139,6 +139,9 @@ void INI::parseDialogDefinition( INI* ini )
static void parseDelay( INI* ini, void *instance, void *store, const void* /*userData*/ );
static void parsePitchShift( INI* ini, void *instance, void *store, const void* /*userData*/ );
+// MusicMood: one more than MusicManager::Mood, so a zeroed info is untagged
+static const char *TheMusicMoodNames[] = { "NONE", "CALM", "TENSE", "BATTLE", NULL };
+
//-------------------------------------------------------------------------------------------------
const FieldParse AudioEventInfo::m_audioEventInfo[] =
{
@@ -162,6 +165,8 @@ const FieldParse AudioEventInfo::m_audioEventInfo[] =
{ "MinRange", INI::parseReal, NULL, offsetof( AudioEventInfo, m_minDistance) },
{ "MaxRange", INI::parseReal, NULL, offsetof( AudioEventInfo, m_maxDistance) },
{ "LowPassCutoff", INI::parsePercentToReal, NULL, offsetof( AudioEventInfo, m_lowPassFreq) },
+ { "MusicMood", INI::parseIndexList, TheMusicMoodNames, offsetof( AudioEventInfo, m_musicMood) },
+ { "MusicSide", INI::parseAsciiString, NULL, offsetof( AudioEventInfo, m_musicSide) },
{ NULL, NULL, NULL, 0 }
};
diff --git a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
index ac56d8af5..756f3b819 100644
--- a/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/Common/OptionsCatalog.cpp
@@ -96,6 +96,7 @@ static void set_m_masterVolume( Int value )
TheAudio->setVolume( value / 100.0f, (AudioAffect)(AudioAffect_Master | AudioAffect_SystemSetting) );
}
OPTION_BOOL_ACCESSORS( m_dynamicMusic )
+OPTION_BOOL_ACCESSORS( m_muteInBackground )
// The catalog loads before there is a game; the menu's Accept during a mission changes its speed
// on the spot, which only the pacing reads.
static Int get_m_turboMode( void ) { return TheGlobalData->m_turboMode ? 1 : 0; }
@@ -349,6 +350,12 @@ const OptionDef TheOptionCatalog[] =
OPTION_BOOL, APPLY_LIVE, 0, 1,
get_m_dynamicMusic, set_m_dynamicMusic },
+ // Silent while another window has the focus, as retail always was; off keeps the game heard
+ // behind a browser or a second monitor's window. Read at the next focus change. On Options > Audio.
+ { "MuteInBackground", OPT_WND( "CheckMuteInBackground" ), "GUI:MuteInBackground",
+ OPTION_BOOL, APPLY_LIVE, 0, 1,
+ get_m_muteInBackground, set_m_muteInBackground },
+
// With the move, attack move or guard key armed, a left drag over the ground spreads the
// selection along the line drawn instead of sending everyone to one point. On by default, and
// here for anyone who would rather that drag did nothing at all. On Options > Controls.
diff --git a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
index 3b9140dfa..254c92654 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/OptionsMenu.cpp
@@ -1424,6 +1424,86 @@ static void saveVolumeOptions( OptionPreferences &out )
}
}
+//-------------------------------------------------------------------------------------------------
+/** The audio output: the endpoint and the speaker setup. Neither is a catalog row. The speaker
+ * setup is EA's SpeakerType string, which MilesAudioManager reads out of Options.ini itself and
+ * hands the backend; the menu offers four of EA's six (GameAudio.cpp's TheSpeakerTypes, numbered as
+ * MSS.h's AIL_3D_*), and a file holding Surround Sound or 4 Speaker shows the stereo entry until the
+ * player picks one. The endpoint is the backend's own id, "" for the default, and one that has gone
+ * shows Default while the saved id stays for when it comes back. */
+//-------------------------------------------------------------------------------------------------
+static const UnsignedInt TheMenuSpeakerTypes[] = { 0 /* 2 Speakers */, 1 /* Headphones */, 4 /* 5.1 Surround */, 5 /* 7.1 Surround */ };
+enum { MENU_SPEAKER_TYPE_COUNT = sizeof( TheMenuSpeakerTypes ) / sizeof( TheMenuSpeakerTypes[ 0 ] ) };
+enum { MAX_AUDIO_DEVICE_ENTRIES = 32 };
+static AsciiString menuAudioDevices[ MAX_AUDIO_DEVICE_ENTRIES ]; ///< entry 0 is "", the default
+static Int menuAudioDeviceCount = 0;
+static Int speakerTypeShown = 0; ///< the entries the menu opened on, so Accept writes only a change
+static Int audioDeviceShown = 0;
+
+static GameWindow *audioOutputWidget( const char *name )
+{
+ return TheWindowManager->winGetWindowFromId( NULL, NAMEKEY( name ) );
+}
+
+static void fillAudioOutputLists( void )
+{
+ GameWindow *speakers = audioOutputWidget( "OptionsMenu.wnd:ComboBoxSpeakerType" );
+ const UnsignedInt speakerType = TheAudio->translateSpeakerTypeToUnsignedInt( pref->getSpeakerType() );
+ GadgetComboBoxReset( speakers );
+ speakerTypeShown = 0;
+ for( Int entry = 0; entry < MENU_SPEAKER_TYPE_COUNT; ++entry )
+ {
+ AsciiString label;
+ label.format( "GUI:SpeakerType%d", entry );
+ GadgetComboBoxAddEntry( speakers, TheGameText->fetch( label ), MENU_ENTRY_COLOR );
+ if( TheMenuSpeakerTypes[ entry ] == speakerType )
+ speakerTypeShown = entry;
+ }
+ GadgetComboBoxSetSelectedPos( speakers, speakerTypeShown );
+
+ GameWindow *devices = audioOutputWidget( "OptionsMenu.wnd:ComboBoxAudioDevice" );
+ OptionPreferences::const_iterator saved = pref->find( "AudioDevice" );
+ const AsciiString savedDevice = saved != pref->end() ? saved->second : AsciiString();
+ GadgetComboBoxReset( devices );
+ GadgetComboBoxAddEntry( devices, TheGameText->fetch( "GUI:AudioDeviceDefault" ), MENU_ENTRY_COLOR );
+ menuAudioDevices[ 0 ].clear();
+ menuAudioDeviceCount = 1;
+ audioDeviceShown = 0;
+ UnicodeString name;
+ while( menuAudioDeviceCount < MAX_AUDIO_DEVICE_ENTRIES
+ && TheGameEngine->getAudioOutputDevice( menuAudioDeviceCount - 1, menuAudioDevices[ menuAudioDeviceCount ], name ) )
+ {
+ GadgetComboBoxAddEntry( devices, name, MENU_ENTRY_COLOR );
+ if( menuAudioDevices[ menuAudioDeviceCount ] == savedDevice )
+ audioDeviceShown = menuAudioDeviceCount;
+ ++menuAudioDeviceCount;
+ }
+ GadgetComboBoxSetSelectedPos( devices, audioDeviceShown );
+}
+
+static void saveAudioOutputOptions( OptionPreferences &out )
+{
+ Int index = -1;
+ GadgetComboBoxGetSelectedPos( audioOutputWidget( "OptionsMenu.wnd:ComboBoxSpeakerType" ), &index );
+ if( index >= 0 && index < MENU_SPEAKER_TYPE_COUNT && index != speakerTypeShown )
+ {
+ const AsciiString speakerType = TheAudio->translateUnsignedIntToSpeakerType( TheMenuSpeakerTypes[ index ] );
+ out[ "SpeakerType" ] = speakerType;
+ TheAudio->setPreferredSpeaker( speakerType );
+ TheAudio->setSpeakerType( TheMenuSpeakerTypes[ index ] );
+ speakerTypeShown = index;
+ }
+
+ index = -1;
+ GadgetComboBoxGetSelectedPos( audioOutputWidget( "OptionsMenu.wnd:ComboBoxAudioDevice" ), &index );
+ if( index >= 0 && index < menuAudioDeviceCount && index != audioDeviceShown )
+ {
+ out[ "AudioDevice" ] = menuAudioDevices[ index ];
+ TheGameEngine->setAudioOutputDevice( menuAudioDevices[ index ] );
+ audioDeviceShown = index;
+ }
+}
+
static void saveOptions( void )
{
Int index;
@@ -1457,11 +1537,9 @@ static void saveOptions( void )
// (*pref)["3DAudioProvider"] = TheAudio->getProviderName(TheAudio->getSelectedProvider());
//
//-------------------------------------------------------------------------------------------------
-// // speaker type
- // isChecked = GadgetCheckBoxIsChecked(checkAudioSurround);
- // TheAudio->setSpeakerSurround(isChecked);
- // (*pref)["SpeakerType"] = TheAudio->translateUnsignedIntToSpeakerType(TheAudio->getSpeakerType());
- //
+ // speaker setup and endpoint, in place of EA's surround check box
+ saveAudioOutputOptions( *pref );
+
//-------------------------------------------------------------------------------------------------
// language filter
if( GadgetCheckBoxIsChecked( checkLanguageFilter ) )
@@ -2658,6 +2736,7 @@ void OptionsMenuInit( WindowLayout *layout, void *userData )
// the monitor the game is on, and the size it is showing there
fillMonitorList();
fillResolutionList( selectedMonitor(), TheDisplay->getWidth(), TheDisplay->getHeight() );
+ fillAudioOutputLists();
// set the display detail
GadgetComboBoxReset(comboBoxDetail);
diff --git a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
index 4a9464ec6..b218ffabd 100644
--- a/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
+++ b/GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cpp
@@ -48,6 +48,7 @@
#include "Common/LatchRestore.h"
#include "Common/MapObject.h"
#include "Common/MatchHistory.h"
+#include "Common/MiscAudio.h"
#include "Common/MultiplayerSettings.h"
#include "Common/PerfTimer.h"
#include "Common/Player.h"
@@ -71,6 +72,7 @@
#include "GameClient/ControlBar.h"
#include "GameClient/Drawable.h"
+#include "GameClient/Eva.h"
#include "GameClient/GameClient.h"
#include "GameClient/GameText.h"
#include "GameClient/GUICallbacks.h"
@@ -4112,7 +4114,27 @@ static void updateRankAuras( Object *objList )
const Real distSqr = dx * dx + dy * dy;
if( detect > 0.0f && distSqr <= detect * detect && other->getStealth()
&& other->testStatus( OBJECT_STATUS_STEALTHED ) && leader->getRelationship( other ) == ENEMIES )
+ {
+ // a fresh find pings the leader's owner the way StealthDetectorUpdate does, after the tick
+ if( !other->testStatus( OBJECT_STATUS_DETECTED ) && ThePlayerList->getLocalPlayer() == leader->getControllingPlayer() )
+ {
+ const Coord3D found = *other->getPosition();
+ const Int playerIndex = leader->getControllingPlayer()->getPlayerIndex();
+ const EvaMessage message = other->getStealth()->getEnemyDetectionEvaEvent();
+ LogicThread::callAfterTick( [found, playerIndex, message]()
+ {
+ if( !TheRadar->tryEvent( RADAR_EVENT_STEALTH_DISCOVERED, &found ) )
+ return;
+ static AudioEventRTS discoveredSound = TheAudio->getMiscAudio()->m_stealthDiscoveredSound;
+ discoveredSound.setPlayerIndex( playerIndex );
+ TheAudio->addAudioEvent( &discoveredSound );
+ TheInGameUI->message( TheGameText->fetch( "MESSAGE:StealthDiscovered" ) );
+ if( message != EVA_Invalid && TheEva != NULL )
+ TheEva->setShouldPlay( message );
+ } );
+ }
other->getStealth()->markAsDetected( LOGICFRAMES_PER_SECOND + 1 );
+ }
if( !gives || distSqr > radius * radius || other->isKindOf( KINDOF_STRUCTURE )
|| leader->getRelationship( other ) != ALLIES )
continue;
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h b/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h
index 41d4f07ea..d40669577 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/MilesAudioDevice/MilesAudioManager.h
@@ -84,7 +84,9 @@ struct PlayingAudio
/// Asked to fade out. Moving from the playing list to the fading list writes two lists, so it
/// happens in processPlayingList holding both locks rather than wherever the fade is asked for.
Bool m_fade;
- Int m_framesFaded;
+ /// logic frames of the fade gone by, counted on the audio clock: a pass a frame made a fade at 120
+ /// fps a quarter of TimeToFadeAudio, and a music crossfade a drop followed by a slow rise
+ Real m_framesFaded;
/// Doppler's velocity for a 3D sound, units a second, and where the source was the last time the
/// logic clock had moved (MilesAudioManager::trackVelocity).
Bool m_tracked;
@@ -111,7 +113,7 @@ struct PlayingAudio
m_sample(0),
m_3DSample(0),
m_stream(0),
- m_framesFaded(0),
+ m_framesFaded(0.0f),
m_tracked(false),
m_stopHeld(false),
m_stopInMs(0.0f),
@@ -288,6 +290,7 @@ class MilesAudioManager : public AudioManager
void advanceAudioClock( void );
void trackVelocity( PlayingAudio *playing, const Coord3D *pos );
void setRoomFromMap( void );
+ void updateAmbienceBed( void );
void duckForBlast( AudioEventRTS *event, H3DSAMPLE sample3D );
Bool checkForSample( AudioRequest *req );
@@ -378,6 +381,13 @@ class MilesAudioManager : public AudioManager
Real m_clockElapsedMs;
UnsignedInt m_clockMovedAt; ///< Clock_Milliseconds when the logic clock last moved on
AsciiString m_roomMap; ///< the map setRoomFromMap last set the room for
+ Bool m_askingOnArrival; ///< checkForSample is asking canPlayNow about a sound that waited out its distance
+
+ /// The map's ambience bed (AmbienceBed* in AudioSettings.h): the event setRoomFromMap chose, the
+ /// handle of the one playing, and the logic frame it was last started at.
+ AsciiString m_bedEvent;
+ AudioHandle m_bedHandle;
+ UnsignedInt m_bedStartedAt;
// LOGIC-THREAD.md M7: what the tick asks, as captureForLogic found it at the sync point
std::vector<AudioHandle> m_playingAtSync; ///< every handle isCurrentlyPlaying said yes to, sorted
diff --git a/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h b/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h
index 0212ff06e..4427bfa2c 100644
--- a/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h
+++ b/GeneralsMD/Code/GameEngineDevice/Include/Win32Device/Common/Win32GameEngine.h
@@ -73,6 +73,8 @@ public:
virtual void reset( void ); ///< reset engine
virtual void update( void ); ///< update the game engine
virtual void serviceWindowsOS( void ); ///< allow windows maintenance in background
+ virtual Bool getAudioOutputDevice( Int index, AsciiString &id, UnicodeString &name ); ///< MMDevice render endpoints
+ virtual void setAudioOutputDevice( const AsciiString &id );
protected:
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
index af371c735..db7f432c4 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/MilesAudioDevice/MilesAudioManager.cpp
@@ -63,6 +63,7 @@
#include "Common/MapObject.h"
#include "Common/ThingTemplate.h"
#include "Common/ScopedMutex.h"
+#include "Common/TerrainTypes.h"
#include <algorithm>
@@ -70,6 +71,7 @@
#include "GameClient/Drawable.h"
#include "GameClient/GameClient.h"
#include "GameClient/ObserverCamera.h"
+#include "GameClient/TerrainVisual.h"
#include "GameClient/VideoPlayer.h"
#include "GameClient/View.h"
@@ -143,6 +145,9 @@ MilesAudioManager::MilesAudioManager() :
m_clockFrame(0),
m_clockElapsedMs(MSEC_PER_LOGICFRAME_REAL),
m_clockMovedAt(0),
+ m_askingOnArrival(false),
+ m_bedHandle(AHSV_Error),
+ m_bedStartedAt(0),
m_lastReplyAtMs(0),
m_mixLoggedAt(0),
m_occlusionCursor(0),
@@ -535,6 +540,10 @@ void MilesAudioManager::reset()
m_replyAtMs.clear();
m_blockers.clear();
m_blockersBuiltAt = 0;
+ // the bed went with everything else; the next map, the same one again included, chooses anew
+ m_roomMap.clear();
+ m_bedEvent.clear();
+ m_bedHandle = AHSV_Error;
// This must come after stopAllAudioImmediately() and removeAllAudioRequests(), to ensure that
// sounds pointing to the temporary AudioEventInfo handles are deleted before their info is deleted
removeLevelSpecificAudioEventInfos();
@@ -622,6 +631,7 @@ void MilesAudioManager::update()
{
buildBlockers();
}
+ updateAmbienceBed();
setDeviceListenerPosition();
processRequestList();
processPlayingList();
@@ -2278,8 +2288,10 @@ UnsignedInt MilesAudioManager::getNumStreams( void ) const
* where they start (playAudioEvent), since a unit's second line skips this question altogether. */
Bool MilesAudioManager::doesViolateLimit( AudioEventRTS *event ) const
{
+ // Folding is decided once, when the shot is asked for. On arrival the shot it would fold into
+ // is a later one from the same gun, still on its way, and two shots a beat apart became one.
const Bool mixed = !event->getIsLogicalAudio();
- if (mixed && coalesceShot(event)) {
+ if (mixed && !m_askingOnArrival && coalesceShot(event)) {
return true;
}
if (doesViolateEventLimit(event)) {
@@ -2288,7 +2300,7 @@ Bool MilesAudioManager::doesViolateLimit( AudioEventRTS *event ) const
if (mixed && refuseOverBudget(event)) {
return true;
}
- if (mixed) {
+ if (mixed && !m_askingOnArrival) {
noteShot(event);
}
return false;
@@ -2565,14 +2577,16 @@ Bool MilesAudioManager::doesViolateEventLimit( AudioEventRTS *event ) const
}
}
- // Also check the request list in case we've requested to play this sound.
+ // Also check the request list in case we've requested to play this sound. A sound asked again as
+ // it lands (checkForSample) is on that list itself and is not one more of its kind: counted, it
+ // refused itself at a Limit of 1.
std::list<AudioRequest*>::const_iterator arIt;
for (arIt = m_audioRequests.begin(); arIt != m_audioRequests.end(); ++arIt) {
AudioRequest *req = (*arIt);
if (req == NULL) {
continue;
}
- if( req->m_usePendingEvent )
+ if( req->m_usePendingEvent && req->m_pendingEvent != event )
{
if( req->m_pendingEvent->getEventName() == event->getEventName() )
{
@@ -3173,7 +3187,10 @@ void MilesAudioManager::processFadingList( void )
continue;
}
- ++playing->m_framesFaded;
+ // TimeToFadeAudio is logic frames; a pass is a render frame. In a match the audio clock says how
+ // far the logic went (none while paused, so a crossfade holds with MusicManager's rise), and
+ // out of one a pass counts as a frame, as it always did.
+ playing->m_framesFaded += m_clockElapsedMs / MSEC_PER_LOGICFRAME_REAL;
Real volume = getEffectiveVolume(playing->m_audioEventRTS);
volume *= (1.0f - 1.0f * playing->m_framesFaded / getAudioSettings()->m_fadeAudioFrames);
@@ -3487,6 +3504,117 @@ void MilesAudioManager::setRoomFromMap( void )
DEBUG_LOG(("AUDIO: room for %s: %.2f%% built over, town %.2f%s, send %.2f, decay %.2f s, damping %.2f, "
"echo %d ms at %.2f, air %.0f\n", m_roomMap.str(), cover * 100.0f, town, snowy ? " in snow" : "",
wet * m_audioSettings->m_reverbLevel, decay, damping, (Int)(echo * 1000.0f), slap, absorption));
+
+ // The bed, from the same reading and the ground the map is painted with, sampled on a grid: snow
+ // (the weather, or snow on most of the ground that is not plain dirt and rock), a town (half way to
+ // the room's town or more, or streets and houses painted on a quarter of it), else desert or field,
+ // whichever of the two covers more. The shell map behind the menus keeps quiet.
+ const Int GRID = 24;
+ Int desert = 0, field = 0, snow = 0, urban = 0, counted = 0;
+ for (Int i = 0; i < GRID; ++i)
+ {
+ for (Int j = 0; j < GRID; ++j)
+ {
+ TerrainType *tile = TheTerrainVisual->getTerrainTile(extent.lo.x + extent.width() * (i + 0.5f) / GRID,
+ extent.lo.y + extent.height() * (j + 0.5f) / GRID);
+ if (tile == NULL)
+ continue;
+ ++counted;
+ switch (tile->getClass())
+ {
+ case TERRAIN_DESERT_1: case TERRAIN_DESERT_2: case TERRAIN_DESERT_3: case TERRAIN_LIVE_DESERT:
+ case TERRAIN_DRY_DESERT: case TERRAIN_SAND: case TERRAIN_ACCENT_SAND: case TERRAIN_TROPICAL_BEACH:
+ ++desert;
+ break;
+ case TERRAIN_EASTERN_EUROPE_1: case TERRAIN_EASTERN_EUROPE_2: case TERRAIN_EASTERN_EUROPE_3:
+ case TERRAIN_SWISS_1: case TERRAIN_SWISS_2: case TERRAIN_SWISS_3: case TERRAIN_GRASS: case TERRAIN_FIELD:
+ case TERRAIN_COBBLESTONE_GRASS: case TERRAIN_ACCENT_GRASS: case TERRAIN_BEACH_PARK: case TERRAIN_WOOD:
+ ++field;
+ break;
+ case TERRAIN_SNOW_1: case TERRAIN_SNOW_2: case TERRAIN_SNOW_3: case TERRAIN_RUGGED_SNOW: case TERRAIN_FLAT_SNOW:
+ ++snow;
+ break;
+ case TERRAIN_RESIDENTIAL: case TERRAIN_ASPHALT: case TERRAIN_CONCRETE: case TERRAIN_CHINA: case TERRAIN_URBAN:
+ ++urban;
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ const AudioSettings *settings = m_audioSettings;
+ const char *kind;
+ if (TheGameLogic->isInShellGame())
+ {
+ kind = "none, the shell map";
+ m_bedEvent.clear();
+ }
+ else if (snowy || 2 * snow > desert + field + snow + urban)
+ {
+ kind = "snow";
+ m_bedEvent = settings->m_ambienceBedSnow;
+ }
+ else if (town >= 0.5f || 4 * urban >= counted)
+ {
+ kind = "town";
+ m_bedEvent = settings->m_ambienceBedTown;
+ }
+ else if (desert >= field)
+ {
+ kind = "desert";
+ m_bedEvent = settings->m_ambienceBedDesert;
+ }
+ else
+ {
+ kind = "field";
+ m_bedEvent = settings->m_ambienceBedField;
+ }
+ if (m_bedEvent.isNotEmpty() && findAudioEventInfo(m_bedEvent) == NULL)
+ m_bedEvent.clear();
+ m_bedHandle = AHSV_Error;
+ m_bedStartedAt = 0;
+ DEBUG_LOG(("AUDIO: ambience bed for %s: %s (%d desert, %d field, %d snow, %d town of %d samples), %s\n",
+ m_roomMap.str(), kind, desert, field, snow, urban, counted, m_bedEvent.isEmpty() ? "none" : m_bedEvent.str()));
+}
+
+//-------------------------------------------------------------------------------------------------
+/** The map's bed, a looping 2D sound under everything else: started once the match runs, started
+ * again (a second on) whenever it is not playing, since as the lowest of priorities it gives up its
+ * voice to anything that needs one, and set every pass to the level the camera's height asks for,
+ * AmbienceBedNearVolume of its own Volume zoomed in up to AmbienceBedFarVolume zoomed out. It
+ * answers to the Ambience slider (AudioManager::isAmbientSound) and pauses with the rest. */
+void MilesAudioManager::updateAmbienceBed( void )
+{
+ if (m_bedEvent.isEmpty() || !TheGameLogic->isInGame() || TheGameLogic->isLoadingMap())
+ return;
+
+ const AudioSettings *settings = m_audioSettings;
+ const Real level = settings->m_ambienceBedNearVolume
+ + (settings->m_ambienceBedFarVolume - settings->m_ambienceBedNearVolume) * getZoomOut();
+
+ const UnsignedInt frame = TheGameLogic->getFrame();
+ if (!isCurrentlyPlaying(m_bedHandle))
+ {
+ if (m_bedStartedAt != 0 && frame >= m_bedStartedAt && frame < m_bedStartedAt + LOGICFRAMES_PER_SECOND)
+ return;
+ AudioEventRTS bed(m_bedEvent);
+ getInfoForAudioEvent(&bed);
+ bed.setVolume(bed.getAudioEventInfo()->m_volume * level);
+ m_bedHandle = addAudioEvent(&bed);
+ m_bedStartedAt = frame > 0 ? frame : 1;
+ return;
+ }
+
+ std::list<PlayingAudio *>::iterator it;
+ for (it = m_playingSounds.begin(); it != m_playingSounds.end(); ++it)
+ {
+ PlayingAudio *playing = *it;
+ if (playing && playing->isPlaying() && playing->m_audioEventRTS->getPlayingHandle() == m_bedHandle)
+ {
+ playing->m_audioEventRTS->setVolume(playing->m_audioEventRTS->getAudioEventInfo()->m_volume * level);
+ break;
+ }
+ }
}
//-------------------------------------------------------------------------------------------------
@@ -3541,19 +3669,23 @@ Bool MilesAudioManager::checkForSample( AudioRequest *req )
getInfoForAudioEvent( req->m_pendingEvent );
}
- // A battle shot that waited out its distance meets the voice budget as it lands: when it was asked
- // for, the voices it would join were still to come. EA's test below compares the ST_ bits with an
- // AudioType, so most delayed sounds skip canPlayNow here and never reached the budget at all.
- if (refuseOverBudget(req->m_pendingEvent)) {
- return false;
- }
-
- if (req->m_pendingEvent->getAudioEventInfo()->m_type != AT_SoundEffect)
+ // A sound that waited out its distance is asked again as it lands, as EA meant it to be: its range
+ // from where the microphone is now, the fog, its Limit, the channels and the battle budget, since
+ // when it was asked for the voices it would join were still to come. EA compared the info's ST_
+ // bits with AT_SoundEffect here, so only a sound typed plain "world" (ST_WORLD has the same value)
+ // was ever asked. A loop's next pass is the same sound going on, not a new one, and is let through:
+ // refused here it would be gone for good, with nothing to start it again. So is a sound a script
+ // asked for, which the script may be waiting on and which passed every test when it was asked.
+ if (req->m_nextLoop || req->m_pendingEvent->getIsLogicalAudio()
+ || req->m_pendingEvent->getAudioEventInfo()->m_soundType != AT_SoundEffect)
{
return true;
}
- return m_sound->canPlayNow(req->m_pendingEvent);
+ m_askingOnArrival = true;
+ const Bool canPlay = m_sound->canPlayNow(req->m_pendingEvent);
+ m_askingOnArrival = false;
+ return canPlay;
}
//-------------------------------------------------------------------------------------------------
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/SdlDevice/Common/SdlGameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/SdlDevice/Common/SdlGameEngine.cpp
index 7297dd33d..69cb183e7 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/SdlDevice/Common/SdlGameEngine.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/SdlDevice/Common/SdlGameEngine.cpp
@@ -348,10 +348,16 @@ void SdlGameEngine::serviceWindowsOS( void )
break;
case SDL_EVENT_WINDOW_FOCUS_GAINED:
+ if (TheAudio)
+ TheAudio->regainFocus();
setIsActive( TRUE );
break;
case SDL_EVENT_WINDOW_FOCUS_LOST:
+ // WinMain's WM_ACTIVATE rule: silent behind another window unless MuteInBackground is
+ // off, and never in a -wav run. Once a loss, since loseFocus keeps one set of volumes.
+ if (TheAudio && isActive() && TheGlobalData->m_wavEndFrame <= 0 && TheGlobalData->m_muteInBackground)
+ TheAudio->loseFocus();
setIsActive( FALSE );
break;
diff --git a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp
index 8d0fcf03e..acd06ba85 100644
--- a/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp
+++ b/GeneralsMD/Code/GameEngineDevice/Source/Win32Device/Common/Win32GameEngine.cpp
@@ -31,7 +31,7 @@
///////////////////////////////////////////////////////////////////////////////////////////////////
#include <windows.h>
-#include "Win32Device/Common/Win32GameEngine.h"
+#include "Win32Device/Common/Win32GameEngine.h" // MSS/MSS.h through MilesAudioManager.h
#include "Common/PerfTimer.h"
#include "GameNetwork/LANAPICallbacks.h"
@@ -176,3 +176,26 @@ void Win32GameEngine::serviceWindowsOS( void )
} // end ServiceWindowsOS
+//-------------------------------------------------------------------------------------------------
+/** The audio backend's endpoints (miles_xaudio2.cpp), and the one it plays on */
+//-------------------------------------------------------------------------------------------------
+static const Int AUDIO_DEVICE_ID_BYTES = 256;
+static const Int AUDIO_DEVICE_NAME_CHARS = 128;
+
+Bool Win32GameEngine::getAudioOutputDevice( Int index, AsciiString &id, UnicodeString &name )
+{
+ char deviceId[AUDIO_DEVICE_ID_BYTES];
+ U16 deviceName[AUDIO_DEVICE_NAME_CHARS];
+ if (!AIL_ex_enumerate_output_devices(index, deviceId, AUDIO_DEVICE_ID_BYTES, deviceName, AUDIO_DEVICE_NAME_CHARS)) {
+ return FALSE;
+ }
+ id = deviceId;
+ name = UnicodeString((const WideChar *)deviceName);
+ return TRUE;
+}
+
+void Win32GameEngine::setAudioOutputDevice( const AsciiString &id )
+{
+ AIL_ex_set_output_device(id.str());
+}
+
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h
index ef7c5ca67..bf35977bf 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/MSS.h
@@ -102,7 +102,11 @@ typedef void *AILLPDIRECTSOUND;
typedef void *AILLPDIRECTSOUNDBUFFER;
/* 3D speaker types (AIL_set_3D_speaker_type). 0-3 are verbatim Miles 6.0;
- * 4-5 are the 6.5 additions continuing the sequence. */
+ * 4-5 are the 6.5 additions continuing the sequence. What each one does here: 2 speakers and
+ * Surround (Dolby's matrix, which nothing decodes any more) are the stereo pan; Headphones is the
+ * stereo pan's place taken by AIL_ex_hrtf on every 3D sample, in both backends; 4, 5.1 and 7.1 are a
+ * mastering voice of that many channels with every 3D sample panned round them (XAudio2 only:
+ * miniaudio plays them as stereo). A change rebuilds XAudio2's output, as a lost device does. */
#define AIL_3D_2_SPEAKER 0
#define AIL_3D_HEADPHONE 1
#define AIL_3D_SURROUND 2
@@ -316,6 +320,25 @@ void AILCALL AIL_ex_set_reverb(F32 wet, F32 decay, F32 damping, F32 echo, F
void AILCALL AIL_ex_duck(H3DSAMPLE trigger, F32 gain, F32 seconds);
void AILCALL AIL_ex_set_3D_sample_dry(H3DSAMPLE handle, S32 dry);
+/* ---- output device ------------------------------------------------------ */
+/* Not Miles. AIL_ex_set_output_device: the endpoint to play on, an MMDevice id as IMMDevice::GetId
+ * gives it, NULL or "" for the system's default. May come before AIL_startup, which is how WinMain
+ * hands down the one Options.ini saved; later, XAudio2 rebuilds its output on it at once. An id no
+ * endpoint answers to any more plays on the default. miniaudio always plays on the default.
+ *
+ * AIL_ex_enumerate_output_devices: the active render endpoints, `index` from 0 until it answers 0,
+ * each one's id (ASCII, what AIL_ex_set_output_device takes) and its name as UTF-16, both cut to
+ * fit and terminated. miniaudio lists none.
+ *
+ * XAudio2 keeps playing through a lost device: a critical error, the default endpoint changing
+ * under a game on the default, or an endpoint arriving while there is none, and the engine, its
+ * mastering voice, the room and every voice are made again. What was playing ends (its EOS
+ * callback comes as if it had played out), the streams carry on from their decoders. With no
+ * endpoint at all AIL_quick_startup still succeeds: a sample started then plays in silence for
+ * its own length and ends, a stream likewise, until an endpoint comes. */
+void AILCALL AIL_ex_set_output_device(const char *id);
+S32 AILCALL AIL_ex_enumerate_output_devices(S32 index, char *id, S32 id_bytes, U16 *name, S32 name_chars);
+
/* ---- file format helpers ---------------------------------------------- */
S32 AILCALL AIL_WAV_info(const void *data, AILSOUNDINFO *info);
S32 AILCALL AIL_decompress_ADPCM(const AILSOUNDINFO *info, void **outdata, U32 *outsize);
@@ -418,6 +441,126 @@ static inline F32 AIL_ex_duck_cutoff(F32 duck)
return AIL_EX_OPEN_CUTOFF * duck * duck;
}
+/* Where (dx, dy, dz) lies round the listener, in the plane of its face and right (up x face) axes,
+ which is the plane the camera turns in: side -1 full left to 1 full right, front 1 ahead to -1
+ behind, side^2 + front^2 = 1. A sound straight above or below the listener is ahead. Headphones
+ and the surround pan read it; the stereo pan keeps its own projection, which counts height too. */
+static inline void AIL_ex_3D_bearing(F32 dx, F32 dy, F32 dz, F32 faceX, F32 faceY, F32 faceZ,
+ F32 upX, F32 upY, F32 upZ, F32 *side, F32 *front)
+{
+ const F32 rightX = upY * faceZ - upZ * faceY;
+ const F32 rightY = upZ * faceX - upX * faceZ;
+ const F32 rightZ = upX * faceY - upY * faceX;
+ const F32 rightLength = sqrtf(rightX * rightX + rightY * rightY + rightZ * rightZ);
+ const F32 faceLength = sqrtf(faceX * faceX + faceY * faceY + faceZ * faceZ);
+ F32 across, along, length;
+ *side = 0.0f;
+ *front = 1.0f;
+ if (rightLength < 0.0001f || faceLength < 0.0001f)
+ return;
+ across = (dx * rightX + dy * rightY + dz * rightZ) / rightLength;
+ along = (dx * faceX + dy * faceY + dz * faceZ) / faceLength;
+ length = sqrtf(across * across + along * along);
+ if (length < 0.0001f)
+ return;
+ *side = across / length;
+ *front = along / length;
+}
+
+/* Headphones (AIL_3D_HEADPHONE), kept here so both backends put a 3D sample in the same place: the
+ sound set round the head by the three cues a head gives, with no measured responses. The far ear
+ hears it later, by Woodworth's spherical head of 8.75 cm, 0.66 ms at the side; quieter, 5 dB at the
+ side, with the near ear lifted so the power holds; and duller, a one-pole low-pass falling to
+ 2.2 kHz at the side for the head's shadow. Behind, both ears are dulled a little, to 8 kHz
+ straight behind, the one cue left to tell a sound there from the same sound ahead. Ahead both
+ ears take 0.707, where the stereo pan puts a centred sound. A sample's channels are summed into
+ the one signal both ears hear, as the stereo pan sums them. */
+#define AIL_EX_HRTF_LINE 128 /* frames of delay line: 0.66 ms at 192 kHz is 126 */
+#define AIL_EX_HRTF_HEAD_SECONDS 0.000255f /* the head's radius over the speed of sound, 0.0875 / 343 */
+#define AIL_EX_HRTF_CENTRE 0.7071f
+#define AIL_EX_HRTF_NEAR_LIFT 0.3f
+#define AIL_EX_HRTF_FAR_DROP 0.45f
+#define AIL_EX_HRTF_SHADOW 8.0f /* 20 kHz / (1 + 8 side^2): 2.2 kHz at the side */
+#define AIL_EX_HRTF_BEHIND 1.5f /* 20 kHz / (1 + 1.5 behind^2): 8 kHz straight behind */
+#define AIL_EX_HRTF_DENORMAL_GUARD 1e-18f
+
+/* What each ear does to a sound from one bearing, left ear first. */
+typedef struct
+{
+ F32 delay[2]; /* frames */
+ F32 gain[2];
+ F32 coefficient[2]; /* AIL_ex_one_pole_coefficient's */
+} AIL_EX_HRTF_TARGET;
+
+/* One sample's ears: the delay line both read, each ear's low-pass, and the cues the last frame used. */
+typedef struct
+{
+ F32 line[AIL_EX_HRTF_LINE];
+ S32 at;
+ F32 store[2];
+ AIL_EX_HRTF_TARGET now;
+ S32 primed;
+} AIL_EX_HRTF;
+
+static inline void AIL_ex_hrtf_target(F32 side, F32 front, F32 rate, AIL_EX_HRTF_TARGET *target)
+{
+ const F32 lateral = fabsf(side) < 1.0f ? fabsf(side) : 1.0f;
+ const F32 behind = front < 0.0f ? -front : 0.0f;
+ const F32 limit = (F32)(AIL_EX_HRTF_LINE - 2);
+ const F32 itd = AIL_EX_HRTF_HEAD_SECONDS * (asinf(lateral) + lateral) * rate;
+ const F32 rear = AIL_EX_OPEN_CUTOFF / (1.0f + AIL_EX_HRTF_BEHIND * behind * behind);
+ const F32 shadow = AIL_EX_OPEN_CUTOFF / (1.0f + AIL_EX_HRTF_SHADOW * lateral * lateral);
+ const S32 distant = side < 0.0f ? 1 : 0; /* a sound on the left has the right ear away from it */
+ target->delay[distant] = itd < limit ? itd : limit;
+ target->delay[1 - distant] = 0.0f;
+ target->gain[distant] = AIL_EX_HRTF_CENTRE * (1.0f - AIL_EX_HRTF_FAR_DROP * lateral);
+ target->gain[1 - distant] = AIL_EX_HRTF_CENTRE * (1.0f + AIL_EX_HRTF_NEAR_LIFT * lateral);
+ target->coefficient[distant] = AIL_ex_one_pole_coefficient(shadow < rear ? shadow : rear, rate);
+ target->coefficient[1 - distant] = AIL_ex_one_pole_coefficient(rear, rate);
+}
+
+static inline void AIL_ex_hrtf_reset(AIL_EX_HRTF *head)
+{
+ S32 i;
+ for (i = 0; i < AIL_EX_HRTF_LINE; ++i)
+ head->line[i] = 0.0f;
+ head->at = 0;
+ head->store[0] = head->store[1] = 0.0f;
+ head->primed = 0;
+}
+
+/* `frames` of the summed signal into interleaved stereo, written rather than added, each cue moving in
+ a straight line from the last pass's to `target` so a sound going round the head neither clicks nor
+ steps. The delay is read between two frames of the line. */
+static inline void AIL_ex_hrtf_process(AIL_EX_HRTF *head, const AIL_EX_HRTF_TARGET *target,
+ const F32 *mono, F32 *stereo, S32 frames)
+{
+ const F32 step = frames > 0 ? 1.0f / (F32)frames : 0.0f;
+ S32 frame, ear;
+ if (!head->primed) {
+ head->now = *target;
+ head->primed = 1;
+ }
+ for (frame = 0; frame < frames; ++frame) {
+ const F32 t = (F32)(frame + 1) * step;
+ head->line[head->at] = mono[frame];
+ for (ear = 0; ear < 2; ++ear) {
+ const F32 delay = head->now.delay[ear] + (target->delay[ear] - head->now.delay[ear]) * t;
+ const F32 gain = head->now.gain[ear] + (target->gain[ear] - head->now.gain[ear]) * t;
+ const F32 coefficient = head->now.coefficient[ear] + (target->coefficient[ear] - head->now.coefficient[ear]) * t;
+ const S32 whole = (S32)delay;
+ const F32 part = delay - (F32)whole;
+ const F32 later = head->line[(head->at - whole + AIL_EX_HRTF_LINE) % AIL_EX_HRTF_LINE];
+ const F32 earlier = head->line[(head->at - whole - 1 + AIL_EX_HRTF_LINE) % AIL_EX_HRTF_LINE];
+ const F32 heard = later + (earlier - later) * part;
+ head->store[ear] += coefficient * (heard - head->store[ear]) + AIL_EX_HRTF_DENORMAL_GUARD;
+ stereo[frame * 2 + ear] = gain * head->store[ear];
+ }
+ head->at = (head->at + 1) % AIL_EX_HRTF_LINE;
+ }
+ head->now = *target;
+}
+
/* The master limiter both backends run last. A frame comes out AIL_EX_LIMITER_LOOKAHEAD - 1 frames
late, at a gain already down to what the loudest frame of the window needs, so no sample passes the
ceiling and none is cut flat. The gain falls along the average of the window's floors, a fade of
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/mss_backend_names.h b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/mss_backend_names.h
index 9bec6b300..67bc7468c 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/mss_backend_names.h
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/include/MSS/mss_backend_names.h
@@ -87,6 +87,8 @@
#define AIL_ex_set_reverb MSS_BACKEND_NAME(AIL_ex_set_reverb)
#define AIL_ex_duck MSS_BACKEND_NAME(AIL_ex_duck)
#define AIL_ex_set_3D_sample_dry MSS_BACKEND_NAME(AIL_ex_set_3D_sample_dry)
+#define AIL_ex_set_output_device MSS_BACKEND_NAME(AIL_ex_set_output_device)
+#define AIL_ex_enumerate_output_devices MSS_BACKEND_NAME(AIL_ex_enumerate_output_devices)
#define AIL_WAV_info MSS_BACKEND_NAME(AIL_WAV_info)
#define AIL_decompress_ADPCM MSS_BACKEND_NAME(AIL_decompress_ADPCM)
#define AIL_mem_free_lock MSS_BACKEND_NAME(AIL_mem_free_lock)
diff --git a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miles_dispatch.cpp b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miles_dispatch.cpp
index ab5a599f5..b93d87f5f 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miles_dispatch.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miles_dispatch.cpp
@@ -136,4 +136,19 @@ void AILCALL AIL_ex_capture_length(S32 *frames, S32 *rate)
*rate = 0;
}
+// XAudio2's alone, whatever g_offline says: WinMain names the device before the choice is made, and
+// a -wav run plays on no device at all.
+void AILCALL XA_AIL_ex_set_output_device(const char *id);
+S32 AILCALL XA_AIL_ex_enumerate_output_devices(S32 index, char *id, S32 id_bytes, U16 *name, S32 name_chars);
+
+void AILCALL AIL_ex_set_output_device(const char *id)
+{
+ XA_AIL_ex_set_output_device(id);
+}
+
+S32 AILCALL AIL_ex_enumerate_output_devices(S32 index, char *id, S32 id_bytes, U16 *name, S32 name_chars)
+{
+ return XA_AIL_ex_enumerate_output_devices(index, id, id_bytes, name, name_chars);
+}
+
} // extern "C"
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 290e26a03..6e4f9b197 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/miniaudio/miles_miniaudio.cpp
@@ -306,7 +306,10 @@ const float LOW_PASS_DENORMAL_GUARD = 1e-18f; // a filter left ringing on silenc
struct VoiceMix
{
VoiceMix() : resamplerReady(false), channels(0), gainLeft(0.0f), gainRight(0.0f), lowPass(1.0f), lowPassState(0.0f),
- lowPassSecond(0.0f), roomSend(0.0f), passThrough(false), pending(0), pendingAt(0) {}
+ lowPassSecond(0.0f), roomSend(0.0f), passThrough(false), headphones(false), pending(0), pendingAt(0)
+ {
+ AIL_ex_hrtf_reset(&head);
+ }
ma_resampler resampler;
bool resamplerReady;
@@ -322,6 +325,11 @@ struct VoiceMix
// An XAudio2 voice with the default matrix rather than a panned Miles one: left to left and right
// to right (a mono source to both), each at its gain. The movies' voice (mss_ex_pcm.h).
bool passThrough;
+ // A 3D sample under AIL_3D_HEADPHONE: the filtered sum through MSS.h's ears to `ears`, at the two
+ // gains (both the volume) in place of the pan, as miles_xaudio2's HeadEffect.
+ bool headphones;
+ AIL_EX_HRTF head;
+ AIL_EX_HRTF_TARGET ears;
// Frames already converted to float and not yet taken by the resampler, kept across mix passes
// so that nothing is dropped between them.
float input[MIX_CHUNK_FRAMES * 2];
@@ -365,6 +373,7 @@ void resetResampler(VoiceMix *mix)
mix->pendingAt = 0;
mix->lowPassState = 0.0f;
mix->lowPassSecond = 0.0f;
+ AIL_ex_hrtf_reset(&mix->head);
}
// Fills up to maxFrames of float source frames. Returns how many it gave; 0 means the source is dry.
@@ -382,6 +391,8 @@ bool mixVoice(VoiceMix *mix, SourceRead read, void *source, float *output, unsig
const float send = mix->roomSend * duck;
const float lowPass = mix->lowPass < muffle ? mix->lowPass : muffle;
float resampled[MIX_CHUNK_FRAMES * 2];
+ float heard[MIX_CHUNK_FRAMES];
+ float ears[MIX_CHUNK_FRAMES * 2];
unsigned done = 0;
while (done < frames) {
@@ -417,12 +428,22 @@ bool mixVoice(VoiceMix *mix, SourceRead read, void *source, float *output, unsig
mix->lowPassState += lowPass * (sum - mix->lowPassState) + LOW_PASS_DENORMAL_GUARD;
mix->lowPassSecond += lowPass * (mix->lowPassState - mix->lowPassSecond) + LOW_PASS_DENORMAL_GUARD;
sum = mix->lowPassSecond;
- output[(done + frame) * OUTPUT_CHANNELS + 0] += left * sum;
- output[(done + frame) * OUTPUT_CHANNELS + 1] += right * sum;
+ heard[frame] = sum;
+ if (!mix->headphones) {
+ output[(done + frame) * OUTPUT_CHANNELS + 0] += left * sum;
+ output[(done + frame) * OUTPUT_CHANNELS + 1] += right * sum;
+ }
if (room != NULL) {
room[done + frame] += send * sum;
}
}
+ if (!mix->passThrough && mix->headphones) {
+ AIL_ex_hrtf_process(&mix->head, &mix->ears, heard, ears, (S32)outFrames);
+ for (ma_uint64 frame = 0; frame < outFrames; ++frame) {
+ output[(done + frame) * OUTPUT_CHANNELS + 0] += left * ears[frame * 2];
+ output[(done + frame) * OUTPUT_CHANNELS + 1] += right * ears[frame * 2 + 1];
+ }
+ }
mix->pendingAt += (unsigned)inFrames;
mix->pending -= (unsigned)inFrames;
@@ -604,6 +625,9 @@ std::atomic<S32> g_linearFalloff(0); // AIL_ex_set_3D_linear_falloff
std::atomic<float> g_speedOfSound(0.0f); // AIL_ex_set_3D_air
std::atomic<float> g_absorptionDistance(0.0f);
std::atomic<float> g_roomSend(0.0f); // AIL_ex_set_reverb's wet
+// AIL_set_3D_speaker_type's AIL_3D_HEADPHONE, under the engine lock. Every other type is the stereo
+// pan here: this backend's device is two channels (OUTPUT_CHANNELS), surround is miles_xaudio2's.
+bool g_headphones = false;
AILFILEOPENCB g_fileOpen;
AILFILECLOSECB g_fileClose;
@@ -691,6 +715,8 @@ void refreshSampleOutput(Sample *sample)
float doppler = 1.0f;
float lowPass = 1.0f;
float send = 0.0f;
+ const bool headphones = sample->is3D && g_headphones;
+ AIL_EX_HRTF_TARGET ears = {};
if (sample->is3D) {
const Spatial spatial = computeSpatial(*sample);
volume = spatial.volume;
@@ -699,6 +725,15 @@ void refreshSampleOutput(Sample *sample)
lowPass = AIL_ex_one_pole_coefficient(spatial.cutoff, (float)g_engine.deviceRate);
send = spatial.send;
}
+ if (headphones) {
+ const Listener &listener = g_engine.listener;
+ float side;
+ float front;
+ AIL_ex_3D_bearing(sample->positionX - listener.positionX, sample->positionY - listener.positionY,
+ sample->positionZ - listener.positionZ, listener.faceX, listener.faceY, listener.faceZ,
+ listener.upX, listener.upY, listener.upZ, &side, &front);
+ AIL_ex_hrtf_target(side, front, (float)g_engine.deviceRate, &ears);
+ }
float ratio = 1.0f;
if (sample->baseRate != 0) {
@@ -708,7 +743,17 @@ void refreshSampleOutput(Sample *sample)
}
std::lock_guard<std::mutex> mixGuard(g_engine.mixLock);
- setGains(&sample->mix, volume, pan);
+ if (headphones) {
+ if (!sample->mix.headphones) {
+ AIL_ex_hrtf_reset(&sample->mix.head);
+ }
+ sample->mix.ears = ears;
+ sample->mix.gainLeft = clampUnit(volume);
+ sample->mix.gainRight = clampUnit(volume);
+ } else {
+ setGains(&sample->mix, volume, pan);
+ }
+ sample->mix.headphones = headphones;
sample->mix.lowPass = lowPass;
sample->mix.roomSend = send;
setResampleRate(&sample->mix, (float)sample->baseRate * ratio, g_engine.deviceRate);
@@ -1553,8 +1598,13 @@ S32 AILCALL AIL_enumerate_filters(HPROENUM *, HPROVIDER *, char **)
return 0;
}
-void AILCALL AIL_set_3D_speaker_type(HPROVIDER, S32)
+void AILCALL AIL_set_3D_speaker_type(HPROVIDER, S32 speaker_type)
{
+ std::lock_guard<std::recursive_mutex> guard(g_engine.lock);
+ g_headphones = speaker_type == AIL_3D_HEADPHONE;
+ for (size_t i = 0; i < g_engine.samples.size(); ++i) {
+ refreshSampleOutput(g_engine.samples[i]);
+ }
}
HPROVIDER AILCALL AIL_set_sample_processor(HSAMPLE, S32, HPROVIDER provider)
@@ -1937,6 +1987,16 @@ void AILCALL AIL_ex_set_3D_sample_dry(H3DSAMPLE handle, S32 dry)
refreshSampleOutput((Sample *)handle);
}
+// One device and no choosing: miniaudio plays on the system default (and -wav on none).
+void AILCALL AIL_ex_set_output_device(const char *)
+{
+}
+
+S32 AILCALL AIL_ex_enumerate_output_devices(S32, char *, S32, U16 *, S32)
+{
+ return 0;
+}
+
void AILCALL AIL_set_3D_sample_occlusion(H3DSAMPLE handle, F32 occlusion)
{
Sample *sample = (Sample *)handle;
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 cf2ecfdc8..4e1e57eaf 100644
--- a/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/xaudio2/miles_xaudio2.cpp
+++ b/GeneralsMD/Code/Libraries/Source/WWVegas/Miles6/xaudio2/miles_xaudio2.cpp
@@ -18,10 +18,16 @@
* running mss_ex_room.h's room, miles_miniaudio's own.
* EOS callbacks -> the service thread notices a voice run dry and calls back from there,
* which is the thread context Miles used (MilesAudioManager locks for it).
+ * speaker types -> headphones run AIL_ex_hrtf in an effect on every 3D voice; 4, 5.1 and 7.1
+ * are a mastering voice of that many channels, 3D voices panned round it.
+ * the output -> made again on the service thread whenever it is lost or asked for another
+ * way (openOutput, closeOutput), and absent altogether on a machine with
+ * no endpoint, where every sound plays in silence for its length.
*/
#include <windows.h>
#include <mmreg.h>
+#include <mmdeviceapi.h>
#include <xaudio2.h>
#include <xapo.h>
#include <math.h>
@@ -50,6 +56,12 @@ const int STREAM_BUFFERS_AHEAD = 4;
const int USER_DATA_SLOTS = 8;
const float DEFAULT_PAN = 0.5f;
const int AVIO_BUFFER_BYTES = 32768;
+// One unplug is a removal, a state change and a new default inside a few milliseconds; the output is
+// made again once the endpoints have been quiet this long, not once for each.
+const ULONGLONG ENDPOINT_SETTLE_MS = 300;
+const int OUTPUT_DEVICE_CHARS = 256;
+const float HEADPHONE_ROOM_SEND = 0.7071f; // both ears into the room: about the one signal a speaker voice sends
+const float HALF_TURN_RADIANS = 3.14159265f;
struct WaveImage
{
@@ -279,6 +291,179 @@ public:
SampleVoiceCallback g_sampleCallback;
+// An effect of our own on a voice, working on the voice's float mix, in place unless it says
+// otherwise. XAudio2 holds a reference while the voice has it in its chain.
+class Effect : public IXAPO
+{
+public:
+ explicit Effect(bool inPlace) : m_references(1), m_inPlace(inPlace) {}
+
+ STDMETHOD(QueryInterface)(REFIID riid, void **object)
+ {
+ if (object == NULL) {
+ return E_POINTER;
+ }
+ if (riid == __uuidof(IXAPO) || riid == __uuidof(IUnknown)) {
+ *object = static_cast<IXAPO *>(this);
+ AddRef();
+ return S_OK;
+ }
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+
+ STDMETHOD_(ULONG, AddRef)()
+ {
+ return (ULONG)InterlockedIncrement(&m_references);
+ }
+
+ STDMETHOD_(ULONG, Release)()
+ {
+ const LONG left = InterlockedDecrement(&m_references);
+ if (left == 0) {
+ delete this;
+ }
+ return (ULONG)left;
+ }
+
+ STDMETHOD(GetRegistrationProperties)(XAPO_REGISTRATION_PROPERTIES **properties)
+ {
+ XAPO_REGISTRATION_PROPERTIES *copy = (XAPO_REGISTRATION_PROPERTIES *)
+ CoTaskMemAlloc(sizeof(XAPO_REGISTRATION_PROPERTIES));
+ if (copy == NULL) {
+ return E_OUTOFMEMORY;
+ }
+ memset(copy, 0, sizeof(*copy));
+ wcscpy_s(copy->FriendlyName, L"master");
+ wcscpy_s(copy->CopyrightInfo, L"");
+ copy->MajorVersion = 1;
+ copy->Flags = XAPO_FLAG_FRAMERATE_MUST_MATCH | XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH | XAPO_FLAG_BUFFERCOUNT_MUST_MATCH;
+ if (m_inPlace) {
+ copy->Flags |= XAPO_FLAG_CHANNELS_MUST_MATCH | XAPO_FLAG_INPLACE_SUPPORTED | XAPO_FLAG_INPLACE_REQUIRED;
+ }
+ copy->MinInputBufferCount = 1;
+ copy->MaxInputBufferCount = 1;
+ copy->MinOutputBufferCount = 1;
+ copy->MaxOutputBufferCount = 1;
+ *properties = copy;
+ return S_OK;
+ }
+
+ // Any format is taken. The out pointer is for the nearest format to one refused, allocated with
+ // XAPOAlloc for the caller to free, so a yes leaves it alone, as CXAPOBase does: handing back the
+ // caller's own pointer gives it something of its own to free.
+ STDMETHOD(IsInputFormatSupported)(const WAVEFORMATEX *, const WAVEFORMATEX *, WAVEFORMATEX **)
+ {
+ return S_OK;
+ }
+
+ STDMETHOD(IsOutputFormatSupported)(const WAVEFORMATEX *, const WAVEFORMATEX *, WAVEFORMATEX **)
+ {
+ return S_OK;
+ }
+
+ STDMETHOD(Initialize)(const void *, UINT32)
+ {
+ return S_OK;
+ }
+
+ STDMETHOD_(void, Reset)()
+ {
+ }
+
+ STDMETHOD(LockForProcess)(UINT32, const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *, UINT32,
+ const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *)
+ {
+ return S_OK;
+ }
+
+ STDMETHOD_(void, UnlockForProcess)()
+ {
+ }
+
+ STDMETHOD_(UINT32, CalcInputFrames)(UINT32 outputFrameCount)
+ {
+ return outputFrameCount;
+ }
+
+ STDMETHOD_(UINT32, CalcOutputFrames)(UINT32 inputFrameCount)
+ {
+ return inputFrameCount;
+ }
+
+protected:
+ virtual ~Effect() {}
+
+private:
+ volatile LONG m_references;
+ bool m_inPlace;
+};
+
+// A 3D voice's head under AIL_3D_HEADPHONE: the voice's channels summed and put round the head by
+// MSS.h's AIL_ex_hrtf, two channels out whatever came in. The bearing comes from the service
+// thread at each refresh, and the mixer takes it up at its next pass.
+class HeadEffect : public Effect
+{
+public:
+ HeadEffect() : Effect(false), m_side(0.0f), m_front(1.0f), m_inputChannels(1), m_rate(0.0f)
+ {
+ AIL_ex_hrtf_reset(&m_head);
+ }
+
+ void aim(float side, float front)
+ {
+ m_side.store(side);
+ m_front.store(front);
+ }
+
+ STDMETHOD(LockForProcess)(UINT32, const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *input, UINT32,
+ const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *)
+ {
+ m_inputChannels = input[0].pFormat->nChannels;
+ m_rate = (float)input[0].pFormat->nSamplesPerSec;
+ m_sum.resize(input[0].MaxFrameCount);
+ AIL_ex_hrtf_reset(&m_head);
+ return S_OK;
+ }
+
+ STDMETHOD_(void, Reset)()
+ {
+ AIL_ex_hrtf_reset(&m_head);
+ }
+
+ STDMETHOD_(void, Process)(UINT32, const XAPO_PROCESS_BUFFER_PARAMETERS *input, UINT32,
+ XAPO_PROCESS_BUFFER_PARAMETERS *output, BOOL)
+ {
+ // not in place: the voice's channels come in, two go out; a silent pass is no input, and the
+ // delay line still gives out what it holds
+ const UINT32 frames = input[0].ValidFrameCount;
+ const float *in = (const float *)input[0].pBuffer;
+ const bool silent = input[0].BufferFlags == XAPO_BUFFER_SILENT;
+ for (UINT32 frame = 0; frame < frames; ++frame) {
+ float sum = 0.0f;
+ for (UINT32 channel = 0; !silent && channel < m_inputChannels; ++channel) {
+ sum += in[frame * m_inputChannels + channel];
+ }
+ m_sum[frame] = sum;
+ }
+ AIL_EX_HRTF_TARGET target;
+ AIL_ex_hrtf_target(m_side.load(), m_front.load(), m_rate, &target);
+ AIL_ex_hrtf_process(&m_head, &target, m_sum.data(), (float *)output[0].pBuffer, (S32)frames);
+ output[0].ValidFrameCount = frames;
+ output[0].BufferFlags = XAPO_BUFFER_VALID;
+ }
+
+private:
+ ~HeadEffect() {}
+
+ AIL_EX_HRTF m_head; // the mixer thread's alone
+ std::vector<float> m_sum;
+ std::atomic<float> m_side;
+ std::atomic<float> m_front;
+ UINT32 m_inputChannels;
+ float m_rate;
+};
+
struct Sample
{
bool is3D;
@@ -300,6 +485,8 @@ struct Sample
float velocityX, velocityY, velocityZ; // units a second, AIL_set_3D_velocity_vector
bool unducked; // started a duck, so the duck leaves it alone until it is over or the sample stops
bool dry; // AIL_ex_set_3D_sample_dry
+ HeadEffect *head; // our reference to the voice's head under AIL_3D_HEADPHONE, NULL otherwise
+ ULONGLONG silentEndMs; // playing with no voice: when the sound it would have been is over
};
struct StreamBuffer
@@ -313,7 +500,7 @@ struct Stream
: format(NULL), avio(NULL), decoder(NULL), resampler(NULL), audioStream(-1), fileHandle(0),
ownsFileHandle(false), voice(NULL), loopCount(1), paused(false), playing(false),
exhausted(false), volume(1.0f), pan(DEFAULT_PAN), totalMs(0.0), framesSubmitted(0),
- callback(NULL)
+ callback(NULL), silentEndMs(0)
{
memset(&voiceFormat, 0, sizeof(voiceFormat));
}
@@ -339,6 +526,7 @@ struct Stream
double totalMs;
long long framesSubmitted;
AILSTREAMCB callback;
+ ULONGLONG silentEndMs; // playing with no voice: when the file would have played out
};
struct Listener
@@ -351,9 +539,12 @@ struct Listener
struct Engine
{
IXAudio2 *xaudio;
- IXAudio2MasteringVoice *master;
+ IXAudio2MasteringVoice *master; // NULL while there is no endpoint to play on
unsigned int masterRate;
+ unsigned int masterChannels;
+ bool onPickedDevice; // the master is on AIL_ex_set_output_device's endpoint, not the default
IXAudio2SubmixVoice *room; // RoomTap, AIL_ex_set_reverb; NULL where it could not be made
+ IMMDeviceEnumerator *endpoints; // holds EndpointWatch's registration
CRITICAL_SECTION lock;
HANDLE serviceThread;
volatile LONG serviceRunning;
@@ -365,12 +556,33 @@ struct Engine
};
Engine g_engine;
+// The output asked for: AIL_set_3D_speaker_type's and AIL_ex_set_output_device's, under the lock once
+// there is one. An empty device is the system's default.
+S32 g_speakerType = AIL_3D_2_SPEAKER;
+wchar_t g_outputDevice[OUTPUT_DEVICE_CHARS];
+// Set on XAudio2's and MMDevice's own threads, and by the two settings, and taken up by the service
+// thread (serviceOutput).
+std::atomic<bool> g_remakeOutput(false);
+std::atomic<bool> g_endpointsMoved(false);
+std::atomic<bool> g_defaultMoved(false);
+std::atomic<ULONGLONG> g_endpointsMovedMs(0);
S32 g_linearFalloff; // AIL_ex_set_3D_linear_falloff
// written by the game's thread with no lock, read by the service thread under it
std::atomic<float> g_speedOfSound(0.0f); // AIL_ex_set_3D_air
std::atomic<float> g_absorptionDistance(0.0f);
std::atomic<float> g_roomSend(0.0f); // AIL_ex_set_reverb's wet
+// The rest of AIL_ex_set_reverb, under the lock, for a room made again with the output.
+struct RoomSettings
+{
+ bool given;
+ float decay;
+ float damping;
+ float echo;
+ float slap;
+};
+RoomSettings g_roomSettings = { false, 0.0f, 0.0f, 0.0f, 0.0f };
+
// AIL_ex_duck, under the lock. duckNow is the gain the service thread worked out last.
struct Duck
{
@@ -400,44 +612,93 @@ float clampUnit(float value)
return value;
}
-void applyPan(IXAudio2SourceVoice *voice, unsigned int sourceChannels, float pan)
+// Every source channel into each of the master's speakers at that speaker's gain, the way Miles sums a
+// sample's channels into both sides of a pan. The master by name: a 3D sample's voice has a second
+// send, into the room.
+void applySpeakerGains(IXAudio2SourceVoice *voice, unsigned int sourceChannels, const float *gains)
{
- if (voice == NULL || g_engine.master == NULL) {
- return;
+ std::vector<float> matrix((size_t)sourceChannels * g_engine.masterChannels, 0.0f);
+ for (unsigned int speaker = 0; speaker < g_engine.masterChannels; ++speaker) {
+ for (unsigned int channel = 0; channel < sourceChannels; ++channel) {
+ matrix[(size_t)speaker * sourceChannels + channel] = gains[speaker];
+ }
}
+ voice->SetOutputMatrix(g_engine.master, sourceChannels, g_engine.masterChannels, &matrix[0]);
+}
- XAUDIO2_VOICE_DETAILS masterDetails;
- g_engine.master->GetVoiceDetails(&masterDetails);
- if (masterDetails.InputChannels < 2) {
+// Miles' pan, onto the front pair of whatever the master has. A constant-power law: dead centre is
+// not two half-volume speakers.
+void applyPan(IXAudio2SourceVoice *voice, unsigned int sourceChannels, float pan)
+{
+ if (voice == NULL || g_engine.master == NULL || g_engine.masterChannels < 2) {
return;
}
- const float left = clampUnit(1.0f - pan);
- const float right = clampUnit(pan);
- // Miles' pan is a constant-power law: dead centre is not two half-volume speakers.
- const float leftGain = (float)sqrt(left);
- const float rightGain = (float)sqrt(right);
+ float gains[XAUDIO2_MAX_AUDIO_CHANNELS] = { 0.0f };
+ gains[0] = (float)sqrt(clampUnit(1.0f - pan));
+ gains[1] = (float)sqrt(clampUnit(pan));
+ applySpeakerGains(voice, sourceChannels, gains);
+}
- std::vector<float> matrix((size_t)sourceChannels * masterDetails.InputChannels, 0.0f);
- for (unsigned int channel = 0; channel < sourceChannels; ++channel) {
- matrix[(size_t)0 * sourceChannels + channel] = leftGain;
- matrix[(size_t)1 * sourceChannels + channel] = rightGain;
+// A speaker of a surround master: its bearing in degrees clockwise from ahead, and its channel in
+// WAVEFORMATEXTENSIBLE's order for the count, which is how XAudio2 reads a master of that many
+// channels: front left, front right, centre, LFE, back left, back right, side left, side right. The
+// LFE takes nothing. Each ring runs round the listener in bearing order.
+struct Speaker
+{
+ float bearing;
+ unsigned int channel;
+};
+const Speaker QUAD_RING[] = { { -135.0f, 2 }, { -45.0f, 0 }, { 45.0f, 1 }, { 135.0f, 3 } };
+const Speaker RING_51[] = { { -110.0f, 4 }, { -30.0f, 0 }, { 0.0f, 2 }, { 30.0f, 1 }, { 110.0f, 5 } };
+const Speaker RING_71[] = { { -150.0f, 4 }, { -90.0f, 6 }, { -30.0f, 0 }, { 0.0f, 2 }, { 30.0f, 1 }, { 90.0f, 7 }, { 150.0f, 5 } };
+
+// A 3D sample on a surround master: the two speakers either side of its bearing share it at the
+// constant-power law of the stereo pan, the rest are silent.
+void applySurround(IXAudio2SourceVoice *voice, unsigned int sourceChannels, float side, float front)
+{
+ const Speaker *ring = g_engine.masterChannels >= 8 ? RING_71 : (g_engine.masterChannels >= 6 ? RING_51 : QUAD_RING);
+ const unsigned int count = g_engine.masterChannels >= 8 ? 7 : (g_engine.masterChannels >= 6 ? 5 : 4);
+ const float bearing = atan2f(side, front) * 180.0f / HALF_TURN_RADIANS;
+
+ float gains[XAUDIO2_MAX_AUDIO_CHANNELS] = { 0.0f };
+ for (unsigned int i = 0; i < count; ++i) {
+ const Speaker &from = ring[i];
+ const Speaker &to = ring[(i + 1) % count];
+ const float span = to.bearing > from.bearing ? to.bearing - from.bearing : to.bearing - from.bearing + 360.0f;
+ const float past = bearing >= from.bearing ? bearing - from.bearing : bearing - from.bearing + 360.0f;
+ if (past <= span) {
+ const float share = past / span * 0.5f * HALF_TURN_RADIANS;
+ gains[from.channel] = cosf(share);
+ gains[to.channel] = sinf(share);
+ break;
+ }
}
- // the master by name: a 3D sample's voice has a second send, into the room
- voice->SetOutputMatrix(g_engine.master, sourceChannels, masterDetails.InputChannels, &matrix[0]);
+ applySpeakerGains(voice, sourceChannels, gains);
}
-// Every source channel into both of the room's, at one gain relative to the voice's volume.
-void applyRoomSend(IXAudio2SourceVoice *voice, unsigned int sourceChannels, float send)
+// A head's two ears straight onto the master's first two speakers; the head has panned already.
+void applyEars(IXAudio2SourceVoice *voice)
{
- std::vector<float> matrix((size_t)sourceChannels * 2, send);
- voice->SetOutputMatrix(g_engine.room, sourceChannels, 2, &matrix[0]);
+ std::vector<float> matrix((size_t)2 * g_engine.masterChannels, 0.0f);
+ matrix[0 * 2 + 0] = 1.0f;
+ matrix[1 * 2 + 1] = 1.0f;
+ voice->SetOutputMatrix(g_engine.master, 2, g_engine.masterChannels, &matrix[0]);
+}
+
+// Every channel the voice gives out into both of the room's, at one gain relative to its volume.
+void applyRoomSend(IXAudio2SourceVoice *voice, unsigned int voiceChannels, float send)
+{
+ std::vector<float> matrix((size_t)voiceChannels * 2, send);
+ voice->SetOutputMatrix(g_engine.room, voiceChannels, 2, &matrix[0]);
}
struct Spatial
{
float volume;
float pan;
+ float side; // AIL_ex_3D_bearing, for the head and the surround pan
+ float front;
float cutoff; // Hz, AIL_ex_3D_cutoff
float send; // into the room, AIL_ex_3D_send
float doppler; // pitch ratio, AIL_ex_doppler_ratio
@@ -470,6 +731,8 @@ Spatial computeSpatial(const Sample &sample)
Spatial spatial;
spatial.volume = clampUnit(sample.volume) * attenuation;
spatial.pan = pan;
+ AIL_ex_3D_bearing(dx, dy, dz, listener.faceX, listener.faceY, listener.faceZ,
+ listener.upX, listener.upY, listener.upZ, &spatial.side, &spatial.front);
// a duck muffles everything but its trigger, as miles_miniaudio's mix does
const float muffle = sample.unducked ? AIL_EX_OPEN_CUTOFF : AIL_ex_duck_cutoff(g_duck.duckNow);
if (sample.dry) {
@@ -494,19 +757,34 @@ void refreshSampleOutput(Sample *sample)
float volume = sample->volume;
float pan = sample->pan;
float doppler = 1.0f;
+ bool surround = false;
+ float side = 0.0f;
+ float front = 1.0f;
if (sample->is3D) {
const Spatial spatial = computeSpatial(*sample);
volume = spatial.volume;
pan = spatial.pan;
doppler = spatial.doppler;
+ side = spatial.side;
+ front = spatial.front;
+ surround = g_engine.masterChannels > 2;
const XAUDIO2_FILTER_PARAMETERS filter = { LowPassOnePoleFilter,
AIL_ex_one_pole_coefficient(spatial.cutoff, (float)g_engine.masterRate), 1.0f };
sample->voice->SetFilterParameters(&filter);
sample->voice->SetOutputFilterParameters(g_engine.master, &filter);
- // the voice's volume scales both sends, so the room's is given relative to it
+ if (sample->head != NULL) {
+ sample->head->aim(side, front);
+ }
+ // the voice's volume scales both sends, so the room's is given relative to it; a head gives
+ // out two ears where a speaker voice gives its own channels
if (g_engine.room != NULL) {
+ const float send = volume > 0.0f ? spatial.send / volume : 0.0f;
sample->voice->SetOutputFilterParameters(g_engine.room, &filter);
- applyRoomSend(sample->voice, sample->format.nChannels, volume > 0.0f ? spatial.send / volume : 0.0f);
+ if (sample->head != NULL) {
+ applyRoomSend(sample->voice, 2, send * HEADPHONE_ROOM_SEND);
+ } else {
+ applyRoomSend(sample->voice, sample->format.nChannels, send);
+ }
}
}
if (!sample->unducked) {
@@ -514,7 +792,12 @@ void refreshSampleOutput(Sample *sample)
}
sample->voice->SetVolume(clampUnit(volume));
- applyPan(sample->voice, sample->format.nChannels, pan);
+ // a head's ears were put on the master when the voice was made (freshVoice)
+ if (surround && sample->head == NULL) {
+ applySurround(sample->voice, sample->format.nChannels, side, front);
+ } else if (sample->head == NULL) {
+ applyPan(sample->voice, sample->format.nChannels, pan);
+ }
if (sample->baseRate != 0) {
float ratio = (float)sample->rate / (float)sample->baseRate * doppler;
if (ratio < XAUDIO2_MIN_FREQ_RATIO) ratio = XAUDIO2_MIN_FREQ_RATIO;
@@ -537,16 +820,30 @@ void destroyVoice(IXAudio2SourceVoice **voice)
// references, and only OnBufferEnd gives them back, which a destroyed voice no longer calls. It
// is stopped and flushed here, and the service thread destroys it once the mixer has retired its
// last buffer. Under the lock.
-void retireVoice(IXAudio2SourceVoice **voice)
+void retireVoice(Sample *sample)
{
- if (*voice != NULL) {
- (*voice)->Stop(0);
- (*voice)->FlushSourceBuffers();
- g_engine.retiredVoices.push_back(*voice);
- *voice = NULL;
+ if (sample->voice != NULL) {
+ sample->voice->Stop(0);
+ sample->voice->FlushSourceBuffers();
+ g_engine.retiredVoices.push_back(sample->voice);
+ sample->voice = NULL;
+ }
+ // the chain keeps its own reference for as long as the voice lives
+ if (sample->head != NULL) {
+ sample->head->Release();
+ sample->head = NULL;
}
}
+// How long the sample's sound lasts at its playback rate, for one played with no voice.
+ULONGLONG silentLengthMs(const Sample &sample)
+{
+ if (sample.data == NULL || sample.format.nBlockAlign == 0 || sample.rate == 0) {
+ return 0;
+ }
+ return (ULONGLONG)(sample.data->bytes / sample.format.nBlockAlign) * 1000 / sample.rate;
+}
+
// Every sound gets a voice nobody has played before, and a voice is never fed again once it has
// been started. Crash reports 890, 1254, 1724 and 1748 are xaudio2_9.dll's resampler reading a
// source buffer at frame -1 as an unsigned 32-bit index, 8 GB past the buffer (1748, on the same
@@ -558,22 +855,37 @@ void retireVoice(IXAudio2SourceVoice **voice)
// no position to carry, the way every fire-and-forget XAudio2 sound starts.
bool freshVoice(Sample *sample, const WAVEFORMATEX &format)
{
- if (g_engine.xaudio == NULL) {
- return false;
- }
-
- retireVoice(&sample->voice);
+ retireVoice(sample);
sample->started = false;
sample->format = format;
+ // no endpoint to play on: the sample plays in silence (AIL_start_sample)
+ if (g_engine.xaudio == NULL || g_engine.master == NULL) {
+ return false;
+ }
if (!sample->is3D) {
return SUCCEEDED(g_engine.xaudio->CreateSourceVoice(&sample->voice, &format, 0, 4.0f, &g_sampleCallback));
}
// A 3D sample's voice has the filter for air and occlusion, and sends into the room as well. Each
- // send filters again, which makes the two one-pole stages miles_miniaudio runs.
+ // send filters again, which makes the two one-pole stages miles_miniaudio runs. Under headphones
+ // the voice's head comes after the filter and gives out two ears, whatever the file has.
XAUDIO2_SEND_DESCRIPTOR sends[2] = { { XAUDIO2_SEND_USEFILTER, g_engine.master }, { XAUDIO2_SEND_USEFILTER, g_engine.room } };
XAUDIO2_VOICE_SENDS sendList = { g_engine.room != NULL ? 2u : 1u, sends };
- return SUCCEEDED(g_engine.xaudio->CreateSourceVoice(&sample->voice, &format, XAUDIO2_VOICE_USEFILTER, 4.0f,
- &g_sampleCallback, &sendList));
+ if (g_speakerType != AIL_3D_HEADPHONE) {
+ return SUCCEEDED(g_engine.xaudio->CreateSourceVoice(&sample->voice, &format, XAUDIO2_VOICE_USEFILTER, 4.0f,
+ &g_sampleCallback, &sendList));
+ }
+ HeadEffect *head = new HeadEffect;
+ XAUDIO2_EFFECT_DESCRIPTOR descriptor = { static_cast<IXAPO *>(head), TRUE, 2 };
+ XAUDIO2_EFFECT_CHAIN chain = { 1, &descriptor };
+ if (FAILED(g_engine.xaudio->CreateSourceVoice(&sample->voice, &format, XAUDIO2_VOICE_USEFILTER, 4.0f,
+ &g_sampleCallback, &sendList, &chain))) {
+ sample->voice = NULL;
+ head->Release();
+ return false;
+ }
+ sample->head = head;
+ applyEars(sample->voice);
+ return true;
}
// ---------------------------------------------------------------------------------------------
@@ -703,12 +1015,31 @@ bool openStreamDecoder(Stream *stream, const char *filename)
} else if (audio->duration > 0) {
stream->totalMs = (double)audio->duration * av_q2d(audio->time_base) * 1000.0;
}
+ return true;
+}
- if (g_engine.xaudio == NULL ||
+// The stream's voice, under the lock. None while there is no endpoint: the stream then plays in
+// silence, and openOutput gives it one when an endpoint comes.
+void voiceStream(Stream *stream)
+{
+ if (g_engine.master == NULL ||
FAILED(g_engine.xaudio->CreateSourceVoice(&stream->voice, &stream->voiceFormat, 0, 2.0f))) {
- return false;
+ stream->voice = NULL;
}
- return true;
+}
+
+// AIL_start_stream's half that touches the voice, and openOutput's for a stream that was playing when
+// the output went. Under the lock.
+void playStream(Stream *stream)
+{
+ if (stream->voice == NULL) {
+ const double loops = stream->loopCount > 1 ? (double)stream->loopCount : 1.0;
+ stream->silentEndMs = GetTickCount64() + (ULONGLONG)(stream->totalMs * loops);
+ return;
+ }
+ stream->voice->SetVolume(clampUnit(stream->volume) * g_duck.duckNow);
+ applyPan(stream->voice, stream->voiceFormat.nChannels, stream->pan);
+ stream->voice->Start(0);
}
// Decodes up to one chunk. Returns false at the end of the file with nothing more to give.
@@ -776,7 +1107,18 @@ bool rewindStream(Stream *stream)
void serviceStream(Stream *stream, std::vector<AILSTREAMCB> *callbacks, std::vector<HSTREAM> *callbackHandles)
{
- if (stream->voice == NULL || !stream->playing) {
+ if (!stream->playing) {
+ return;
+ }
+ // in silence, with no endpoint: over when the file would have been; a pause does not hold the clock
+ if (stream->voice == NULL) {
+ if (!stream->paused && GetTickCount64() >= stream->silentEndMs) {
+ stream->playing = false;
+ if (stream->callback != NULL) {
+ callbacks->push_back(stream->callback);
+ callbackHandles->push_back((HSTREAM)stream);
+ }
+ }
return;
}
@@ -818,8 +1160,12 @@ void serviceStream(Stream *stream, std::vector<AILSTREAMCB> *callbacks, std::vec
}
}
+void serviceOutput();
+
DWORD WINAPI serviceThreadMain(LPVOID)
{
+ // the output is made again on this thread, and an endpoint is found through COM
+ CoInitializeEx(NULL, COINIT_MULTITHREADED);
while (InterlockedCompareExchange(&g_engine.serviceRunning, 1, 1) == 1) {
std::vector<AILSAMPLECB> sampleCallbacks;
std::vector<HSAMPLE> sampleHandles;
@@ -830,6 +1176,7 @@ DWORD WINAPI serviceThreadMain(LPVOID)
std::vector<IXAudio2SourceVoice *> spentVoices;
EnterCriticalSection(&g_engine.lock);
+ serviceOutput();
for (size_t i = 0; i < g_engine.retiredVoices.size(); ) {
XAUDIO2_VOICE_STATE state;
g_engine.retiredVoices[i]->GetState(&state);
@@ -861,7 +1208,19 @@ DWORD WINAPI serviceThreadMain(LPVOID)
if (ducking && !g_duck.active) {
sample->unducked = false;
}
+ // started with no voice to play on, or its voice went with the output: over once the
+ // sound would have been, and the handle comes back the way a played one does
if (sample->voice == NULL) {
+ if (sample->playing && GetTickCount64() >= sample->silentEndMs) {
+ sample->playing = false;
+ if (sample->is3D && sample->endOf3DSample != NULL) {
+ sample3DCallbacks.push_back(sample->endOf3DSample);
+ sample3DHandles.push_back((H3DSAMPLE)sample);
+ } else if (!sample->is3D && sample->endOfSample != NULL) {
+ sampleCallbacks.push_back(sample->endOfSample);
+ sampleHandles.push_back((HSAMPLE)sample);
+ }
+ }
continue;
}
if (sample->is3D || ducking) {
@@ -909,6 +1268,7 @@ DWORD WINAPI serviceThreadMain(LPVOID)
Sleep(SERVICE_PERIOD_MS);
}
+ CoUninitialize();
return 0;
}
@@ -962,119 +1322,13 @@ void writeWaveHeader(FILE *file, unsigned int channels, unsigned int samplesPerS
writeLittleU32(file, dataBytes);
}
-// An effect of our own on a voice, working on the voice's float mix in place, with the format the
-// voice has. XAudio2 holds a reference while the voice has it in its chain.
-class InPlaceEffect : public IXAPO
-{
-public:
- InPlaceEffect() : m_references(1) {}
-
- STDMETHOD(QueryInterface)(REFIID riid, void **object)
- {
- if (object == NULL) {
- return E_POINTER;
- }
- if (riid == __uuidof(IXAPO) || riid == __uuidof(IUnknown)) {
- *object = static_cast<IXAPO *>(this);
- AddRef();
- return S_OK;
- }
- *object = NULL;
- return E_NOINTERFACE;
- }
-
- STDMETHOD_(ULONG, AddRef)()
- {
- return (ULONG)InterlockedIncrement(&m_references);
- }
-
- STDMETHOD_(ULONG, Release)()
- {
- const LONG left = InterlockedDecrement(&m_references);
- if (left == 0) {
- delete this;
- }
- return (ULONG)left;
- }
-
- STDMETHOD(GetRegistrationProperties)(XAPO_REGISTRATION_PROPERTIES **properties)
- {
- XAPO_REGISTRATION_PROPERTIES *copy = (XAPO_REGISTRATION_PROPERTIES *)
- CoTaskMemAlloc(sizeof(XAPO_REGISTRATION_PROPERTIES));
- if (copy == NULL) {
- return E_OUTOFMEMORY;
- }
- memset(copy, 0, sizeof(*copy));
- wcscpy_s(copy->FriendlyName, L"master");
- wcscpy_s(copy->CopyrightInfo, L"");
- copy->MajorVersion = 1;
- copy->Flags = XAPO_FLAG_CHANNELS_MUST_MATCH | XAPO_FLAG_FRAMERATE_MUST_MATCH
- | XAPO_FLAG_BITSPERSAMPLE_MUST_MATCH | XAPO_FLAG_BUFFERCOUNT_MUST_MATCH
- | XAPO_FLAG_INPLACE_SUPPORTED | XAPO_FLAG_INPLACE_REQUIRED;
- copy->MinInputBufferCount = 1;
- copy->MaxInputBufferCount = 1;
- copy->MinOutputBufferCount = 1;
- copy->MaxOutputBufferCount = 1;
- *properties = copy;
- return S_OK;
- }
-
- // Any format is taken. The out pointer is for the nearest format to one refused, allocated with
- // XAPOAlloc for the caller to free, so a yes leaves it alone, as CXAPOBase does: handing back the
- // caller's own pointer gives it something of its own to free.
- STDMETHOD(IsInputFormatSupported)(const WAVEFORMATEX *, const WAVEFORMATEX *, WAVEFORMATEX **)
- {
- return S_OK;
- }
-
- STDMETHOD(IsOutputFormatSupported)(const WAVEFORMATEX *, const WAVEFORMATEX *, WAVEFORMATEX **)
- {
- return S_OK;
- }
-
- STDMETHOD(Initialize)(const void *, UINT32)
- {
- return S_OK;
- }
-
- STDMETHOD_(void, Reset)()
- {
- }
-
- STDMETHOD(LockForProcess)(UINT32, const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *, UINT32,
- const XAPO_LOCKFORPROCESS_BUFFER_PARAMETERS *)
- {
- return S_OK;
- }
-
- STDMETHOD_(void, UnlockForProcess)()
- {
- }
-
- STDMETHOD_(UINT32, CalcInputFrames)(UINT32 outputFrameCount)
- {
- return outputFrameCount;
- }
-
- STDMETHOD_(UINT32, CalcOutputFrames)(UINT32 inputFrameCount)
- {
- return inputFrameCount;
- }
-
-protected:
- virtual ~InPlaceEffect() {}
-
-private:
- volatile LONG m_references;
-};
-
// The master voice's one effect: MSS.h's limiter on everything, then, while AIL_ex_start_capture has
// a file open, the recording of what the limiter let out.
-class MasterTap : public InPlaceEffect
+class MasterTap : public Effect
{
public:
MasterTap(FILE *file, unsigned int channels, unsigned int samplesPerSecond)
- : m_file(file), m_channels(channels), m_samplesPerSecond(samplesPerSecond), m_dataBytes(0),
+ : Effect(true), m_file(file), m_channels(channels), m_samplesPerSecond(samplesPerSecond), m_dataBytes(0),
m_sizesWrittenAt(0)
{
AIL_ex_limiter_init(&m_limiter, (S32)channels, (F32)samplesPerSecond);
@@ -1178,11 +1432,11 @@ bool installMasterTap(FILE *file)
// The room submix's effect: the send, which every voice puts on both channels alike, through
// mss_ex_room.h's room, the one miles_miniaudio mixes, so a player and a -wav run hear one room.
-class RoomTap : public InPlaceEffect
+class RoomTap : public Effect
{
public:
explicit RoomTap(unsigned int samplesPerSecond)
- : m_pending(false), m_decay(0.0f), m_damping(0.0f), m_echo(0.0f), m_slap(0.0f)
+ : Effect(true), m_pending(false), m_decay(0.0f), m_damping(0.0f), m_echo(0.0f), m_slap(0.0f)
{
InitializeCriticalSection(&m_settingsLock);
initRoom(&m_room, samplesPerSecond);
@@ -1251,7 +1505,8 @@ private:
RoomTap *g_roomTap; // our reference, for AIL_ex_set_reverb; the room voice holds XAudio2's
-// The room every 3D sample sends to: RoomTap on a stereo submix into the master, at the master's rate.
+// The room every 3D sample sends to: RoomTap on a stereo submix into the master, at the master's
+// rate, and the last room AIL_ex_set_reverb asked for, since this is made again with the output.
void createRoom()
{
RoomTap *tap = new RoomTap(g_engine.masterRate);
@@ -1262,9 +1517,182 @@ void createRoom()
tap->Release();
return;
}
+ if (g_roomSettings.given) {
+ tap->set(g_roomSettings.decay, g_roomSettings.damping, g_roomSettings.echo, g_roomSettings.slap);
+ }
g_roomTap = tap;
}
+// ---------------------------------------------------------------------------------------------
+// The output, and keeping it
+//
+// XAudio2 reports a lost device (headphones pulled, a USB card gone, the audio service restarted)
+// as a critical error, after which nothing it made works again and the engine has to go. A new
+// default endpoint is not an error at all: a game on the default would go on playing into the old
+// one, or into nothing. Both, a new speaker type and a new endpoint picked in the options all end
+// in the same place, the service thread making the whole output again (serviceOutput).
+// ---------------------------------------------------------------------------------------------
+
+class EngineWatch : public IXAudio2EngineCallback
+{
+public:
+ STDMETHOD_(void, OnProcessingPassStart)() {}
+ STDMETHOD_(void, OnProcessingPassEnd)() {}
+ // on XAudio2's own thread, which may not destroy anything: the service thread does
+ STDMETHOD_(void, OnCriticalError)(HRESULT) { g_remakeOutput.store(true); }
+};
+EngineWatch g_engineWatch;
+
+void noteEndpoints(bool defaultMoved)
+{
+ if (defaultMoved) {
+ g_defaultMoved.store(true);
+ }
+ g_endpointsMovedMs.store(GetTickCount64());
+ g_endpointsMoved.store(true);
+}
+
+// MMDevice's word on the endpoints, on a thread of its own. One object for the process, never freed.
+class EndpointWatch : public IMMNotificationClient
+{
+public:
+ STDMETHOD(QueryInterface)(REFIID riid, void **object)
+ {
+ if (riid == __uuidof(IUnknown) || riid == __uuidof(IMMNotificationClient)) {
+ *object = static_cast<IMMNotificationClient *>(this);
+ return S_OK;
+ }
+ *object = NULL;
+ return E_NOINTERFACE;
+ }
+ STDMETHOD_(ULONG, AddRef)() { return 1; }
+ STDMETHOD_(ULONG, Release)() { return 1; }
+ STDMETHOD(OnDeviceStateChanged)(LPCWSTR, DWORD) { noteEndpoints(false); return S_OK; }
+ STDMETHOD(OnDeviceAdded)(LPCWSTR) { noteEndpoints(false); return S_OK; }
+ STDMETHOD(OnDeviceRemoved)(LPCWSTR) { noteEndpoints(false); return S_OK; }
+ STDMETHOD(OnDefaultDeviceChanged)(EDataFlow flow, ERole role, LPCWSTR)
+ {
+ if (flow == eRender && role == eConsole) {
+ noteEndpoints(true);
+ }
+ return S_OK;
+ }
+ STDMETHOD(OnPropertyValueChanged)(LPCWSTR, const PROPERTYKEY) { return S_OK; }
+};
+EndpointWatch g_endpointWatch;
+
+// Everything XAudio2 made goes, the engine with it, under the lock. The engine stops first so no
+// voice waits out a mixer pass as it goes. A sample that was playing ends on the next service pass,
+// as one that played out does; a stream keeps its decoder and its place in the file. ponytail: a
+// buffer still queued keeps the copy of its sound (SampleData), its OnBufferEnd never coming, so a
+// lost device leaks what was playing, a few hundred KB.
+void closeOutput()
+{
+ if (g_engine.xaudio == NULL) {
+ return;
+ }
+ g_engine.xaudio->StopEngine();
+ for (size_t i = 0; i < g_engine.samples.size(); ++i) {
+ Sample *sample = g_engine.samples[i];
+ if (sample->voice != NULL) {
+ sample->voice->DestroyVoice();
+ sample->voice = NULL;
+ }
+ if (sample->head != NULL) {
+ sample->head->Release();
+ sample->head = NULL;
+ }
+ sample->started = false;
+ sample->silentEndMs = 0;
+ }
+ for (size_t i = 0; i < g_engine.retiredVoices.size(); ++i) {
+ g_engine.retiredVoices[i]->DestroyVoice();
+ }
+ g_engine.retiredVoices.clear();
+ for (size_t i = 0; i < g_engine.streams.size(); ++i) {
+ Stream *stream = g_engine.streams[i];
+ if (stream->voice != NULL) {
+ stream->voice->DestroyVoice();
+ stream->voice = NULL;
+ }
+ stream->queued.clear();
+ }
+ if (g_engine.room != NULL) {
+ g_engine.room->DestroyVoice();
+ g_engine.room = NULL;
+ g_roomTap->Release();
+ g_roomTap = NULL;
+ }
+ if (g_engine.master != NULL) {
+ g_engine.master->DestroyVoice();
+ g_engine.master = NULL;
+ }
+ g_engine.xaudio->UnregisterForCallbacks(&g_engineWatch);
+ g_engine.xaudio->Release();
+ g_engine.xaudio = NULL;
+ g_engine.masterChannels = 0;
+ g_engine.onPickedDevice = false;
+}
+
+// The engine and its master, on the endpoint AIL_ex_set_output_device picked or the default when that
+// one is not there, at the speaker type's channel count; then the room, the master's tap and a voice
+// for every stream, playing again where one was. False with no endpoint at all, the engine kept.
+// Under the lock.
+bool openOutput()
+{
+ if (g_engine.xaudio == NULL) {
+ if (FAILED(XAudio2Create(&g_engine.xaudio, 0, XAUDIO2_DEFAULT_PROCESSOR))) {
+ g_engine.xaudio = NULL;
+ return false;
+ }
+ g_engine.xaudio->RegisterForCallbacks(&g_engineWatch);
+ }
+
+ const UINT32 channels = g_speakerType == AIL_3D_71_SPEAKER ? 8
+ : (g_speakerType == AIL_3D_51_SPEAKER ? 6 : (g_speakerType == AIL_3D_4_SPEAKER ? 4 : 2));
+ g_engine.onPickedDevice = g_outputDevice[0] != 0 && SUCCEEDED(g_engine.xaudio->CreateMasteringVoice(&g_engine.master,
+ channels, XAUDIO2_DEFAULT_SAMPLERATE, 0, g_outputDevice, NULL, AudioCategory_GameEffects));
+ if (!g_engine.onPickedDevice && FAILED(g_engine.xaudio->CreateMasteringVoice(&g_engine.master,
+ channels, XAUDIO2_DEFAULT_SAMPLERATE, 0, NULL, NULL, AudioCategory_GameEffects))) {
+ g_engine.master = NULL; // this machine has no endpoint (0x80070490), or none that will open
+ return false;
+ }
+ XAUDIO2_VOICE_DETAILS masterDetails;
+ g_engine.master->GetVoiceDetails(&masterDetails);
+ g_engine.masterRate = masterDetails.InputSampleRate;
+ g_engine.masterChannels = masterDetails.InputChannels;
+ createRoom();
+ installMasterTap(NULL);
+
+ for (size_t i = 0; i < g_engine.streams.size(); ++i) {
+ Stream *stream = g_engine.streams[i];
+ voiceStream(stream);
+ if (stream->playing && !stream->paused) {
+ playStream(stream);
+ }
+ }
+ return true;
+}
+
+// Whether the output has to be made again, and if so making it, on the service thread under the
+// lock. At once for a critical error or a setting; for the endpoints moving, once they have been
+// quiet ENDPOINT_SETTLE_MS, and only when that changes something here: no output yet, the endpoint
+// picked is not the one playing, or the default moved under a game on the default.
+void serviceOutput()
+{
+ bool wanted = g_remakeOutput.exchange(false);
+ if (g_endpointsMoved.load() && GetTickCount64() - g_endpointsMovedMs.load() >= ENDPOINT_SETTLE_MS) {
+ g_endpointsMoved.store(false);
+ const bool defaultMoved = g_defaultMoved.exchange(false);
+ wanted = wanted || g_engine.master == NULL || (g_outputDevice[0] != 0 && !g_engine.onPickedDevice)
+ || (defaultMoved && !g_engine.onPickedDevice);
+ }
+ if (wanted) {
+ closeOutput();
+ openOutput();
+ }
+}
+
} // namespace
// =================================================================================================
@@ -1296,20 +1724,23 @@ S32 AILCALL AIL_quick_startup(S32 use_digital, S32, U32, S32, S32)
return 1;
}
+ // A machine with no endpoint still gets an engine and a digital driver, so the manager keeps its
+ // sounds going in silence and the next endpoint to come is heard (serviceOutput).
CoInitializeEx(NULL, COINIT_MULTITHREADED);
- if (FAILED(XAudio2Create(&g_engine.xaudio, 0, XAUDIO2_DEFAULT_PROCESSOR))) {
+ EnterCriticalSection(&g_engine.lock);
+ openOutput();
+ const bool engine = g_engine.xaudio != NULL;
+ LeaveCriticalSection(&g_engine.lock);
+ if (!engine) {
return 0;
}
- if (FAILED(g_engine.xaudio->CreateMasteringVoice(&g_engine.master))) {
- g_engine.xaudio->Release();
- g_engine.xaudio = NULL;
- return 0;
+
+ if (FAILED(CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator),
+ (void **)&g_engine.endpoints))) {
+ g_engine.endpoints = NULL; // a lost device is still heard through the critical error
+ } else {
+ g_engine.endpoints->RegisterEndpointNotificationCallback(&g_endpointWatch);
}
- XAUDIO2_VOICE_DETAILS masterDetails;
- g_engine.master->GetVoiceDetails(&masterDetails);
- g_engine.masterRate = masterDetails.InputSampleRate;
- createRoom();
- installMasterTap(NULL);
InterlockedExchange(&g_engine.serviceRunning, 1);
g_engine.serviceThread = CreateThread(NULL, 0, serviceThreadMain, NULL, 0, NULL);
@@ -1318,36 +1749,44 @@ S32 AILCALL AIL_quick_startup(S32 use_digital, S32, U32, S32, S32)
void AILCALL AIL_quick_handles(HDIGDRIVER *pdig, HMDIDRIVER *pmdi, HDLSDEVICE *pdls)
{
- // a driver only when AIL_quick_startup opened a device
- if (pdig != NULL) *pdig = g_engine.master != NULL ? DIGITAL_DRIVER : NULL;
+ // a driver whenever AIL_quick_startup made an engine, an endpoint or not
+ if (pdig != NULL) *pdig = g_engine.xaudio != NULL ? DIGITAL_DRIVER : NULL;
if (pmdi != NULL) *pmdi = NULL;
if (pdls != NULL) *pdls = NULL;
}
S32 AILCALL AIL_ex_start_capture(const char *pathname)
{
- if (g_engine.master == NULL || pathname == NULL) {
+ if (pathname == NULL || !g_engine.started) {
return 0;
}
+ EnterCriticalSection(&g_engine.lock);
FILE *file = NULL;
- if (fopen_s(&file, pathname, "wb") != 0 || file == NULL) {
- return 0;
- }
- return installMasterTap(file) ? 1 : 0;
+ const bool recording = g_engine.master != NULL && fopen_s(&file, pathname, "wb") == 0 && file != NULL
+ && installMasterTap(file);
+ LeaveCriticalSection(&g_engine.lock);
+ return recording ? 1 : 0;
}
void AILCALL AIL_ex_stop_capture(void)
{
+ if (!g_engine.started) {
+ return;
+ }
+ EnterCriticalSection(&g_engine.lock);
if (g_engine.master != NULL) {
installMasterTap(NULL);
}
+ LeaveCriticalSection(&g_engine.lock);
}
void AILCALL AIL_shutdown(void)
{
- if (g_engine.master != NULL) {
- g_engine.master->SetEffectChain(NULL);
+ if (g_engine.endpoints != NULL) {
+ g_engine.endpoints->UnregisterEndpointNotificationCallback(&g_endpointWatch);
+ g_engine.endpoints->Release();
+ g_engine.endpoints = NULL;
}
if (g_engine.serviceThread != NULL) {
@@ -1357,26 +1796,12 @@ void AILCALL AIL_shutdown(void)
g_engine.serviceThread = NULL;
}
- // whatever the service thread had not destroyed yet; the references their buffers hold go with
- // the process
- for (size_t i = 0; i < g_engine.retiredVoices.size(); ++i) {
- g_engine.retiredVoices[i]->DestroyVoice();
- }
- g_engine.retiredVoices.clear();
-
- if (g_engine.room != NULL) {
- g_engine.room->DestroyVoice();
- g_engine.room = NULL;
- g_roomTap->Release();
- g_roomTap = NULL;
- }
- if (g_engine.master != NULL) {
- g_engine.master->DestroyVoice();
- g_engine.master = NULL;
- }
- if (g_engine.xaudio != NULL) {
- g_engine.xaudio->Release();
- g_engine.xaudio = NULL;
+ // whatever the service thread had not destroyed yet, and the output; the references the
+ // retired voices' buffers hold go with the process
+ if (g_engine.started) {
+ EnterCriticalSection(&g_engine.lock);
+ closeOutput();
+ LeaveCriticalSection(&g_engine.lock);
}
if (g_engine.started) {
DeleteCriticalSection(&g_engine.lock);
@@ -1459,8 +1884,16 @@ S32 AILCALL AIL_enumerate_filters(HPROENUM *, HPROVIDER *, char **)
return 0;
}
-void AILCALL AIL_set_3D_speaker_type(HPROVIDER, S32)
+// MilesAudioManager hands down Options.ini's SpeakerType here as the device opens and whenever the
+// options menu changes it. A new one makes the output again, on the service thread.
+void AILCALL AIL_set_3D_speaker_type(HPROVIDER, S32 speaker_type)
{
+ EnterCriticalSection(&g_engine.lock);
+ if (speaker_type != g_speakerType) {
+ g_speakerType = speaker_type;
+ g_remakeOutput.store(true);
+ }
+ LeaveCriticalSection(&g_engine.lock);
}
HPROVIDER AILCALL AIL_set_sample_processor(HSAMPLE, S32, HPROVIDER provider)
@@ -1508,7 +1941,7 @@ void AILCALL AIL_release_sample_handle(HSAMPLE handle)
break;
}
}
- retireVoice(&sample->voice);
+ retireVoice(sample);
releaseSampleData(sample->data);
LeaveCriticalSection(&g_engine.lock);
delete sample;
@@ -1522,7 +1955,7 @@ void AILCALL AIL_init_sample(HSAMPLE handle)
}
EnterCriticalSection(&g_engine.lock);
- retireVoice(&sample->voice);
+ retireVoice(sample);
sample->playing = false;
sample->volume = 1.0f;
sample->pan = DEFAULT_PAN;
@@ -1540,30 +1973,38 @@ S32 AILCALL AIL_set_sample_file(HSAMPLE handle, const void *file_image, S32)
return 0;
}
+ // the sound is kept whether a voice could be made or not: with no endpoint it plays in silence,
+ // and an endpoint that comes back before the start gets it a voice there
EnterCriticalSection(&g_engine.lock);
sample->playing = false;
- const bool ready = freshVoice(sample, wave.format);
- if (ready) {
- releaseSampleData(sample->data);
- sample->data = copySampleData(wave.data, wave.dataBytes);
- sample->baseRate = wave.format.nSamplesPerSec;
- sample->rate = wave.format.nSamplesPerSec;
- refreshSampleOutput(sample);
- }
+ freshVoice(sample, wave.format);
+ releaseSampleData(sample->data);
+ sample->data = copySampleData(wave.data, wave.dataBytes);
+ sample->baseRate = wave.format.nSamplesPerSec;
+ sample->rate = wave.format.nSamplesPerSec;
+ refreshSampleOutput(sample);
LeaveCriticalSection(&g_engine.lock);
- return ready ? 1 : 0;
+ return 1;
}
void AILCALL AIL_start_sample(HSAMPLE handle)
{
Sample *sample = (Sample *)handle;
- if (sample == NULL || sample->voice == NULL || sample->data == NULL) {
+ if (sample == NULL || sample->data == NULL) {
return;
}
EnterCriticalSection(&g_engine.lock);
- // a second start of the same sound: a voice of its own again, as freshVoice says why
- if (sample->started && !freshVoice(sample, sample->format)) {
+ // a second start of the same sound, or one whose voice went with the output: a voice of its own
+ // again, as freshVoice says why
+ if (sample->started || sample->voice == NULL) {
+ freshVoice(sample, sample->format);
+ }
+ // nothing to play it on: it plays in silence for as long as it lasts, and ends the way a sound
+ // that played out does, so the manager gets its handle back
+ if (sample->voice == NULL) {
+ sample->silentEndMs = GetTickCount64() + silentLengthMs(*sample);
+ sample->playing = true;
LeaveCriticalSection(&g_engine.lock);
return;
}
@@ -1589,12 +2030,14 @@ void AILCALL AIL_start_sample(HSAMPLE handle)
void AILCALL AIL_stop_sample(HSAMPLE handle)
{
Sample *sample = (Sample *)handle;
- if (sample == NULL || sample->voice == NULL) {
+ if (sample == NULL) {
return;
}
EnterCriticalSection(&g_engine.lock);
- sample->voice->Stop(0);
+ if (sample->voice != NULL) {
+ sample->voice->Stop(0);
+ }
sample->playing = false;
LeaveCriticalSection(&g_engine.lock);
}
@@ -1814,9 +2257,18 @@ void AILCALL AIL_ex_set_3D_air(F32 speed_of_sound, F32 absorption_distance)
void AILCALL AIL_ex_set_reverb(F32 wet, F32 decay, F32 damping, F32 echo, F32 slap)
{
g_roomSend.store(wet);
+ // kept for a room made again with the output; the lock because that is when g_roomTap changes
+ if (g_engine.started) {
+ EnterCriticalSection(&g_engine.lock);
+ }
+ const RoomSettings settings = { true, decay, damping, echo, slap };
+ g_roomSettings = settings;
if (g_roomTap != NULL) {
g_roomTap->set(decay, damping, echo, slap);
}
+ if (g_engine.started) {
+ LeaveCriticalSection(&g_engine.lock);
+ }
}
void AILCALL AIL_ex_duck(H3DSAMPLE trigger, F32 gain, F32 seconds)
@@ -1838,6 +2290,76 @@ void AILCALL AIL_ex_set_3D_sample_dry(H3DSAMPLE handle, S32 dry)
LeaveCriticalSection(&g_engine.lock);
}
+// The id is IMMDevice::GetId's, as AIL_ex_enumerate_output_devices hands it out, which XAudio2 2.9
+// takes for its device id. NULL or "" is the default. WinMain calls this before AIL_startup, with
+// the saved choice, so the first output already opens on it.
+void AILCALL AIL_ex_set_output_device(const char *id)
+{
+ wchar_t wanted[OUTPUT_DEVICE_CHARS] = { 0 };
+ if (id != NULL && id[0] != 0 && MultiByteToWideChar(CP_UTF8, 0, id, -1, wanted, OUTPUT_DEVICE_CHARS) == 0) {
+ wanted[0] = 0; // longer than any endpoint id: the default
+ }
+
+ if (g_engine.started) {
+ EnterCriticalSection(&g_engine.lock);
+ }
+ if (wcscmp(wanted, g_outputDevice) != 0) {
+ wcscpy_s(g_outputDevice, OUTPUT_DEVICE_CHARS, wanted);
+ if (g_engine.xaudio != NULL) {
+ g_remakeOutput.store(true);
+ }
+ }
+ if (g_engine.started) {
+ LeaveCriticalSection(&g_engine.lock);
+ }
+}
+
+// The index-th active render endpoint: its id in UTF-8 and its friendly name ("Speakers (Realtek(R)
+// Audio)"). 0 past the last one, and on a machine with none.
+S32 AILCALL AIL_ex_enumerate_output_devices(S32 index, char *id, S32 id_bytes, U16 *name, S32 name_chars)
+{
+ // functiondiscoverykeys_devpkey.h's, spelled out: its DEFINE_PROPERTYKEY wants INITGUID somewhere
+ const PROPERTYKEY friendlyNameKey = { { 0xa45c254e, 0xdf1c, 0x4efd, { 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0 } }, 14 };
+
+ const HRESULT com = CoInitializeEx(NULL, COINIT_MULTITHREADED);
+ S32 found = 0;
+ IMMDeviceEnumerator *enumerator = NULL;
+ IMMDeviceCollection *collection = NULL;
+ IMMDevice *device = NULL;
+ IPropertyStore *properties = NULL;
+ LPWSTR deviceId = NULL;
+ PROPVARIANT friendlyName;
+ PropVariantInit(&friendlyName);
+
+ if (SUCCEEDED(CoCreateInstance(__uuidof(MMDeviceEnumerator), NULL, CLSCTX_ALL, __uuidof(IMMDeviceEnumerator),
+ (void **)&enumerator))
+ && SUCCEEDED(enumerator->EnumAudioEndpoints(eRender, DEVICE_STATE_ACTIVE, &collection))
+ && SUCCEEDED(collection->Item((UINT)index, &device))
+ && SUCCEEDED(device->GetId(&deviceId))
+ && WideCharToMultiByte(CP_UTF8, 0, deviceId, -1, id, id_bytes, NULL, NULL) != 0
+ && SUCCEEDED(device->OpenPropertyStore(STGM_READ, &properties))
+ && SUCCEEDED(properties->GetValue(friendlyNameKey, &friendlyName))
+ && friendlyName.vt == VT_LPWSTR) {
+ S32 at = 0;
+ for (; at < name_chars - 1 && friendlyName.pwszVal[at] != 0; ++at) {
+ name[at] = (U16)friendlyName.pwszVal[at];
+ }
+ name[at] = 0;
+ found = 1;
+ }
+
+ PropVariantClear(&friendlyName);
+ CoTaskMemFree(deviceId);
+ if (properties != NULL) properties->Release();
+ if (device != NULL) device->Release();
+ if (collection != NULL) collection->Release();
+ if (enumerator != NULL) enumerator->Release();
+ if (SUCCEEDED(com)) {
+ CoUninitialize();
+ }
+ return found;
+}
+
void AILCALL AIL_set_3D_sample_occlusion(H3DSAMPLE handle, F32 occlusion)
{
Sample *sample = (Sample *)handle;
@@ -1951,15 +2473,17 @@ HSTREAM AILCALL AIL_open_stream(HDIGDRIVER dig, const char *filename, S32)
return NULL;
}
+ // the file opened outside the lock, which the service thread needs every 10 ms; the voice inside
+ // it, where the output is made and unmade
Stream *stream = new Stream;
if (!openStreamDecoder(stream, filename)) {
closeStreamDecoder(stream);
- destroyVoice(&stream->voice);
delete stream;
return NULL;
}
EnterCriticalSection(&g_engine.lock);
+ voiceStream(stream);
g_engine.streams.push_back(stream);
LeaveCriticalSection(&g_engine.lock);
return (HSTREAM)stream;
@@ -1989,7 +2513,7 @@ void AILCALL AIL_close_stream(HSTREAM handle)
void AILCALL AIL_start_stream(HSTREAM handle)
{
Stream *stream = (Stream *)handle;
- if (stream == NULL || stream->voice == NULL) {
+ if (stream == NULL) {
return;
}
@@ -1997,26 +2521,26 @@ void AILCALL AIL_start_stream(HSTREAM handle)
stream->playing = true;
stream->paused = false;
stream->exhausted = false;
- stream->voice->SetVolume(clampUnit(stream->volume) * g_duck.duckNow);
- applyPan(stream->voice, stream->voiceFormat.nChannels, stream->pan);
- stream->voice->Start(0);
+ playStream(stream);
LeaveCriticalSection(&g_engine.lock);
}
void AILCALL AIL_pause_stream(HSTREAM handle, S32 onoff)
{
Stream *stream = (Stream *)handle;
- if (stream == NULL || stream->voice == NULL) {
+ if (stream == NULL) {
return;
}
EnterCriticalSection(&g_engine.lock);
stream->paused = onoff != 0;
- if (stream->paused) {
+ if (!stream->paused) {
+ stream->playing = true;
+ }
+ if (stream->voice != NULL && stream->paused) {
stream->voice->Stop(0);
- } else {
+ } else if (stream->voice != NULL) {
stream->voice->Start(0);
- stream->playing = true;
}
LeaveCriticalSection(&g_engine.lock);
}
diff --git a/GeneralsMD/Code/Main/WinMain.cpp b/GeneralsMD/Code/Main/WinMain.cpp
index 722e88b04..ee7921d22 100644
--- a/GeneralsMD/Code/Main/WinMain.cpp
+++ b/GeneralsMD/Code/Main/WinMain.cpp
@@ -622,8 +622,9 @@ LRESULT CALLBACK WndProc( HWND hWnd, UINT message,
ClipCursor( NULL );
isCursorClippedToWindow = false;
// A -wav run is heard by its file, not a person: muting it here silenced the
- // capture whenever another window took the focus.
- if (TheAudio && TheGlobalData->m_wavEndFrame <= 0)
+ // capture whenever another window took the focus. MuteInBackground off keeps it
+ // playing behind another window.
+ if (TheAudio && TheGlobalData->m_wavEndFrame <= 0 && TheGlobalData->m_muteInBackground)
TheAudio->loseFocus();
} // end if
else
@@ -1549,6 +1550,13 @@ Int APIENTRY WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance,
DEBUG_LOG(("CRC message is %d\n", GameMessage::MSG_LOGIC_CRC));
+ // The audio endpoint the options menu saved, handed to the backend before the audio device
+ // opens on the default: "" or a device that is gone plays on the default.
+ const size_t AUDIO_DEVICE_ID_BYTES = 256; // an MMDevice id is about 55
+ char savedAudioDevice[AUDIO_DEVICE_ID_BYTES];
+ findEarlyOptionValue( "AudioDevice", savedAudioDevice, sizeof( savedAudioDevice ) );
+ AIL_ex_set_output_device( savedAudioDevice );
+
// run the game main loop
GameMain(argc, argv);
diff --git a/GeneralsMD/Code/Tests/test_miles_effects.cpp b/GeneralsMD/Code/Tests/test_miles_effects.cpp
index 943fc45e6..7b8cf6fc0 100644
--- a/GeneralsMD/Code/Tests/test_miles_effects.cpp
+++ b/GeneralsMD/Code/Tests/test_miles_effects.cpp
@@ -351,3 +351,53 @@ TEST(a_loud_mix_never_reaches_full_scale)
CHECK(capture.peak > AIL_EX_LIMITER_CEILING - 0.05);
CHECK(rms(capture, 1.1, 1.2) < 0.0002);
}
+
+TEST(headphones_hear_a_sound_on_the_right_later_quieter_and_duller_in_the_left_ear)
+{
+ // MSS.h's ears alone, both backends' code. A click straight to the right of a listener facing +y
+ // (right is up x face, -x here, as the test above places its tones): Woodworth's 0.66 ms is 31.6
+ // frames at 48 kHz, and the far ear's shadow both lowers and spreads what arrives.
+ const float RATE = 48000.0f;
+ const int FRAMES = 96;
+ float side = 0.0f;
+ float front = 0.0f;
+ AIL_ex_3D_bearing(-10.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, &side, &front);
+ CHECK_NEAR(side, 1.0f, 0.0001f);
+ CHECK_NEAR(front, 0.0f, 0.0001f);
+
+ AIL_EX_HRTF_TARGET ears;
+ AIL_ex_hrtf_target(side, front, RATE, &ears);
+ CHECK_NEAR(ears.delay[0], AIL_EX_HRTF_HEAD_SECONDS * (TONE_PI / 2.0 + 1.0) * RATE, 0.01);
+ CHECK_EQ(ears.delay[1], 0.0f);
+ CHECK(ears.gain[0] < ears.gain[1]);
+ CHECK(ears.coefficient[0] < ears.coefficient[1]);
+
+ float click[FRAMES] = { 1.0f };
+ float heard[FRAMES * 2];
+ AIL_EX_HRTF head;
+ AIL_ex_hrtf_reset(&head);
+ AIL_ex_hrtf_process(&head, &ears, click, heard, FRAMES);
+
+ int loudest[2] = { 0, 0 };
+ float leftSum = 0.0f;
+ float rightSum = 0.0f;
+ for (int frame = 0; frame < FRAMES; ++frame) {
+ for (int ear = 0; ear < 2; ++ear) {
+ if (fabsf(heard[frame * 2 + ear]) > fabsf(heard[loudest[ear] * 2 + ear])) {
+ loudest[ear] = frame;
+ }
+ }
+ leftSum += heard[frame * 2];
+ rightSum += heard[frame * 2 + 1];
+ }
+ CHECK(loudest[1] <= 1);
+ CHECK(loudest[0] >= 31);
+ CHECK(fabsf(heard[30 * 2]) < 1e-6f); // nothing reaches the left ear before the delay
+ CHECK(leftSum < rightSum);
+
+ // straight ahead the two ears are one: no delay, the stereo pan's centre gain
+ AIL_ex_hrtf_target(0.0f, 1.0f, RATE, &ears);
+ CHECK_EQ(ears.delay[0], ears.delay[1]);
+ CHECK_NEAR(ears.gain[0], AIL_EX_HRTF_CENTRE, 0.0001f);
+ CHECK_NEAR(ears.gain[1], AIL_EX_HRTF_CENTRE, 0.0001f);
+}
diff --git a/GeneralsMD/Code/Tools/optionsmenu_layout.py b/GeneralsMD/Code/Tools/optionsmenu_layout.py
index acdf83d8e..30ad1dde3 100644
--- a/GeneralsMD/Code/Tools/optionsmenu_layout.py
+++ b/GeneralsMD/Code/Tools/optionsmenu_layout.py
@@ -122,9 +122,10 @@ ADVANCED_KEEP = GRAPHICS_CHECKS + ["CheckUnlockFPS", "LowResSlider", "ParticleCa
# swaying trees are a GameLOD.ini field like the popup's boxes, so they save under Custom with them.
MENU_CHECKS = ["CheckTreeSway"]
-# Combo boxes OptionsMenu.cpp fills in by name for the same reason: the monitors on the desktop are
-# not a range a catalog row can describe.
-MENU_COMBOS = ["ComboBoxMonitor"]
+# Combo boxes OptionsMenu.cpp fills in by name for the same reason: the monitors on the desktop and
+# the audio endpoints are not a range a catalog row can describe, and the speaker setup is EA's
+# SpeakerType string in Options.ini, which the audio manager reads itself.
+MENU_COMBOS = ["ComboBoxMonitor", "ComboBoxSpeakerType", "ComboBoxAudioDevice"]
# The catalog's shadow rows, which stood in GameData.ini with no control until the Effects page.
SHADOW_CHECKS = ["Check3DShadows", "Check2DShadows", "CheckCloudShadows", "CheckInfantryShadows",
@@ -210,6 +211,11 @@ NEW_CONTROLS = [
(LABEL, "LabelMasterVolume", "GUI:MasterVolume"),
(SLIDER, "SliderMasterVolume", None),
(CHECK, "CheckDynamicMusic", "GUI:DynamicMusic"),
+ (LABEL, "LabelAudioDevice", "GUI:AudioDevice"),
+ (COMBO, "ComboBoxAudioDevice", None),
+ (LABEL, "LabelSpeakerType", "GUI:SpeakerType"),
+ (COMBO, "ComboBoxSpeakerType", None),
+ (CHECK, "CheckMuteInBackground", "GUI:MuteInBackground"),
(LABEL, "LabelZoomSpeed", "GUI:ZoomSpeed"),
(SLIDER, "SliderZoomSpeed", None),
(LABEL, "LabelShadowQuality", "GUI:ShadowQuality"),
@@ -387,7 +393,11 @@ GROUP_LAYOUT = [
setting("LabelAmbientVolume", "SliderAmbientVolume", "ValueAmbientVolume")]),
("GUI:OptionsGroupMusic", [
setting("MusicVolumeLabel", "SliderMusicVolume", "ValueMusicVolume"),
- ("check", "CheckDynamicMusic")])]),
+ ("check", "CheckDynamicMusic")]),
+ ("GUI:OptionsGroupOutput", [
+ setting("LabelAudioDevice", "ComboBoxAudioDevice"),
+ setting("LabelSpeakerType", "ComboBoxSpeakerType"),
+ ("check", "CheckMuteInBackground")])]),
("PageControls", [
("GUI:OptionsGroupCamera", [