Skip to content

Commit 72de682

Browse files
committed
-sound/wasapi_sound.cpp: Added preliminary WASAPI sound module (not enabled yet).
-sound/xaudio2_sound.cpp: More fixes: * Fixed a couple more potential deadlocks when handling critical engine errors. * Better tracking of the default device when devices are reconfigured.
1 parent 282aa82 commit 72de682

File tree

4 files changed

+1603
-98
lines changed

4 files changed

+1603
-98
lines changed

scripts/src/osd/modules.lua

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ function osdmodulesbuild()
141141
MAME_DIR .. "src/osd/modules/sound/sdl_sound.cpp",
142142
MAME_DIR .. "src/osd/modules/sound/sound_module.cpp",
143143
MAME_DIR .. "src/osd/modules/sound/sound_module.h",
144+
MAME_DIR .. "src/osd/modules/sound/wasapi_sound.cpp",
144145
MAME_DIR .. "src/osd/modules/sound/xaudio2_sound.cpp",
145146
}
146147
includedirs {

src/osd/modules/sound/mmdevice_helpers.cpp

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,7 @@ HRESULT populate_audio_node_info(
8686
result = device.GetId(&id_raw);
8787
if (FAILED(result) || !id_raw)
8888
{
89-
osd_printf_error(
90-
"Error getting ID for audio device. Error: 0x%X\n",
91-
static_cast<unsigned int>(result));
89+
osd_printf_error("Error getting ID for audio device. Error: 0x%X\n", result);
9290
return FAILED(result) ? result : E_POINTER;
9391
}
9492
device_id_w.reset(std::exchange(id_raw, nullptr));
@@ -110,7 +108,7 @@ HRESULT populate_audio_node_info(
110108
osd_printf_error(
111109
"Error opening property store for audio device %s. Error: 0x%X\n",
112110
id_string,
113-
static_cast<unsigned int>(result));
111+
result);
114112
return FAILED(result) ? result : E_POINTER;
115113
}
116114

@@ -125,7 +123,7 @@ HRESULT populate_audio_node_info(
125123
osd_printf_error(
126124
"Error getting display name for audio device %s. Error: 0x%X\n",
127125
id_string,
128-
static_cast<unsigned int>(result));
126+
result);
129127
try
130128
{
131129
device_name = id_string;
@@ -151,7 +149,7 @@ HRESULT populate_audio_node_info(
151149
osd_printf_error(
152150
"Error getting endpoint information for audio device %s. Error: 0x%X\n",
153151
device_name,
154-
static_cast<unsigned int>(result));
152+
result);
155153
return FAILED(result) ? result : E_POINTER;
156154
}
157155

@@ -161,7 +159,7 @@ HRESULT populate_audio_node_info(
161159
osd_printf_error(
162160
"Error getting data flow direction for audio device %s. Error: 0x%X\n",
163161
device_name,
164-
static_cast<unsigned int>(result));
162+
result);
165163
return result;
166164
}
167165

@@ -183,7 +181,7 @@ HRESULT populate_audio_node_info(
183181
osd_printf_error(
184182
"Error getting stream format for audio device %s. Error: 0x%X\n",
185183
device_name,
186-
static_cast<unsigned int>(result));
184+
result);
187185
return result;
188186
}
189187
else if (VT_BLOB != format_property.value.vt)
@@ -210,7 +208,7 @@ HRESULT populate_audio_node_info(
210208
osd_printf_error(
211209
"Error getting speaker arrangement for audio device %s. Error: 0x%X\n",
212210
device_name,
213-
static_cast<unsigned int>(result));
211+
result);
214212
}
215213
else switch (speakers_property.value.vt)
216214
{
@@ -263,7 +261,7 @@ HRESULT populate_audio_node_info(
263261
channel_names.emplace_back(util::string_format("Channel %u", i + 1));
264262
++i;
265263
}
266-
channel_positions.resize(format->nChannels, std::array<double, 3>{ 0.0, 0.0, 0.0 });
264+
channel_positions.resize(format->nChannels, std::array<double, 3>{ 0.0, 0.0, 1.0 });
267265
}
268266
catch (std::bad_alloc const &)
269267
{

0 commit comments

Comments
 (0)