- Small implement "Audio" dialog

- Add setupapi.lib to rbuild-file
- Return ERROR_DI_DO_DEFAULT in MediaClassInstaller function

svn path=/trunk/; revision=34183
This commit is contained in:
Dmitry Chapyshev 2008-06-29 10:13:55 +00:00
parent 57e5fca63f
commit f34438b93e
3 changed files with 90 additions and 14 deletions

View file

@ -16,6 +16,79 @@
#include "mmsys.h" #include "mmsys.h"
#include "resource.h" #include "resource.h"
VOID
InitAudioDlg(HWND hwnd)
{
WAVEOUTCAPS waveOutputPaps;
WAVEINCAPS waveInputPaps;
MIDIOUTCAPS midiOutCaps;
UINT DevsNum;
UINT uIndex;
HWND hCB;
LRESULT Res;
// Init sound playback devices list
hCB = GetDlgItem(hwnd, IDC_DEVICE_PLAY_LIST);
DevsNum = waveOutGetNumDevs();
if (DevsNum < 1) return;
for (uIndex = 0; uIndex < DevsNum; uIndex++)
{
if (waveOutGetDevCaps(uIndex, &waveOutputPaps, sizeof(waveOutputPaps)))
continue;
Res = SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM) waveOutputPaps.szPname);
if (CB_ERR != Res)
{
// TODO: Getting default device
SendMessage(hCB, CB_SETCURSEL, (WPARAM) Res, 0);
}
}
// Init sound recording devices list
hCB = GetDlgItem(hwnd, IDC_DEVICE_REC_LIST);
DevsNum = waveInGetNumDevs();
if (DevsNum < 1) return;
for (uIndex = 0; uIndex < DevsNum; uIndex++)
{
if (waveInGetDevCaps(uIndex, &waveInputPaps, sizeof(waveInputPaps)))
continue;
Res = SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM) waveInputPaps.szPname);
if (CB_ERR != Res)
{
// TODO: Getting default device
SendMessage(hCB, CB_SETCURSEL, (WPARAM) Res, 0);
}
}
// Init MIDI devices list
hCB = GetDlgItem(hwnd, IDC_DEVICE_MIDI_LIST);
DevsNum = midiOutGetNumDevs();
if (DevsNum < 1) return;
for (uIndex = 0; uIndex < DevsNum; uIndex++)
{
if (midiOutGetDevCaps(uIndex, &midiOutCaps, sizeof(midiOutCaps)))
continue;
Res = SendMessage(hCB, CB_ADDSTRING, 0, (LPARAM) midiOutCaps.szPname);
if (CB_ERR != Res)
{
// TODO: Getting default device
SendMessage(hCB, CB_SETCURSEL, (WPARAM) Res, 0);
}
}
}
/* Audio property page dialog callback */ /* Audio property page dialog callback */
INT_PTR CALLBACK INT_PTR CALLBACK
AudioDlgProc(HWND hwndDlg, AudioDlgProc(HWND hwndDlg,
@ -46,6 +119,10 @@ AudioDlgProc(HWND hwndDlg,
EnableWindow(GetDlgItem(hwndDlg, IDC_VOLUME3_BTN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_VOLUME3_BTN), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_ADV3_BTN), FALSE); EnableWindow(GetDlgItem(hwndDlg, IDC_ADV3_BTN), FALSE);
} }
else
{
InitAudioDlg(hwndDlg);
}
} }
break; break;
} }

View file

@ -16,6 +16,7 @@
#include <setupapi.h> #include <setupapi.h>
#include <devguid.h> #include <devguid.h>
#include <cpl.h> #include <cpl.h>
#include <tchar.h>
#include <debug.h> #include <debug.h>
#include "mmsys.h" #include "mmsys.h"
@ -34,7 +35,7 @@ DeviceCreateHardwarePageEx(HWND hWndParent,
UINT uNumberOfGuids, UINT uNumberOfGuids,
HWPAGE_DISPLAYMODE DisplayMode); HWPAGE_DISPLAYMODE DisplayMode);
#define NUM_APPLETS (1) #define NUM_APPLETS (1)
HINSTANCE hApplet = 0; HINSTANCE hApplet = 0;
@ -157,43 +158,43 @@ ShowFullControlPanel(HWND hwnd,
DWORD DWORD
MMSYS_InstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData) MMSYS_InstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
{ {
return 0x0; return ERROR_DI_DO_DEFAULT;
} }
DWORD DWORD
MMSYS_RemoveDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData) MMSYS_RemoveDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
{ {
return 0x0; return ERROR_DI_DO_DEFAULT;
} }
DWORD DWORD
MMSYS_AllowInstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData) MMSYS_AllowInstallDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
{ {
return 0x0; return ERROR_DI_DO_DEFAULT;
} }
DWORD DWORD
MMSYS_SelectDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData) MMSYS_SelectDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
{ {
return 0x0; return ERROR_DI_DO_DEFAULT;
} }
DWORD DWORD
MMSYS_DetectDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData) MMSYS_DetectDevice(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
{ {
return 0x0; return ERROR_DI_DO_DEFAULT;
} }
DWORD DWORD
MMSYS_SelectBestCompatDRV(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData) MMSYS_SelectBestCompatDRV(HDEVINFO hDevInfo, PSP_DEVINFO_DATA pspDevInfoData)
{ {
return 0x0; return ERROR_DI_DO_DEFAULT;
} }
DWORD WINAPI DWORD WINAPI
MediaClassInstaller(DI_FUNCTION diFunction, MediaClassInstaller(IN DI_FUNCTION diFunction,
HDEVINFO hDevInfo, IN HDEVINFO hDevInfo,
PSP_DEVINFO_DATA pspDevInfoData) IN PSP_DEVINFO_DATA pspDevInfoData OPTIONAL)
{ {
switch (diFunction) switch (diFunction)
{ {
@ -210,10 +211,7 @@ MediaClassInstaller(DI_FUNCTION diFunction,
case DIF_SELECTBESTCOMPATDRV: case DIF_SELECTBESTCOMPATDRV:
return MMSYS_SelectBestCompatDRV(hDevInfo, pspDevInfoData); return MMSYS_SelectBestCompatDRV(hDevInfo, pspDevInfoData);
default: default:
{ return ERROR_DI_DO_DEFAULT;
DPRINT1("MediaClassInstaller() not supported function\n");
return 0x0;
}
} }
} }

View file

@ -14,6 +14,7 @@
<library>winmm</library> <library>winmm</library>
<library>advapi32</library> <library>advapi32</library>
<library>shell32</library> <library>shell32</library>
<library>setupapi</library>
<file>mmsys.c</file> <file>mmsys.c</file>
<file>sounds.c</file> <file>sounds.c</file>
<file>volume.c</file> <file>volume.c</file>