mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 23:13:04 +00:00
- Implement reading preferred playback / record device
svn path=/trunk/; revision=43784
This commit is contained in:
parent
96323feab4
commit
1211cabfad
1 changed files with 34 additions and 7 deletions
|
@ -20,7 +20,7 @@
|
||||||
VOID
|
VOID
|
||||||
InitAudioDlg(HWND hwnd)
|
InitAudioDlg(HWND hwnd)
|
||||||
{
|
{
|
||||||
WAVEOUTCAPS waveOutputPaps;
|
WAVEOUTCAPSW waveOutputPaps;
|
||||||
WAVEINCAPS waveInputPaps;
|
WAVEINCAPS waveInputPaps;
|
||||||
MIDIOUTCAPS midiOutCaps;
|
MIDIOUTCAPS midiOutCaps;
|
||||||
TCHAR szNoDevices[256];
|
TCHAR szNoDevices[256];
|
||||||
|
@ -42,20 +42,33 @@ InitAudioDlg(HWND hwnd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
WCHAR DefaultDevice[MAX_PATH] = {0};
|
||||||
|
HKEY hKey;
|
||||||
|
DWORD dwSize = sizeof(DefaultDevice);
|
||||||
|
UINT DefaultIndex = 0;
|
||||||
|
|
||||||
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Multimedia\\Sound Mapper", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegQueryValueExW(hKey, L"Playback", NULL, NULL, (LPBYTE)DefaultDevice, &dwSize);
|
||||||
|
DefaultDevice[MAX_PATH-1] = L'\0';
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
for (uIndex = 0; uIndex < DevsNum; uIndex++)
|
for (uIndex = 0; uIndex < DevsNum; uIndex++)
|
||||||
{
|
{
|
||||||
if (waveOutGetDevCaps(uIndex, &waveOutputPaps, sizeof(waveOutputPaps)))
|
if (waveOutGetDevCapsW(uIndex, &waveOutputPaps, sizeof(waveOutputPaps)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
Res = SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM) waveOutputPaps.szPname);
|
Res = SendMessageW(hCB, CB_ADDSTRING, 0, (LPARAM) waveOutputPaps.szPname);
|
||||||
|
|
||||||
if (CB_ERR != Res)
|
if (CB_ERR != Res)
|
||||||
{
|
{
|
||||||
SendMessage(hCB, CB_SETITEMDATA, Res, (LPARAM) uIndex);
|
SendMessage(hCB, CB_SETITEMDATA, Res, (LPARAM) uIndex);
|
||||||
// TODO: Getting default device
|
if (!wcsicmp(waveOutputPaps.szPname, DefaultDevice))
|
||||||
SendMessage(hCB, CB_SETCURSEL, (WPARAM) Res, 0);
|
DefaultIndex = Res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SendMessage(hCB, CB_SETCURSEL, (WPARAM) DefaultIndex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init sound recording devices list
|
// Init sound recording devices list
|
||||||
|
@ -69,6 +82,19 @@ InitAudioDlg(HWND hwnd)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
WCHAR DefaultDevice[MAX_PATH] = {0};
|
||||||
|
HKEY hKey;
|
||||||
|
DWORD dwSize = sizeof(DefaultDevice);
|
||||||
|
UINT DefaultIndex = 0;
|
||||||
|
|
||||||
|
if (RegOpenKeyExW(HKEY_CURRENT_USER, L"Software\\Microsoft\\Multimedia\\Sound Mapper", 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||||
|
{
|
||||||
|
RegQueryValueExW(hKey, L"Record", NULL, NULL, (LPBYTE)DefaultDevice, &dwSize);
|
||||||
|
DefaultDevice[MAX_PATH-1] = L'\0';
|
||||||
|
RegCloseKey(hKey);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (uIndex = 0; uIndex < DevsNum; uIndex++)
|
for (uIndex = 0; uIndex < DevsNum; uIndex++)
|
||||||
{
|
{
|
||||||
if (waveInGetDevCaps(uIndex, &waveInputPaps, sizeof(waveInputPaps)))
|
if (waveInGetDevCaps(uIndex, &waveInputPaps, sizeof(waveInputPaps)))
|
||||||
|
@ -79,10 +105,11 @@ InitAudioDlg(HWND hwnd)
|
||||||
if (CB_ERR != Res)
|
if (CB_ERR != Res)
|
||||||
{
|
{
|
||||||
SendMessage(hCB, CB_SETITEMDATA, Res, (LPARAM) uIndex);
|
SendMessage(hCB, CB_SETITEMDATA, Res, (LPARAM) uIndex);
|
||||||
// TODO: Getting default device
|
if (!wcsicmp(waveInputPaps.szPname, DefaultDevice))
|
||||||
SendMessage(hCB, CB_SETCURSEL, (WPARAM) Res, 0);
|
DefaultIndex = Res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
SendMessage(hCB, CB_SETCURSEL, (WPARAM) DefaultIndex, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Init MIDI devices list
|
// Init MIDI devices list
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue