mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-19 19:15:26 +00:00
Merge branch 'RPCS3:master' into uruntime
This commit is contained in:
commit
dd9ee6098c
12 changed files with 228 additions and 118 deletions
2
3rdparty/SoundTouch/soundtouch
vendored
2
3rdparty/SoundTouch/soundtouch
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 394e1f58b23dc80599214d2e9b6a5e0dfd0bbe07
|
||||
Subproject commit 3982730833b6daefe77dcfb32b5c282851640c17
|
2
3rdparty/curl/curl
vendored
2
3rdparty/curl/curl
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 57495c64871d18905a0941db9196ef90bafe9a29
|
||||
Subproject commit 1c3149881769e7bd79b072e48374e4c2b3678b2f
|
14
3rdparty/curl/libcurl.vcxproj
vendored
14
3rdparty/curl/libcurl.vcxproj
vendored
|
@ -76,6 +76,7 @@
|
|||
<ClCompile Include="curl\lib\connect.c" />
|
||||
<ClCompile Include="curl\lib\content_encoding.c" />
|
||||
<ClCompile Include="curl\lib\cookie.c" />
|
||||
<ClCompile Include="curl\lib\cshutdn.c" />
|
||||
<ClCompile Include="curl\lib\curl_addrinfo.c" />
|
||||
<ClCompile Include="curl\lib\curl_des.c" />
|
||||
<ClCompile Include="curl\lib\curl_endian.c" />
|
||||
|
@ -94,7 +95,9 @@
|
|||
<ClCompile Include="curl\lib\curl_threads.c" />
|
||||
<ClCompile Include="curl\lib\curl_trc.c" />
|
||||
<ClCompile Include="curl\lib\cw-out.c" />
|
||||
<ClCompile Include="curl\lib\cw-pause.c" />
|
||||
<ClCompile Include="curl\lib\dict.c" />
|
||||
<ClCompile Include="curl\lib\dllmain.c" />
|
||||
<ClCompile Include="curl\lib\doh.c" />
|
||||
<ClCompile Include="curl\lib\dynbuf.c" />
|
||||
<ClCompile Include="curl\lib\dynhds.c" />
|
||||
|
@ -112,6 +115,7 @@
|
|||
<ClCompile Include="curl\lib\getinfo.c" />
|
||||
<ClCompile Include="curl\lib\gopher.c" />
|
||||
<ClCompile Include="curl\lib\hash.c" />
|
||||
<ClCompile Include="curl\lib\hash_offt.c" />
|
||||
<ClCompile Include="curl\lib\headers.c" />
|
||||
<ClCompile Include="curl\lib\hmac.c" />
|
||||
<ClCompile Include="curl\lib\hostasyn.c" />
|
||||
|
@ -138,6 +142,7 @@
|
|||
<ClCompile Include="curl\lib\krb5.c" />
|
||||
<ClCompile Include="curl\lib\ldap.c" />
|
||||
<ClCompile Include="curl\lib\llist.c" />
|
||||
<ClCompile Include="curl\lib\macos.c" />
|
||||
<ClCompile Include="curl\lib\md4.c" />
|
||||
<ClCompile Include="curl\lib\md5.c" />
|
||||
<ClCompile Include="curl\lib\memdebug.c" />
|
||||
|
@ -145,6 +150,7 @@
|
|||
<ClCompile Include="curl\lib\mprintf.c" />
|
||||
<ClCompile Include="curl\lib\mqtt.c" />
|
||||
<ClCompile Include="curl\lib\multi.c" />
|
||||
<ClCompile Include="curl\lib\multi_ev.c" />
|
||||
<ClCompile Include="curl\lib\netrc.c" />
|
||||
<ClCompile Include="curl\lib\nonblock.c" />
|
||||
<ClCompile Include="curl\lib\noproxy.c" />
|
||||
|
@ -174,10 +180,9 @@
|
|||
<ClCompile Include="curl\lib\splay.c" />
|
||||
<ClCompile Include="curl\lib\strcase.c" />
|
||||
<ClCompile Include="curl\lib\strdup.c" />
|
||||
<ClCompile Include="curl\lib\strequal.c" />
|
||||
<ClCompile Include="curl\lib\strerror.c" />
|
||||
<ClCompile Include="curl\lib\strparse.c" />
|
||||
<ClCompile Include="curl\lib\strtok.c" />
|
||||
<ClCompile Include="curl\lib\strtoofft.c" />
|
||||
<ClCompile Include="curl\lib\system_win32.c" />
|
||||
<ClCompile Include="curl\lib\telnet.c" />
|
||||
<ClCompile Include="curl\lib\tftp.c" />
|
||||
|
@ -260,6 +265,7 @@
|
|||
<ClInclude Include="curl\lib\connect.h" />
|
||||
<ClInclude Include="curl\lib\content_encoding.h" />
|
||||
<ClInclude Include="curl\lib\cookie.h" />
|
||||
<ClInclude Include="curl\lib\cshutdn.h" />
|
||||
<ClInclude Include="curl\lib\curlx.h" />
|
||||
<ClInclude Include="curl\lib\curl_addrinfo.h" />
|
||||
<ClInclude Include="curl\lib\curl_base64.h" />
|
||||
|
@ -291,6 +297,7 @@
|
|||
<ClInclude Include="curl\lib\curl_threads.h" />
|
||||
<ClInclude Include="curl\lib\curl_trc.h" />
|
||||
<ClInclude Include="curl\lib\cw-out.h" />
|
||||
<ClInclude Include="curl\lib\cw-pause.h" />
|
||||
<ClInclude Include="curl\lib\dict.h" />
|
||||
<ClInclude Include="curl\lib\doh.h" />
|
||||
<ClInclude Include="curl\lib\dynbuf.h" />
|
||||
|
@ -309,6 +316,7 @@
|
|||
<ClInclude Include="curl\lib\getinfo.h" />
|
||||
<ClInclude Include="curl\lib\gopher.h" />
|
||||
<ClInclude Include="curl\lib\hash.h" />
|
||||
<ClInclude Include="curl\lib\hash_offt.h" />
|
||||
<ClInclude Include="curl\lib\headers.h" />
|
||||
<ClInclude Include="curl\lib\hostip.h" />
|
||||
<ClInclude Include="curl\lib\hsts.h" />
|
||||
|
@ -328,11 +336,13 @@
|
|||
<ClInclude Include="curl\lib\inet_ntop.h" />
|
||||
<ClInclude Include="curl\lib\inet_pton.h" />
|
||||
<ClInclude Include="curl\lib\llist.h" />
|
||||
<ClInclude Include="curl\lib\macos.h" />
|
||||
<ClInclude Include="curl\lib\memdebug.h" />
|
||||
<ClInclude Include="curl\lib\mime.h" />
|
||||
<ClInclude Include="curl\lib\mqtt.h" />
|
||||
<ClInclude Include="curl\lib\multihandle.h" />
|
||||
<ClInclude Include="curl\lib\multiif.h" />
|
||||
<ClInclude Include="curl\lib\multi_ev.h" />
|
||||
<ClInclude Include="curl\lib\netrc.h" />
|
||||
<ClInclude Include="curl\lib\nonblock.h" />
|
||||
<ClInclude Include="curl\lib\noproxy.h" />
|
||||
|
|
42
3rdparty/curl/libcurl.vcxproj.filters
vendored
42
3rdparty/curl/libcurl.vcxproj.filters
vendored
|
@ -291,12 +291,6 @@
|
|||
<ClCompile Include="curl\lib\strerror.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\strtok.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\strtoofft.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\system_win32.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
|
@ -522,6 +516,27 @@
|
|||
<ClCompile Include="curl\lib\vtls\vtls_spack.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\cshutdn.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\cw-pause.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\dllmain.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\hash_offt.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\macos.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\multi_ev.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="curl\lib\strequal.c">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="curl\include\curl\curl.h">
|
||||
|
@ -1055,6 +1070,21 @@
|
|||
<ClInclude Include="curl\lib\vtls\vtls_spack.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\cshutdn.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\cw-pause.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\hash_offt.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\macos.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="curl\lib\multi_ev.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="curl\lib\libcurl.rc">
|
||||
|
|
|
@ -75,7 +75,7 @@ struct CellAudioInDeviceInfo
|
|||
u8 reserved[12];
|
||||
be_t<u64> deviceId;
|
||||
be_t<u64> type;
|
||||
char name[64];
|
||||
char name[64]; // Not necessarily null terminated!
|
||||
CellAudioInSoundMode availableModes[16];
|
||||
};
|
||||
|
||||
|
|
|
@ -38,11 +38,17 @@ void fmt_class_string<CellAudioInError>::format(std::string& out, u64 arg)
|
|||
struct avconf_manager
|
||||
{
|
||||
shared_mutex mutex;
|
||||
std::vector<CellAudioInDeviceInfo> devices;
|
||||
|
||||
struct device_info
|
||||
{
|
||||
CellAudioInDeviceInfo info {};
|
||||
std::string full_device_name; // The device name may be too long for CellAudioInDeviceInfo, so we additionally save the full name.
|
||||
};
|
||||
std::vector<device_info> devices;
|
||||
CellAudioInDeviceMode inDeviceMode = CELL_AUDIO_IN_SINGLE_DEVICE_MODE; // TODO: use somewhere
|
||||
|
||||
void copy_device_info(u32 num, vm::ptr<CellAudioInDeviceInfo> info) const;
|
||||
std::optional<CellAudioInDeviceInfo> get_device_info(vm::cptr<char> name) const;
|
||||
std::optional<device_info> get_device_info(vm::cptr<char> name) const;
|
||||
|
||||
avconf_manager();
|
||||
|
||||
|
@ -62,78 +68,89 @@ avconf_manager::avconf_manager()
|
|||
switch (g_cfg.audio.microphone_type)
|
||||
{
|
||||
case microphone_handler::standard:
|
||||
{
|
||||
for (u32 index = 0; index < mic_list.size(); index++)
|
||||
{
|
||||
devices.emplace_back();
|
||||
|
||||
devices[curindex].portType = CELL_AUDIO_IN_PORT_USB;
|
||||
devices[curindex].availableModeCount = 1;
|
||||
devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
devices[curindex].deviceId = 0xE11CC0DE + curindex;
|
||||
devices[curindex].type = 0xC0DEE11C;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, mic_list[index]);
|
||||
device_info device {};
|
||||
device.info.portType = CELL_AUDIO_IN_PORT_USB;
|
||||
device.info.availableModeCount = 1;
|
||||
device.info.state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
device.info.deviceId = 0xE11CC0DE + curindex;
|
||||
device.info.type = 0xC0DEE11C;
|
||||
device.info.availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
device.info.availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2;
|
||||
device.info.availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
device.info.deviceNumber = curindex;
|
||||
device.full_device_name = mic_list[index];
|
||||
strcpy_trunc(device.info.name, device.full_device_name);
|
||||
|
||||
devices.push_back(std::move(device));
|
||||
curindex++;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case microphone_handler::real_singstar:
|
||||
case microphone_handler::singstar:
|
||||
{
|
||||
// Only one device for singstar device
|
||||
devices.emplace_back();
|
||||
|
||||
devices[curindex].portType = CELL_AUDIO_IN_PORT_USB;
|
||||
devices[curindex].availableModeCount = 1;
|
||||
devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
devices[curindex].deviceId = 0x00000001;
|
||||
devices[curindex].type = 0x14150000;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, mic_list[0]);
|
||||
device_info device {};
|
||||
device.info.portType = CELL_AUDIO_IN_PORT_USB;
|
||||
device.info.availableModeCount = 1;
|
||||
device.info.state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
device.info.deviceId = 0x00000001;
|
||||
device.info.type = 0x14150000;
|
||||
device.info.availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
device.info.availableModes[0].channel = CELL_AUDIO_IN_CHNUM_2;
|
||||
device.info.availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
device.info.deviceNumber = curindex;
|
||||
device.full_device_name = mic_list[0];
|
||||
strcpy_trunc(device.info.name, device.full_device_name);
|
||||
|
||||
devices.push_back(std::move(device));
|
||||
curindex++;
|
||||
break;
|
||||
}
|
||||
case microphone_handler::rocksmith:
|
||||
devices.emplace_back();
|
||||
|
||||
devices[curindex].portType = CELL_AUDIO_IN_PORT_USB;
|
||||
devices[curindex].availableModeCount = 1;
|
||||
devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
devices[curindex].deviceId = 0x12BA00FF; // Specific to rocksmith usb input
|
||||
devices[curindex].type = 0xC0DE73C4;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_1;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, mic_list[0]);
|
||||
{
|
||||
device_info device {};
|
||||
device.info.portType = CELL_AUDIO_IN_PORT_USB;
|
||||
device.info.availableModeCount = 1;
|
||||
device.info.state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
device.info.deviceId = 0x12BA00FF; // Specific to rocksmith usb input
|
||||
device.info.type = 0xC0DE73C4;
|
||||
device.info.availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
device.info.availableModes[0].channel = CELL_AUDIO_IN_CHNUM_1;
|
||||
device.info.availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
device.info.deviceNumber = curindex;
|
||||
device.full_device_name = mic_list[0];
|
||||
strcpy_trunc(device.info.name, device.full_device_name);
|
||||
|
||||
devices.push_back(std::move(device));
|
||||
curindex++;
|
||||
break;
|
||||
}
|
||||
case microphone_handler::null:
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (g_cfg.io.camera != camera_handler::null)
|
||||
{
|
||||
devices.emplace_back();
|
||||
|
||||
devices[curindex].portType = CELL_AUDIO_IN_PORT_USB;
|
||||
devices[curindex].availableModeCount = 1;
|
||||
devices[curindex].state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
devices[curindex].deviceId = 0xDEADBEEF;
|
||||
devices[curindex].type = 0xBEEFDEAD;
|
||||
devices[curindex].availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
devices[curindex].availableModes[0].channel = CELL_AUDIO_IN_CHNUM_NONE;
|
||||
devices[curindex].availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
devices[curindex].deviceNumber = curindex;
|
||||
strcpy_trunc(devices[curindex].name, "USB Camera");
|
||||
device_info device {};
|
||||
device.info.portType = CELL_AUDIO_IN_PORT_USB;
|
||||
device.info.availableModeCount = 1;
|
||||
device.info.state = CELL_AUDIO_IN_DEVICE_STATE_AVAILABLE;
|
||||
device.info.deviceId = 0xDEADBEEF;
|
||||
device.info.type = 0xBEEFDEAD;
|
||||
device.info.availableModes[0].type = CELL_AUDIO_IN_CODING_TYPE_LPCM;
|
||||
device.info.availableModes[0].channel = CELL_AUDIO_IN_CHNUM_NONE;
|
||||
device.info.availableModes[0].fs = CELL_AUDIO_IN_FS_8KHZ | CELL_AUDIO_IN_FS_12KHZ | CELL_AUDIO_IN_FS_16KHZ | CELL_AUDIO_IN_FS_24KHZ | CELL_AUDIO_IN_FS_32KHZ | CELL_AUDIO_IN_FS_48KHZ;
|
||||
device.info.deviceNumber = curindex;
|
||||
device.full_device_name = "USB Camera";
|
||||
strcpy_trunc(device.info.name, device.full_device_name);
|
||||
|
||||
devices.push_back(std::move(device));
|
||||
curindex++;
|
||||
}
|
||||
}
|
||||
|
@ -142,14 +159,14 @@ void avconf_manager::copy_device_info(u32 num, vm::ptr<CellAudioInDeviceInfo> in
|
|||
{
|
||||
memset(info.get_ptr(), 0, sizeof(CellAudioInDeviceInfo));
|
||||
ensure(num < devices.size());
|
||||
*info = devices[num];
|
||||
*info = devices[num].info;
|
||||
}
|
||||
|
||||
std::optional<CellAudioInDeviceInfo> avconf_manager::get_device_info(vm::cptr<char> name) const
|
||||
std::optional<avconf_manager::device_info> avconf_manager::get_device_info(vm::cptr<char> name) const
|
||||
{
|
||||
for (const CellAudioInDeviceInfo& device : devices)
|
||||
for (const device_info& device : devices)
|
||||
{
|
||||
if (strncmp(device.name, name.get_ptr(), sizeof(device.name)) == 0)
|
||||
if (strncmp(device.info.name, name.get_ptr(), sizeof(device.info.name)) == 0)
|
||||
{
|
||||
return device;
|
||||
}
|
||||
|
@ -398,8 +415,8 @@ error_code cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::pt
|
|||
auto& av_manager = g_fxo->get<avconf_manager>();
|
||||
const std::lock_guard lock(av_manager.mutex);
|
||||
|
||||
std::optional<CellAudioInDeviceInfo> info = av_manager.get_device_info(name);
|
||||
if (!info || !memchr(info->name, '\0', sizeof(info->name)))
|
||||
std::optional<avconf_manager::device_info> device = av_manager.get_device_info(name);
|
||||
if (!device)
|
||||
{
|
||||
// TODO
|
||||
return CELL_AUDIO_IN_ERROR_DEVICE_NOT_FOUND;
|
||||
|
@ -407,7 +424,7 @@ error_code cellAudioInRegisterDevice(u64 deviceType, vm::cptr<char> name, vm::pt
|
|||
|
||||
auto& mic_thr = g_fxo->get<mic_thread>();
|
||||
const std::lock_guard mic_lock(mic_thr.mutex);
|
||||
const u32 device_number = mic_thr.register_device(info->name);
|
||||
const u32 device_number = mic_thr.register_device(device->full_device_name);
|
||||
|
||||
return not_an_error(device_number);
|
||||
}
|
||||
|
|
|
@ -322,6 +322,8 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
num_channels = channels;
|
||||
|
||||
#ifndef WITHOUT_OPENAL
|
||||
enumerate_devices();
|
||||
|
||||
// Adjust number of channels depending on microphone type
|
||||
switch (device_type)
|
||||
{
|
||||
|
@ -423,36 +425,40 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
break;
|
||||
}
|
||||
|
||||
ALCdevice* device = nullptr;
|
||||
|
||||
// Make sure we use a proper sampling rate
|
||||
const auto fixup_samplingrate = [this](u32& rate) -> bool
|
||||
// TODO: The used sample rate may vary for Sony's camera devices
|
||||
const std::array<u32, 7> samplingrates = { raw_samplingrate, 48000u, 32000u, 24000u, 16000u, 12000u, 8000u };
|
||||
|
||||
for (u32 samplingrate : samplingrates)
|
||||
{
|
||||
// TODO: The used sample rate may vary for Sony's camera devices
|
||||
const std::array<u32, 7> samplingrates = { rate, 48000u, 32000u, 24000u, 16000u, 12000u, 8000u };
|
||||
|
||||
const auto test_samplingrate = [&samplingrates](const u32& rate)
|
||||
if (!std::any_of(samplingrates.cbegin() + 1, samplingrates.cend(), [samplingrate](u32 r){ return r == samplingrate; }))
|
||||
{
|
||||
// TODO: actually check if device supports sampling rates
|
||||
return std::any_of(samplingrates.cbegin() + 1, samplingrates.cend(), [&rate](const u32& r){ return r == rate; });
|
||||
};
|
||||
|
||||
for (u32 samplingrate : samplingrates)
|
||||
{
|
||||
if (test_samplingrate(samplingrate))
|
||||
{
|
||||
// Use this sampling rate
|
||||
raw_samplingrate = samplingrate;
|
||||
cellMic.notice("Using sampling rate %d.", samplingrate);
|
||||
return true;
|
||||
}
|
||||
|
||||
cellMic.warning("Requested sampling rate %d, but we do not support it. Trying next sampling rate...", samplingrate);
|
||||
continue;
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
cellMic.notice("Trying sampling rate %d with %d channel(s)", samplingrate, num_channels);
|
||||
|
||||
if (!fixup_samplingrate(raw_samplingrate))
|
||||
device = open_device(devices[0].name, samplingrate, num_al_channels, inbuf_size);
|
||||
if (!device)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Use this sampling rate
|
||||
raw_samplingrate = samplingrate;
|
||||
cellMic.notice("Using sampling rate %d and %d channel(s)", raw_samplingrate, num_channels);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!device)
|
||||
{
|
||||
cellMic.error("Failed to open capture device '%s' (raw_samplingrate=%d, num_al_channels=0x%x, inbuf_size=%d)", devices[0].name, raw_samplingrate, num_al_channels, inbuf_size);
|
||||
#ifdef _WIN32
|
||||
cellMic.error("Make sure microphone use is authorized under \"Microphone privacy settings\" in windows configuration");
|
||||
#endif
|
||||
return CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
|
@ -460,29 +466,19 @@ error_code microphone_device::open_microphone(const u8 type, const u32 dsp_r, co
|
|||
|
||||
ensure(!devices.empty());
|
||||
|
||||
ALCdevice* device = alcCaptureOpenDevice(devices[0].name.c_str(), raw_samplingrate, num_al_channels, inbuf_size);
|
||||
|
||||
if (ALCenum err = alcGetError(device); err != ALC_NO_ERROR || !device)
|
||||
{
|
||||
cellMic.error("Error opening capture device %s (error=%s, device=*0x%x)", devices[0].name, fmt::alc_error{device, err}, device);
|
||||
#ifdef _WIN32
|
||||
cellMic.error("Make sure microphone use is authorized under \"Microphone privacy settings\" in windows configuration");
|
||||
#endif
|
||||
return CELL_MICIN_ERROR_DEVICE_NOT_SUPPORT;
|
||||
}
|
||||
|
||||
devices[0].device = device;
|
||||
devices[0].buf.resize(inbuf_size, 0);
|
||||
|
||||
if (device_type == microphone_handler::singstar && devices.size() >= 2)
|
||||
{
|
||||
// Open a 2nd microphone into the same device
|
||||
device = alcCaptureOpenDevice(devices[1].name.c_str(), raw_samplingrate, AL_FORMAT_MONO16, inbuf_size);
|
||||
num_al_channels = AL_FORMAT_MONO16;
|
||||
device = open_device(devices[1].name, raw_samplingrate, num_al_channels, inbuf_size);
|
||||
|
||||
if (ALCenum err = alcGetError(device); err != ALC_NO_ERROR || !device)
|
||||
if (!device)
|
||||
{
|
||||
// Ignore it and move on
|
||||
cellMic.error("Error opening 2nd SingStar capture device %s (error=%s, device=*0x%x)", devices[1].name, fmt::alc_error{device, err}, device);
|
||||
cellMic.error("Failed to open 2nd SingStar capture device '%s' (raw_samplingrate=%d, num_al_channels=0x%x, inbuf_size=%d)", devices[1].name, raw_samplingrate, num_al_channels, inbuf_size);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -517,7 +513,7 @@ error_code microphone_device::close_microphone()
|
|||
{
|
||||
if (alcCaptureCloseDevice(micdevice.device) != ALC_TRUE)
|
||||
{
|
||||
cellMic.error("Error closing capture device %s", micdevice.name);
|
||||
cellMic.error("Error closing capture device '%s'", micdevice.name);
|
||||
}
|
||||
|
||||
micdevice.device = nullptr;
|
||||
|
@ -539,7 +535,7 @@ error_code microphone_device::start_microphone()
|
|||
alcCaptureStart(micdevice.device);
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error starting capture of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error starting capture of device '%s' (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
stop_microphone();
|
||||
return CELL_MICIN_ERROR_FATAL;
|
||||
}
|
||||
|
@ -558,7 +554,7 @@ error_code microphone_device::stop_microphone()
|
|||
alcCaptureStop(micdevice.device);
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error stopping capture of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error stopping capture of device '%s' (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -637,7 +633,7 @@ u32 microphone_device::capture_audio()
|
|||
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error getting number of captured samples of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error getting number of captured samples of device '%s' (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
return CELL_MICIN_ERROR_FATAL;
|
||||
}
|
||||
|
||||
|
@ -655,7 +651,7 @@ u32 microphone_device::capture_audio()
|
|||
|
||||
if (ALCenum err = alcGetError(micdevice.device); err != ALC_NO_ERROR)
|
||||
{
|
||||
cellMic.error("Error capturing samples of device %s (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
cellMic.error("Error capturing samples of device '%s' (error=%s)", micdevice.name, fmt::alc_error{micdevice.device, err});
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -667,6 +663,56 @@ u32 microphone_device::capture_audio()
|
|||
|
||||
// Private functions
|
||||
|
||||
#ifndef WITHOUT_OPENAL
|
||||
void microphone_device::enumerate_devices()
|
||||
{
|
||||
cellMic.notice("Enumerating capture devices...");
|
||||
enumerated_devices.clear();
|
||||
|
||||
if (alcIsExtensionPresent(nullptr, "ALC_ENUMERATION_EXT") == AL_TRUE)
|
||||
{
|
||||
if (const char* alc_devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER))
|
||||
{
|
||||
while (alc_devices && *alc_devices != 0)
|
||||
{
|
||||
cellMic.notice("Found capture device: '%s'", alc_devices);
|
||||
enumerated_devices.push_back(alc_devices);
|
||||
alc_devices += strlen(alc_devices) + 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// Without enumeration we can only use one device
|
||||
cellMic.error("OpenAl extension ALC_ENUMERATION_EXT not supported. The enumerated capture devices will only contain the default capture device.");
|
||||
|
||||
if (const char* alc_device = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER))
|
||||
{
|
||||
cellMic.notice("Found default capture device: '%s'", alc_device);
|
||||
enumerated_devices.push_back(alc_device);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ALCdevice* microphone_device::open_device(const std::string& name, u32 samplingrate, ALCenum num_al_channels, u32 buf_size)
|
||||
{
|
||||
if (std::none_of(enumerated_devices.cbegin(), enumerated_devices.cend(), [&name](const std::string& dev){ return dev == name; }))
|
||||
{
|
||||
cellMic.error("Capture device '%s' not in enumerated devices", name);
|
||||
}
|
||||
|
||||
ALCdevice* device = alcCaptureOpenDevice(name.c_str(), samplingrate, num_al_channels, buf_size);
|
||||
|
||||
if (ALCenum err = alcGetError(device); err != ALC_NO_ERROR || !device)
|
||||
{
|
||||
cellMic.warning("Failed to open capture device '%s' (error=%s, device=*0x%x, samplingrate=%d, num_al_channels=0x%x, buf_size=%d)", name, fmt::alc_error{device, err}, device, samplingrate, num_al_channels, buf_size);
|
||||
device = nullptr;
|
||||
}
|
||||
|
||||
return device;
|
||||
}
|
||||
#endif
|
||||
|
||||
void microphone_device::get_data(const u32 num_samples)
|
||||
{
|
||||
if (num_samples == 0)
|
||||
|
|
|
@ -326,6 +326,11 @@ private:
|
|||
static inline void variable_byteswap(const void* src, void* dst);
|
||||
inline u32 convert_16_bit_pcm_to_float(const std::vector<u8>& buffer, u32 num_bytes);
|
||||
|
||||
#ifndef WITHOUT_OPENAL
|
||||
void enumerate_devices();
|
||||
ALCdevice* open_device(const std::string& name, u32 samplingrate, ALCenum num_al_channels, u32 buf_size);
|
||||
#endif
|
||||
|
||||
u32 capture_audio();
|
||||
|
||||
void get_data(const u32 num_samples);
|
||||
|
@ -345,6 +350,7 @@ private:
|
|||
std::vector<u8> buf;
|
||||
};
|
||||
|
||||
std::vector<std::string> enumerated_devices;
|
||||
std::vector<mic_device> devices;
|
||||
std::vector<u8> temp_buf;
|
||||
std::vector<u8> float_buf;
|
||||
|
@ -376,7 +382,7 @@ public:
|
|||
void wake_up();
|
||||
|
||||
// Returns index of registered device
|
||||
u32 register_device(const std::string& name);
|
||||
u32 register_device(const std::string& device_name);
|
||||
void unregister_device(u32 dev_num);
|
||||
bool check_device(u32 dev_num);
|
||||
|
||||
|
|
|
@ -25,7 +25,7 @@ void game_list_base::repaint_icons(std::vector<game_info>& game_data, const QCol
|
|||
for (game_info& game : game_data)
|
||||
{
|
||||
game->pxmap = placeholder;
|
||||
|
||||
|
||||
if (movie_item_base* item = game->item)
|
||||
{
|
||||
item->set_icon_load_func([this, game, device_pixel_ratio, cancel = item->icon_loading_aborted()](int)
|
||||
|
|
|
@ -2363,7 +2363,7 @@ void game_list_frame::BatchActionBySerials(progress_dialog* pdlg, const std::set
|
|||
|
||||
connect(future_watcher, &QFutureWatcher<void>::finished, this, [=, this]()
|
||||
{
|
||||
pdlg->setLabelText(progressLabel.arg(+*index).arg(serials_size));
|
||||
pdlg->setLabelText(progressLabel.arg(index->load()).arg(serials_size));
|
||||
pdlg->setCancelButtonText(tr("OK"));
|
||||
QApplication::beep();
|
||||
|
||||
|
@ -2396,7 +2396,7 @@ void game_list_frame::BatchActionBySerials(progress_dialog* pdlg, const std::set
|
|||
return;
|
||||
}
|
||||
|
||||
pdlg->setLabelText(progressLabel.arg(+*index).arg(serials_size));
|
||||
pdlg->setLabelText(progressLabel.arg(index->load()).arg(serials_size));
|
||||
pdlg->setCancelButtonText(tr("OK"));
|
||||
connect(pdlg, &progress_dialog::canceled, this, [pdlg](){ pdlg->deleteLater(); });
|
||||
QApplication::beep();
|
||||
|
|
|
@ -28,9 +28,9 @@ void microphone_creator::refresh_list()
|
|||
{
|
||||
if (const char* devices = alcGetString(nullptr, ALC_CAPTURE_DEVICE_SPECIFIER))
|
||||
{
|
||||
while (*devices != 0)
|
||||
while (devices && *devices != 0)
|
||||
{
|
||||
cfg_log.notice("Found microphone: %s", devices);
|
||||
cfg_log.notice("Found microphone: '%s'", devices);
|
||||
m_microphone_list.append(devices);
|
||||
devices += strlen(devices) + 1;
|
||||
}
|
||||
|
@ -43,6 +43,7 @@ void microphone_creator::refresh_list()
|
|||
|
||||
if (const char* device = alcGetString(nullptr, ALC_DEFAULT_DEVICE_SPECIFIER))
|
||||
{
|
||||
cfg_log.notice("Found default microphone: '%s'", device);
|
||||
m_microphone_list.append(device);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ void ps_move_tracker_dialog::update_saturation_threshold(bool update_slider)
|
|||
}
|
||||
void ps_move_tracker_dialog::update_min_radius(bool update_slider)
|
||||
{
|
||||
ui->minRadiusGb->setTitle(tr("Min Radius: %0 %").arg(g_cfg_move.min_radius));
|
||||
ui->minRadiusGb->setTitle(tr("Min Radius: %0 %").arg(g_cfg_move.min_radius.get()));
|
||||
|
||||
if (update_slider)
|
||||
{
|
||||
|
@ -372,7 +372,7 @@ void ps_move_tracker_dialog::update_min_radius(bool update_slider)
|
|||
|
||||
void ps_move_tracker_dialog::update_max_radius(bool update_slider)
|
||||
{
|
||||
ui->maxRadiusGb->setTitle(tr("Max Radius: %0 %").arg(g_cfg_move.max_radius));
|
||||
ui->maxRadiusGb->setTitle(tr("Max Radius: %0 %").arg(g_cfg_move.max_radius.get()));
|
||||
|
||||
if (update_slider)
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue