auxMessage

implement 
GetDeviceCapabilities
GetDeviceCount

modMessage
implement 
GetDeviceCapabilities

svn path=/trunk/; revision=19381
This commit is contained in:
Magnus Olsen 2005-11-20 17:52:53 +00:00
parent 118663036e
commit bf60481a6b
7 changed files with 53 additions and 12 deletions

View file

@ -9,13 +9,14 @@
* UPDATE HISTORY:
* Mar 16, 2004: Created skeleton implementation
*/
#include "mmdrv.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
APIENTRY DWORD auxMessage(UINT uDevice,
APIENTRY DWORD auxMessage(UINT dwId,
UINT uMessage,
DWORD dwUser,
DWORD dwParam1,
@ -28,14 +29,21 @@ APIENTRY DWORD auxMessage(UINT uDevice,
switch (uMessage)
{
case AUXDM_GETDEVCAPS:
return 0;
DPRINT("AUXDM_GETDEVCAPS");
return GetDeviceCapabilities(dwId, AuxDevice, (LPBYTE)dwParam1, (DWORD)dwParam2);
case AUXDM_GETNUMDEVS:
return 0;
DPRINT("AUXDM_GETNUMDEVS");
return GetDeviceCount(AuxDevice);
case AUXDM_GETVOLUME:
return 0;
case AUXDM_SETVOLUME:
return 0;
}
return MMSYSERR_NOERROR;
}

View file

@ -10,6 +10,7 @@
*/
#include "mmdrv.h"
#include "wave.h"
#define NDEBUG
#include <debug.h>
@ -233,7 +234,7 @@ APIENTRY DWORD modMessage(DWORD ID, DWORD Message, DWORD User, DWORD Param1, DWO
case MODM_GETDEVCAPS:
DPRINT("MODM_GETDEVCAPS");
return MMSYSERR_NOTSUPPORTED;
return GetDeviceCapabilities(ID, MidiOutDevice, (LPBYTE)Param1, (DWORD)Param2);
case MODM_OPEN :
return OpenMidiDevice(MidiOutDevice, ID, User, Param1, Param2);

View file

@ -29,6 +29,8 @@
#include <mmsystem.h>
#include <winbase.h>
#define MAX_MIDIINDRV (16)
/* For now I'm making 16 the maximum number of midi devices one can
* have. This should be more than enough for everybody. But as a purist,

View file

@ -52,6 +52,7 @@
#define IOCTL_SOUND_BASE FILE_DEVICE_SOUND
#define IOCTL_WAVE_BASE 0x0000
#define IOCTL_MIDI_BASE 0x0080
#define IOCTL_AUX_BASE 0x0100
// Wave device driver IOCTLs
@ -84,4 +85,10 @@
#define IOCTL_MIDI_CACHE_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0008, METHOD_BUFFERED, FILE_WRITE_ACCESS)
#define IOCTL_MIDI_CACHE_DRUM_PATCHES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_MIDI_BASE + 0x0009, METHOD_BUFFERED, FILE_WRITE_ACCESS)
// AUX device driver IOCTLs
#define IOCTL_AUX_GET_CAPABILITIES CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0001, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_AUX_SET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0002, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_AUX_GET_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0003, METHOD_BUFFERED, FILE_READ_ACCESS)
#define IOCTL_SOUND_GET_CHANGED_VOLUME CTL_CODE(IOCTL_SOUND_BASE, IOCTL_AUX_BASE + 0x0004, METHOD_BUFFERED, FILE_READ_ACCESS)
#endif

View file

@ -82,8 +82,12 @@ MMRESULT OpenDevice(UINT DeviceType, DWORD ID, PHANDLE pDeviceHandle,
case MidiInDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", MIDI_IN_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
case AuxDevice :
wsprintf(DeviceName, L"\\\\.%ls%d", AUX_DEVICE_NAME_U + strlen("\\Device"), ID);
break;
default : // Aux
wsprintf(DeviceName, L"\\\\.%ls%d", AUX_DEVICE_NAME_U + strlen("\\Device"), ID);
DPRINT("No Auido Device Found");
return MMSYSERR_BADDEVICEID; /* Maybe we should change error code */
};
DPRINT("Attempting to open %S\n", DeviceName);

View file

@ -23,13 +23,9 @@
* ============================
*/
static MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType,
MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType,
LPBYTE pCaps, DWORD Size)
{
// FIXME: Implement :)
// return sndGetData(DeviceType, id, dwSize, lpCaps,
// IOCTL_WAVE_GET_CAPABILITIES);
HANDLE DeviceHandle = NULL;
MMRESULT Result = MMSYSERR_NOERROR;
DWORD BytesReturned = 0;
@ -47,9 +43,29 @@ static MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType,
// wait until the operation completes.
//
Result = DeviceIoControl(DeviceHandle, IOCTL_WAVE_GET_CAPABILITIES,
if (DeviceType == WaveOutDevice)
{
Result = DeviceIoControl(DeviceHandle, IOCTL_WAVE_GET_CAPABILITIES,
NULL, 0, (LPVOID)pCaps, Size,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
}
else if (DeviceType == MidiOutDevice)
{
Result = DeviceIoControl(DeviceHandle, IOCTL_MIDI_GET_CAPABILITIES,
NULL, 0, (LPVOID)pCaps, Size,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
}
else if (DeviceType == AuxDevice)
{
Result = DeviceIoControl(DeviceHandle, IOCTL_AUX_GET_CAPABILITIES,
NULL, 0, (LPVOID)pCaps, Size,
&BytesReturned, NULL) ? MMSYSERR_NOERROR : TranslateStatus();
}
// Close the handle and return the result code

View file

@ -78,3 +78,6 @@ typedef struct tag_WAVEALLOC {
HANDLE ThreadHandle; // Handle for thread termination ONLY
MMRESULT AuxReturnCode; // Return code from Aux task
}WAVEALLOC, *PWAVEALLOC;
MMRESULT GetDeviceCapabilities(DWORD ID, UINT DeviceType,
LPBYTE pCaps, DWORD Size);