Author: janderwald
Date: Sun Oct 31 14:34:41 2010
New Revision: 49376
URL:
http://svn.reactos.org/svn/reactos?rev=49376&view=rev
Log:
[MMIXER]
- Enumerate MIDI devices and provide all necessary functions to deal with them
[WDMAUD_KERNEL]
- Implement support functions which call the provided functions of mmixer library
- Fix a bug in device interface request ioctl handler
- Midi devices should now be visible, capabilities be retrieved and opened / close
- Writing data is not yet supported
Added:
trunk/reactos/lib/drivers/sound/mmixer/midi.c (with props)
Modified:
trunk/reactos/dll/win32/wdmaud.drv/legacy.c
trunk/reactos/dll/win32/wdmaud.drv/mmixer.c
trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c
trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h
trunk/reactos/lib/drivers/sound/mmixer/controls.c
trunk/reactos/lib/drivers/sound/mmixer/mixer.c
trunk/reactos/lib/drivers/sound/mmixer/mmixer.h
trunk/reactos/lib/drivers/sound/mmixer/mmixer.rbuild
trunk/reactos/lib/drivers/sound/mmixer/priv.h
trunk/reactos/lib/drivers/sound/mmixer/sup.c
trunk/reactos/lib/drivers/sound/mmixer/topology.c
trunk/reactos/lib/drivers/sound/mmixer/wave.c
Modified: trunk/reactos/dll/win32/wdmaud.drv/legacy.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/legac…
==============================================================================
--- trunk/reactos/dll/win32/wdmaud.drv/legacy.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wdmaud.drv/legacy.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -171,7 +171,7 @@
{
case MIXER_DEVICE_TYPE:
{
- LPMIXERCAPS MixerCaps = (LPMIXERCAPS) Capabilities;
+ LPMIXERCAPSW MixerCaps = (LPMIXERCAPSW) Capabilities;
DeviceInfo.u.MixCaps.szPname[MAXPNAMELEN-1] = L'\0';
CopyWideString(MixerCaps->szPname, DeviceInfo.u.MixCaps.szPname);
@@ -185,13 +185,13 @@
}
case WAVE_OUT_DEVICE_TYPE :
{
- LPWAVEOUTCAPS WaveOutCaps = (LPWAVEOUTCAPS) Capabilities;
+ LPWAVEOUTCAPSW WaveOutCaps = (LPWAVEOUTCAPSW) Capabilities;
DeviceInfo.u.WaveOutCaps.szPname[MAXPNAMELEN-1] = L'\0';
WaveOutCaps->wMid = DeviceInfo.u.WaveOutCaps.wMid;
WaveOutCaps->wPid = DeviceInfo.u.WaveOutCaps.wPid;
- WaveOutCaps->vDriverVersion = 0x0001;
+ WaveOutCaps->vDriverVersion = DeviceInfo.u.WaveOutCaps.vDriverVersion;
CopyWideString(WaveOutCaps->szPname, DeviceInfo.u.WaveOutCaps.szPname);
WaveOutCaps->dwFormats = DeviceInfo.u.WaveOutCaps.dwFormats;
@@ -208,12 +208,40 @@
WaveInCaps->wMid = DeviceInfo.u.WaveInCaps.wMid;
WaveInCaps->wPid = DeviceInfo.u.WaveInCaps.wPid;
- WaveInCaps->vDriverVersion = 0x0001;
+ WaveInCaps->vDriverVersion = DeviceInfo.u.WaveInCaps.vDriverVersion;
CopyWideString(WaveInCaps->szPname, DeviceInfo.u.WaveInCaps.szPname);
WaveInCaps->dwFormats = DeviceInfo.u.WaveInCaps.dwFormats;
WaveInCaps->wChannels = DeviceInfo.u.WaveInCaps.wChannels;
WaveInCaps->wReserved1 = 0;
+ break;
+ }
+ case MIDI_IN_DEVICE_TYPE :
+ {
+ LPMIDIINCAPSW MidiInCaps = (LPMIDIINCAPSW)Capabilities;
+
+ DeviceInfo.u.MidiInCaps.szPname[MAXPNAMELEN-1] = L'\0';
+
+ MidiInCaps->vDriverVersion = DeviceInfo.u.MidiInCaps.vDriverVersion;
+ MidiInCaps->wMid = DeviceInfo.u.MidiInCaps.wMid;
+ MidiInCaps->wPid = DeviceInfo.u.MidiInCaps.wPid;
+ MidiInCaps->dwSupport = DeviceInfo.u.MidiInCaps.dwSupport;
+
+ CopyWideString(MidiInCaps->szPname, DeviceInfo.u.MidiInCaps.szPname);
+ break;
+ }
+ case MIDI_OUT_DEVICE_TYPE :
+ {
+ LPMIDIOUTCAPSW MidiOutCaps = (LPMIDIOUTCAPSW)Capabilities;
+
+ DeviceInfo.u.MidiOutCaps.szPname[MAXPNAMELEN-1] = L'\0';
+
+ MidiOutCaps->vDriverVersion = DeviceInfo.u.MidiOutCaps.vDriverVersion;
+ MidiOutCaps->wMid = DeviceInfo.u.MidiOutCaps.wMid;
+ MidiOutCaps->wPid = DeviceInfo.u.MidiOutCaps.wPid;
+ MidiOutCaps->dwSupport = DeviceInfo.u.MidiOutCaps.dwSupport;
+
+ CopyWideString(MidiOutCaps->szPname, DeviceInfo.u.MidiOutCaps.szPname);
break;
}
}
Modified: trunk/reactos/dll/win32/wdmaud.drv/mmixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/mmixe…
==============================================================================
--- trunk/reactos/dll/win32/wdmaud.drv/mmixer.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wdmaud.drv/mmixer.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -655,17 +655,46 @@
IN struct _SOUND_DEVICE_INSTANCE* SoundDeviceInstance,
IN BOOL bStart)
{
- if (bStart)
- {
- MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_ACQUIRE);
- MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_PAUSE);
- MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_RUN);
- }
- else
- {
- MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_PAUSE);
- MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_ACQUIRE);
- MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_STOP);
+ MMDEVICE_TYPE DeviceType;
+ PSOUND_DEVICE SoundDevice;
+ MMRESULT Result;
+
+ Result = GetSoundDeviceFromInstance(SoundDeviceInstance, &SoundDevice);
+ SND_ASSERT( Result == MMSYSERR_NOERROR );
+
+
+ Result = GetSoundDeviceType(SoundDevice, &DeviceType);
+ SND_ASSERT( Result == MMSYSERR_NOERROR );
+
+ if (DeviceType == WAVE_IN_DEVICE_TYPE || DeviceType == WAVE_OUT_DEVICE_TYPE)
+ {
+ if (bStart)
+ {
+ MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_ACQUIRE);
+ MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_PAUSE);
+ MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_RUN);
+ }
+ else
+ {
+ MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_PAUSE);
+ MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_ACQUIRE);
+ MMixerSetWaveStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_STOP);
+ }
+ }
+ else if (DeviceType == MIDI_IN_DEVICE_TYPE || DeviceType == MIDI_OUT_DEVICE_TYPE)
+ {
+ if (bStart)
+ {
+ MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_ACQUIRE);
+ MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_PAUSE);
+ MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_RUN);
+ }
+ else
+ {
+ MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_PAUSE);
+ MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_ACQUIRE);
+ MMixerSetMidiStatus(&MixerContext, SoundDeviceInstance->Handle,
KSSTATE_STOP);
+ }
}
return MMSYSERR_NOERROR;
Modified: trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/wdmaud.drv/wdmau…
==============================================================================
--- trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] (original)
+++ trunk/reactos/dll/win32/wdmaud.drv/wdmaud.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -90,6 +90,12 @@
FuncTable.CommitWaveBuffer = WriteFileEx_Remixer;
#endif
}
+ else if (DeviceType == MIDI_IN_DEVICE_TYPE || DeviceType ==
MIDI_OUT_DEVICE_TYPE)
+ {
+ FuncTable.SetWaveFormat = FUNC_NAME(WdmAudSetMixerDeviceFormat);
+ FuncTable.SetState = FUNC_NAME(WdmAudSetWaveState);
+ FuncTable.GetPos = FUNC_NAME(WdmAudGetWavePosition);
+ }
SetSoundDeviceFunctionTable(SoundDevice, &FuncTable);
}
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Sun Oct 31
14:34:41 2010
@@ -27,6 +27,12 @@
return WdmAudControlOpenWave(DeviceObject, Irp, DeviceInfo, ClientInfo);
}
+ if (DeviceInfo->DeviceType == MIDI_OUT_DEVICE_TYPE || DeviceInfo->DeviceType ==
MIDI_IN_DEVICE_TYPE)
+ {
+ return WdmAudControlOpenMidi(DeviceObject, Irp, DeviceInfo, ClientInfo);
+ }
+
+
return SetIrpIoStatus(Irp, STATUS_NOT_SUPPORTED, sizeof(WDMAUD_DEVICE_INFO));
}
@@ -55,6 +61,15 @@
{
Result = WdmAudGetWaveOutDeviceCount();
}
+ else if (DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE)
+ {
+ Result = WdmAudGetMidiInDeviceCount();
+ }
+ else if (DeviceInfo->DeviceType == MIDI_OUT_DEVICE_TYPE)
+ {
+ Result = WdmAudGetMidiOutDeviceCount();
+ }
+
/* store result count */
DeviceInfo->DeviceCount = Result;
@@ -120,6 +135,10 @@
else if (DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE ||
DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE)
{
Status = WdmAudWaveCapabilities(DeviceObject, DeviceInfo, ClientInfo,
DeviceExtension);
+ }
+ else if (DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE ||
DeviceInfo->DeviceType == MIDI_OUT_DEVICE_TYPE)
+ {
+ Status = WdmAudMidiCapabilities(DeviceObject, DeviceInfo, ClientInfo,
DeviceExtension);
}
return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
@@ -219,80 +238,38 @@
/* get device interface string input length */
Size = DeviceInfo->u.Interface.DeviceInterfaceStringSize;
- if (DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE || DeviceInfo->DeviceType ==
WAVE_OUT_DEVICE_TYPE)
- {
- /* get wave info */
- Status = WdmAudGetPnpNameByIndexAndType(DeviceInfo->DeviceIndex,
DeviceInfo->DeviceType, &Device);
-
- /* check for success */
- if (!NT_SUCCESS(Status))
- {
- /* invalid device id */
- return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
- }
-
- /* calculate length */
- Length = (wcslen(Device)+1) * sizeof(WCHAR);
-
- if (!Size)
- {
- /* store device interface size */
- DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
- }
- else if (Size < Length)
- {
- /* buffer too small */
- DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
- return SetIrpIoStatus(Irp, STATUS_BUFFER_OVERFLOW,
sizeof(WDMAUD_DEVICE_INFO));
- }
- else
- {
- //FIXME SEH
- RtlMoveMemory(DeviceInfo->u.Interface.DeviceInterfaceString, Device,
Length);
- }
-
- FreeItem(Device);
- return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
- }
- else if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE)
- {
- if (DeviceInfo->DeviceIndex >= WdmAudGetMixerDeviceCount())
- {
- /* invalid device id */
- return SetIrpIoStatus(Irp, STATUS_INVALID_PARAMETER,
sizeof(WDMAUD_DEVICE_INFO));
- }
-
- Status = WdmAudGetMixerPnpNameByIndex(DeviceInfo->DeviceIndex, &Device);
- /* check for success */
- if (!NT_SUCCESS(Status))
- {
- /* invalid device id */
- return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
- }
-
- /* calculate length */
- Length = (wcslen(Device)+1) * sizeof(WCHAR);
-
- if (!Size)
- {
- /* store device interface size */
- DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
- }
- else if (Size < Length)
- {
- /* buffer too small */
- DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
- return SetIrpIoStatus(Irp, STATUS_BUFFER_OVERFLOW,
sizeof(WDMAUD_DEVICE_INFO));
- }
- else
- {
- //FIXME SEH
- RtlMoveMemory(DeviceInfo->u.Interface.DeviceInterfaceString, Device,
Length);
- }
- return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
- }
-
- return SetIrpIoStatus(Irp, STATUS_INVALID_DEVICE_REQUEST,
sizeof(WDMAUD_DEVICE_INFO));
+ /* get mixer info */
+ Status = WdmAudGetPnpNameByIndexAndType(DeviceInfo->DeviceIndex,
DeviceInfo->DeviceType, &Device);
+
+ /* check for success */
+ if (!NT_SUCCESS(Status))
+ {
+ /* invalid device id */
+ return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
+ }
+
+ /* calculate length */
+ Length = (wcslen(Device)+1) * sizeof(WCHAR);
+
+ if (!Size)
+ {
+ /* store device interface size */
+ DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
+ }
+ else if (Size < Length)
+ {
+ /* buffer too small */
+ DeviceInfo->u.Interface.DeviceInterfaceStringSize = Length;
+ return SetIrpIoStatus(Irp, STATUS_BUFFER_OVERFLOW, sizeof(WDMAUD_DEVICE_INFO));
+ }
+ else
+ {
+ //FIXME SEH
+ RtlMoveMemory(DeviceInfo->u.Interface.DeviceInterfaceString, Device, Length);
+ }
+
+ FreeItem(Device);
+ return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
}
NTSTATUS
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h [iso-8859-1] Sun Oct 31
14:34:41 2010
@@ -42,6 +42,8 @@
WAVEOUTCAPSW WaveOutCaps;
AUXCAPSW AuxCaps;
WAVEINCAPSW WaveInCaps;
+ MIDIINCAPSW MidiInCaps;
+ MIDIOUTCAPSW MidiOutCaps;
ULONGLONG Position;
struct
{
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/mmixer.c [iso-8859-1] Sun Oct 31
14:34:41 2010
@@ -612,25 +612,44 @@
return MMixerGetWaveOutCount(&MixerContext);
}
-NTSTATUS
-WdmAudGetMixerPnpNameByIndex(
- IN ULONG DeviceIndex,
- OUT LPWSTR * Device)
-{
- UNIMPLEMENTED
- return STATUS_NOT_IMPLEMENTED;
+ULONG
+WdmAudGetMidiInDeviceCount()
+{
+ return MMixerGetMidiInCount(&MixerContext);
+}
+
+ULONG
+WdmAudGetMidiOutDeviceCount()
+{
+ return MMixerGetWaveOutCount(&MixerContext);
}
NTSTATUS
WdmAudGetPnpNameByIndexAndType(
- IN ULONG DeviceIndex,
- IN SOUND_DEVICE_TYPE DeviceType,
+ IN ULONG DeviceIndex,
+ IN SOUND_DEVICE_TYPE DeviceType,
OUT LPWSTR *DevicePath)
{
- if (MMixerGetWaveDevicePath(&MixerContext, DeviceType == WAVE_IN_DEVICE_TYPE,
DeviceIndex, DevicePath) == MM_STATUS_SUCCESS)
- return STATUS_SUCCESS;
- else
- return STATUS_UNSUCCESSFUL;
+ if (DeviceType == WAVE_IN_DEVICE_TYPE || DeviceType == WAVE_OUT_DEVICE_TYPE)
+ {
+ if (MMixerGetWaveDevicePath(&MixerContext, DeviceType == WAVE_IN_DEVICE_TYPE,
DeviceIndex, DevicePath) == MM_STATUS_SUCCESS)
+ return STATUS_SUCCESS;
+ else
+ return STATUS_UNSUCCESSFUL;
+ }
+ else if (DeviceType == MIDI_IN_DEVICE_TYPE || DeviceType == MIDI_OUT_DEVICE_TYPE)
+ {
+ if (MMixerGetMidiDevicePath(&MixerContext, DeviceType == MIDI_IN_DEVICE_TYPE,
DeviceIndex, DevicePath) == MM_STATUS_SUCCESS)
+ return STATUS_SUCCESS;
+ else
+ return STATUS_UNSUCCESSFUL;
+ }
+ else if (DeviceType == MIXER_DEVICE_TYPE)
+ {
+ UNIMPLEMENTED;
+ }
+
+ return STATUS_UNSUCCESSFUL;
}
NTSTATUS
@@ -640,7 +659,7 @@
IN PWDMAUD_CLIENT ClientInfo,
IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
{
- MIXER_STATUS Status;
+ MIXER_STATUS Status = MM_STATUS_UNSUCCESSFUL;
if (DeviceInfo->DeviceType == WAVE_IN_DEVICE_TYPE)
{
@@ -652,10 +671,31 @@
/* get capabilities */
Status = MMixerWaveOutCapabilities(&MixerContext, DeviceInfo->DeviceIndex,
&DeviceInfo->u.WaveOutCaps);
}
- else
- {
- ASSERT(0);
- return STATUS_UNSUCCESSFUL;
+
+ if (Status == MM_STATUS_SUCCESS)
+ return STATUS_SUCCESS;
+ else
+ return Status;
+}
+
+NTSTATUS
+WdmAudMidiCapabilities(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PWDMAUD_DEVICE_INFO DeviceInfo,
+ IN PWDMAUD_CLIENT ClientInfo,
+ IN PWDMAUD_DEVICE_EXTENSION DeviceExtension)
+{
+ MIXER_STATUS Status = MM_STATUS_UNSUCCESSFUL;
+
+ if (DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE)
+ {
+ /* get capabilities */
+ Status = MMixerMidiInCapabilities(&MixerContext, DeviceInfo->DeviceIndex,
&DeviceInfo->u.MidiInCaps);
+ }
+ else if (DeviceInfo->DeviceType == WAVE_OUT_DEVICE_TYPE)
+ {
+ /* get capabilities */
+ Status = MMixerMidiOutCapabilities(&MixerContext, DeviceInfo->DeviceIndex,
&DeviceInfo->u.MidiOutCaps);
}
if (Status == MM_STATUS_SUCCESS)
@@ -737,3 +777,26 @@
else
return SetIrpIoStatus(Irp, STATUS_NOT_SUPPORTED, sizeof(WDMAUD_DEVICE_INFO));
}
+
+NTSTATUS
+WdmAudControlOpenMidi(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PWDMAUD_DEVICE_INFO DeviceInfo,
+ IN PWDMAUD_CLIENT ClientInfo)
+{
+ MIXER_STATUS Status;
+ PIN_CREATE_CONTEXT Context;
+
+ Context.ClientInfo = ClientInfo;
+ Context.DeviceExtension =
(PWDMAUD_DEVICE_EXTENSION)DeviceObject->DeviceExtension;
+ Context.DeviceType = DeviceInfo->DeviceType;
+
+ Status = MMixerOpenMidi(&MixerContext, DeviceInfo->DeviceIndex,
DeviceInfo->DeviceType == MIDI_IN_DEVICE_TYPE, CreatePinCallback, &Context,
&DeviceInfo->hDevice);
+
+ if (Status == MM_STATUS_SUCCESS)
+ return SetIrpIoStatus(Irp, STATUS_SUCCESS, sizeof(WDMAUD_DEVICE_INFO));
+ else
+ return SetIrpIoStatus(Irp, STATUS_NOT_SUPPORTED, sizeof(WDMAUD_DEVICE_INFO));
+}
+
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/w…
==============================================================================
--- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] (original)
+++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/wdmaud.h [iso-8859-1] Sun Oct 31
14:34:41 2010
@@ -130,6 +130,12 @@
IN PWDMAUD_DEVICE_INFO DeviceInfo,
IN PWDMAUD_CLIENT ClientInfo);
+NTSTATUS
+WdmAudControlOpenMidi(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PIRP Irp,
+ IN PWDMAUD_DEVICE_INFO DeviceInfo,
+ IN PWDMAUD_CLIENT ClientInfo);
ULONG
GetNumOfMixerDevices(
@@ -164,6 +170,13 @@
IN PDEVICE_OBJECT DeviceObject,
IN PWDMAUD_DEVICE_INFO DeviceInfo,
IN PWDMAUD_CLIENT ClientInfo,
+ IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
+
+NTSTATUS
+WdmAudMidiCapabilities(
+ IN PDEVICE_OBJECT DeviceObject,
+ IN PWDMAUD_DEVICE_INFO DeviceInfo,
+ IN PWDMAUD_CLIENT ClientInfo,
IN PWDMAUD_DEVICE_EXTENSION DeviceExtension);
NTSTATUS
@@ -267,10 +280,11 @@
ULONG
WdmAudGetWaveOutDeviceCount();
-NTSTATUS
-WdmAudGetMixerPnpNameByIndex(
- IN ULONG DeviceIndex,
- OUT LPWSTR * Device);
+ULONG
+WdmAudGetMidiInDeviceCount();
+
+ULONG
+WdmAudGetMidiOutDeviceCount();
NTSTATUS
WdmAudGetPnpNameByIndexAndType(
Modified: trunk/reactos/lib/drivers/sound/mmixer/controls.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/c…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/controls.c [iso-8859-1] Sun Oct 31 14:34:41
2010
@@ -955,7 +955,7 @@
MixerInfo->hMixer = MixerData->hDevice;
/* get mixer name */
- MMixerGetDeviceName(MixerContext, MixerInfo, MixerData->hDeviceInterfaceKey);
+ MMixerGetDeviceName(MixerContext, MixerInfo->MixCaps.szPname,
MixerData->hDeviceInterfaceKey);
/* initialize line list */
InitializeListHead(&MixerInfo->LineList);
@@ -1128,6 +1128,9 @@
}
+ /* activate midi devices */
+ MMixerInitializeMidiForFilter(MixerContext, MixerList, MixerData, Topology);
+
/* done */
return Status;
}
Added: trunk/reactos/lib/drivers/sound/mmixer/midi.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/midi.c (added)
+++ trunk/reactos/lib/drivers/sound/mmixer/midi.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -1,0 +1,541 @@
+/*
+ * COPYRIGHT: See COPYING in the top level directory
+ * PROJECT: ReactOS Kernel Streaming
+ * FILE: lib/drivers/sound/mmixer/midi.c
+ * PURPOSE: Midi Support Functions
+ * PROGRAMMER: Johannes Anderwald
+ */
+
+#include "priv.h"
+
+MIXER_STATUS
+MMixerGetPinDataFlowAndCommunication(
+ IN PMIXER_CONTEXT MixerContext,
+ IN LPMIXER_DATA MixerData,
+ IN ULONG PinId,
+ OUT PKSPIN_DATAFLOW DataFlow,
+ OUT PKSPIN_COMMUNICATION Communication)
+{
+ KSP_PIN Pin;
+ ULONG BytesReturned;
+ MIXER_STATUS Status;
+
+ /* setup request */
+ Pin.PinId = PinId;
+ Pin.Reserved = 0;
+ Pin.Property.Flags = KSPROPERTY_TYPE_GET;
+ Pin.Property.Id = KSPROPERTY_PIN_DATAFLOW;
+ Pin.Property.Set = KSPROPSETID_Pin;
+
+ /* get pin dataflow */
+ Status = MixerContext->Control(MixerData->hDevice, IOCTL_KS_PROPERTY,
(PVOID)&Pin, sizeof(KSP_PIN), (PVOID)DataFlow, sizeof(KSPIN_DATAFLOW),
&BytesReturned);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to retrieve dataflow */
+ return Status;
+ }
+
+ /* setup communication request */
+ Pin.Property.Id = KSPROPERTY_PIN_COMMUNICATION;
+
+ /* get pin communication */
+ Status = MixerContext->Control(MixerData->hDevice, IOCTL_KS_PROPERTY,
(PVOID)&Pin, sizeof(KSP_PIN), (PVOID)Communication, sizeof(KSPIN_COMMUNICATION),
&BytesReturned);
+
+ return Status;
+}
+
+MIXER_STATUS
+MMixerAddMidiPin(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
+ IN ULONG DeviceId,
+ IN ULONG PinId,
+ IN ULONG bInput,
+ IN LPWSTR DeviceName)
+{
+ LPMIDI_INFO MidiInfo;
+
+ /* allocate midi info */
+ MidiInfo = MixerContext->Alloc(sizeof(MIDI_INFO));
+
+ if (!MidiInfo)
+ {
+ /* no memory */
+ return MM_STATUS_NO_MEMORY;
+ }
+
+ /* initialize midi info */
+ MidiInfo->DeviceId = DeviceId;
+ MidiInfo->PinId = PinId;
+
+ /* sanity check */
+ ASSERT(wcslen(DeviceName) + 1 < MAXPNAMELEN);
+
+ /* copy device name */
+ if (bInput && DeviceName)
+ {
+ wcscpy(MidiInfo->u.InCaps.szPname, DeviceName);
+ }
+ else if (!bInput && DeviceName)
+ {
+ wcscpy(MidiInfo->u.OutCaps.szPname, DeviceName);
+ }
+
+ /* FIXME determine manufacturer / product id */
+ if (bInput)
+ {
+ MidiInfo->u.InCaps.dwSupport = 0;
+ MidiInfo->u.InCaps.wMid = MM_MICROSOFT;
+ MidiInfo->u.InCaps.wPid = MM_PID_UNMAPPED;
+ MidiInfo->u.InCaps.vDriverVersion = 1;
+ }
+ else
+ {
+ MidiInfo->u.OutCaps.dwSupport = 0;
+ MidiInfo->u.OutCaps.wMid = MM_MICROSOFT;
+ MidiInfo->u.OutCaps.wPid = MM_PID_UNMAPPED;
+ MidiInfo->u.OutCaps.vDriverVersion = 1;
+ }
+
+ if (bInput)
+ {
+ /* insert into list */
+ InsertTailList(&MixerList->MidiInList, &MidiInfo->Entry);
+ MixerList->MidiInListCount++;
+ }
+ else
+ {
+ /* insert into list */
+ InsertTailList(&MixerList->MidiOutList, &MidiInfo->Entry);
+ MixerList->MidiOutListCount++;
+ }
+
+ return MM_STATUS_SUCCESS;
+}
+
+VOID
+MMixerCheckFilterPinMidiSupport(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
+ IN LPMIXER_DATA MixerData,
+ IN ULONG PinId,
+ IN PKSMULTIPLE_ITEM MultipleItem,
+ IN LPWSTR szPname)
+{
+ ULONG Index;
+ PKSDATARANGE DataRange;
+ KSPIN_COMMUNICATION Communication;
+ KSPIN_DATAFLOW DataFlow;
+ MIXER_STATUS Status;
+
+ /* get first datarange */
+ DataRange = (PKSDATARANGE)(MultipleItem + 1);
+
+ /* alignment assert */
+ ASSERT(((ULONG_PTR)DataRange & 0x7) == 0);
+
+ /* iterate through all data ranges */
+ for(Index = 0; Index < MultipleItem->Count; Index++)
+ {
+ if (IsEqualGUIDAligned(&DataRange->MajorFormat,
&KSDATAFORMAT_TYPE_MUSIC) &&
+ IsEqualGUIDAligned(&DataRange->SubFormat,
&KSDATAFORMAT_SUBTYPE_MIDI) &&
+ IsEqualGUIDAligned(&DataRange->Specifier,
&KSDATAFORMAT_SPECIFIER_NONE))
+ {
+ /* pin supports midi datarange */
+ if (MMixerGetPinDataFlowAndCommunication(MixerContext, MixerData, PinId,
&DataFlow, &Communication) == MM_STATUS_SUCCESS)
+ {
+ if (DataFlow == KSPIN_DATAFLOW_IN && Communication ==
KSPIN_COMMUNICATION_SINK)
+ {
+ Status = MMixerAddMidiPin(MixerContext, MixerList,
MixerData->DeviceId, PinId, FALSE, szPname);
+ }
+ else if (DataFlow == KSPIN_DATAFLOW_OUT && Communication ==
KSPIN_COMMUNICATION_SOURCE)
+ {
+ Status = MMixerAddMidiPin(MixerContext, MixerList,
MixerData->DeviceId, PinId, TRUE, szPname);
+ }
+ }
+ }
+
+ /* move to next datarange */
+ DataRange = (PKSDATARANGE)((ULONG_PTR)DataRange + DataRange->FormatSize);
+
+ /* alignment assert */
+ ASSERT(((ULONG_PTR)DataRange & 0x7) == 0);
+
+ /* data ranges are 64-bit aligned */
+ DataRange = (PVOID)(((ULONG_PTR)DataRange + 0x7) & ~0x7);
+ }
+}
+
+VOID
+MMixerInitializeMidiForFilter(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
+ IN LPMIXER_DATA MixerData,
+ IN PTOPOLOGY Topology)
+{
+ ULONG PinCount, Index;
+ MIXER_STATUS Status;
+ PKSMULTIPLE_ITEM MultipleItem;
+ WCHAR szPname[MAXPNAMELEN];
+
+ /* get filter pin count */
+ MMixerGetTopologyPinCount(Topology, &PinCount);
+
+ /* get mixer name */
+ if (MMixerGetDeviceName(MixerContext, szPname, MixerData->hDeviceInterfaceKey) !=
MM_STATUS_SUCCESS)
+ {
+ /* clear name */
+ szPname[0] = 0;
+ }
+
+ /* iterate all pins and check for KSDATARANGE_MUSIC support */
+ for(Index = 0; Index < PinCount; Index++)
+ {
+ /* get audio pin data ranges */
+ Status = MMixerGetAudioPinDataRanges(MixerContext, MixerData->hDevice, Index,
&MultipleItem);
+
+ /* check for success */
+ if (Status == MM_STATUS_SUCCESS)
+ {
+ /* check if there is support KSDATARANGE_MUSIC */
+ MMixerCheckFilterPinMidiSupport(MixerContext, MixerList, MixerData, Index,
MultipleItem, szPname);
+ }
+ }
+}
+
+MIXER_STATUS
+MMixerOpenMidiPin(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
+ IN ULONG DeviceId,
+ IN ULONG PinId,
+ IN ACCESS_MASK DesiredAccess,
+ IN PIN_CREATE_CALLBACK CreateCallback,
+ IN PVOID Context,
+ OUT PHANDLE PinHandle)
+{
+ PKSPIN_CONNECT PinConnect;
+ PKSDATAFORMAT DataFormat;
+ LPMIXER_DATA MixerData;
+ NTSTATUS Status;
+ MIXER_STATUS MixerStatus;
+
+ MixerData = MMixerGetDataByDeviceId(MixerList, DeviceId);
+ if (!MixerData)
+ return MM_STATUS_INVALID_PARAMETER;
+
+ /* allocate pin connect */
+ PinConnect = MMixerAllocatePinConnect(MixerContext, sizeof(KSDATAFORMAT));
+ if (!PinConnect)
+ {
+ /* no memory */
+ return MM_STATUS_NO_MEMORY;
+ }
+
+ /* initialize pin connect struct */
+ MMixerInitializePinConnect(PinConnect, PinId);
+
+ /* get offset to dataformat */
+ DataFormat = (PKSDATAFORMAT) (PinConnect + 1);
+
+ /* initialize data format */
+ RtlMoveMemory(&DataFormat->MajorFormat, &KSDATAFORMAT_TYPE_MUSIC,
sizeof(GUID));
+ RtlMoveMemory(&DataFormat->SubFormat, &KSDATAFORMAT_SUBTYPE_MIDI,
sizeof(GUID));
+ RtlMoveMemory(&DataFormat->Specifier, &KSDATAFORMAT_SPECIFIER_NONE,
sizeof(GUID));
+
+ if (CreateCallback)
+ {
+ /* let the callback handle the creation */
+ MixerStatus = CreateCallback(Context, DeviceId, PinId, MixerData->hDevice,
PinConnect, DesiredAccess, PinHandle);
+ }
+ else
+ {
+ /* now create the pin */
+ Status = KsCreatePin(MixerData->hDevice, PinConnect, DesiredAccess,
PinHandle);
+
+ /* normalize status */
+ if (Status == STATUS_SUCCESS)
+ MixerStatus = MM_STATUS_SUCCESS;
+ else
+ MixerStatus = MM_STATUS_UNSUCCESSFUL;
+ }
+
+ /* free create info */
+ MixerContext->Free(PinConnect);
+
+ /* done */
+ return MixerStatus;
+}
+
+MIXER_STATUS
+MMixerGetMidiInfoByIndexAndType(
+ IN PMIXER_LIST MixerList,
+ IN ULONG DeviceIndex,
+ IN ULONG bMidiInputType,
+ OUT LPMIDI_INFO *OutMidiInfo)
+{
+ ULONG Index = 0;
+ PLIST_ENTRY Entry, ListHead;
+ LPMIDI_INFO MidiInfo;
+
+ if (bMidiInputType)
+ ListHead = &MixerList->MidiInList;
+ else
+ ListHead = &MixerList->MidiOutList;
+
+ /* get first entry */
+ Entry = ListHead->Flink;
+
+ while(Entry != ListHead)
+ {
+ MidiInfo = (LPMIDI_INFO)CONTAINING_RECORD(Entry, MIDI_INFO, Entry);
+
+ if (Index == DeviceIndex)
+ {
+ *OutMidiInfo = MidiInfo;
+ return MM_STATUS_SUCCESS;
+ }
+ Index++;
+ Entry = Entry->Flink;
+ }
+
+ return MM_STATUS_INVALID_PARAMETER;
+}
+
+MIXER_STATUS
+MMixerMidiOutCapabilities(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG DeviceIndex,
+ OUT LPMIDIOUTCAPSW Caps)
+{
+ PMIXER_LIST MixerList;
+ MIXER_STATUS Status;
+ LPMIDI_INFO MidiInfo;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* grab mixer list */
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ /* find destination midi */
+ Status = MMixerGetMidiInfoByIndexAndType(MixerList, DeviceIndex, FALSE,
&MidiInfo);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to find midi info */
+ return MM_STATUS_UNSUCCESSFUL;
+ }
+
+ /* copy capabilities */
+ MixerContext->Copy(Caps, &MidiInfo->u.OutCaps, sizeof(MIDIOUTCAPSW));
+
+ return MM_STATUS_SUCCESS;
+}
+
+MIXER_STATUS
+MMixerMidiInCapabilities(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG DeviceIndex,
+ OUT LPMIDIINCAPSW Caps)
+{
+ PMIXER_LIST MixerList;
+ MIXER_STATUS Status;
+ LPMIDI_INFO MidiInfo;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* grab mixer list */
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ /* find destination midi */
+ Status = MMixerGetMidiInfoByIndexAndType(MixerList, DeviceIndex, TRUE,
&MidiInfo);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to find midi info */
+ return MM_STATUS_UNSUCCESSFUL;
+ }
+
+ /* copy capabilities */
+ MixerContext->Copy(Caps, &MidiInfo->u.InCaps, sizeof(MIDIINCAPSW));
+
+ return MM_STATUS_SUCCESS;
+}
+
+MIXER_STATUS
+MMixerGetMidiDevicePath(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG bMidiIn,
+ IN ULONG DeviceId,
+ OUT LPWSTR * DevicePath)
+{
+ PMIXER_LIST MixerList;
+ LPMIXER_DATA MixerData;
+ LPMIDI_INFO MidiInfo;
+ ULONG Length;
+ MIXER_STATUS Status;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* grab mixer list */
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ /* find destination midi */
+ Status = MMixerGetMidiInfoByIndexAndType(MixerList, DeviceId, bMidiIn,
&MidiInfo);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to find midi info */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
+
+ /* get associated device id */
+ MixerData = MMixerGetDataByDeviceId(MixerList, MidiInfo->DeviceId);
+ if (!MixerData)
+ return MM_STATUS_INVALID_PARAMETER;
+
+ /* calculate length */
+ Length = wcslen(MixerData->DeviceName)+1;
+
+ /* allocate destination buffer */
+ *DevicePath = MixerContext->Alloc(Length * sizeof(WCHAR));
+
+ if (!*DevicePath)
+ {
+ /* no memory */
+ return MM_STATUS_NO_MEMORY;
+ }
+
+ /* copy device path */
+ MixerContext->Copy(*DevicePath, MixerData->DeviceName, Length *
sizeof(WCHAR));
+
+ /* done */
+ return MM_STATUS_SUCCESS;
+}
+
+MIXER_STATUS
+MMixerSetMidiStatus(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE PinHandle,
+ IN KSSTATE State)
+{
+ KSPROPERTY Property;
+ ULONG Length;
+
+ /* setup property request */
+ Property.Set = KSPROPSETID_Connection;
+ Property.Id = KSPROPERTY_CONNECTION_STATE;
+ Property.Flags = KSPROPERTY_TYPE_SET;
+
+ return MixerContext->Control(PinHandle, IOCTL_KS_PROPERTY, &Property,
sizeof(KSPROPERTY), &State, sizeof(KSSTATE), &Length);
+}
+
+MIXER_STATUS
+MMixerOpenMidi(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG DeviceIndex,
+ IN ULONG bMidiIn,
+ IN PIN_CREATE_CALLBACK CreateCallback,
+ IN PVOID Context,
+ OUT PHANDLE PinHandle)
+{
+ PMIXER_LIST MixerList;
+ MIXER_STATUS Status;
+ LPMIDI_INFO MidiInfo;
+ ACCESS_MASK DesiredAccess = 0;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* grab mixer list */
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ /* find destination midi */
+ Status = MMixerGetMidiInfoByIndexAndType(MixerList, DeviceIndex, bMidiIn,
&MidiInfo);
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* failed to find midi info */
+ return MM_STATUS_INVALID_PARAMETER;
+ }
+
+ /* get desired access */
+ if (bMidiIn)
+ {
+ DesiredAccess |= GENERIC_READ;
+ }
+ else
+ {
+ DesiredAccess |= GENERIC_WRITE;
+ }
+
+ /* now try open the pin */
+ return MMixerOpenMidiPin(MixerContext, MixerList, MidiInfo->DeviceId,
MidiInfo->PinId, DesiredAccess, CreateCallback, Context, PinHandle);
+}
+
+ULONG
+MMixerGetMidiInCount(
+ IN PMIXER_CONTEXT MixerContext)
+{
+ PMIXER_LIST MixerList;
+ MIXER_STATUS Status;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* grab mixer list */
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ return MixerList->MidiInListCount;
+}
+
+ULONG
+MMixerGetMidiOutCount(
+ IN PMIXER_CONTEXT MixerContext)
+{
+ PMIXER_LIST MixerList;
+ MIXER_STATUS Status;
+
+ /* verify mixer context */
+ Status = MMixerVerifyContext(MixerContext);
+
+ if (Status != MM_STATUS_SUCCESS)
+ {
+ /* invalid context passed */
+ return Status;
+ }
+
+ /* grab mixer list */
+ MixerList = (PMIXER_LIST)MixerContext->MixerContext;
+
+ return MixerList->MidiOutListCount;
+}
Propchange: trunk/reactos/lib/drivers/sound/mmixer/midi.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: trunk/reactos/lib/drivers/sound/mmixer/mixer.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/mixer.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/mixer.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -447,11 +447,14 @@
MixerList->MixerDataCount = 0;
MixerList->WaveInListCount = 0;
MixerList->WaveOutListCount = 0;
+ MixerList->MidiInListCount = 0;
+ MixerList->MidiOutListCount = 0;
InitializeListHead(&MixerList->MixerList);
InitializeListHead(&MixerList->MixerData);
InitializeListHead(&MixerList->WaveInList);
InitializeListHead(&MixerList->WaveOutList);
-
+ InitializeListHead(&MixerList->MidiInList);
+ InitializeListHead(&MixerList->MidiOutList);
/* store mixer list */
MixerContext->MixerContext = (PVOID)MixerList;
Modified: trunk/reactos/lib/drivers/sound/mmixer/mmixer.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/mmixer.h [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -122,6 +122,15 @@
MMixerGetWaveOutCount(
IN PMIXER_CONTEXT MixerContext);
+ULONG
+MMixerGetMidiInCount(
+ IN PMIXER_CONTEXT MixerContext);
+
+ULONG
+MMixerGetMidiOutCount(
+ IN PMIXER_CONTEXT MixerContext);
+
+
MIXER_STATUS
MMixerGetCapabilities(
@@ -199,3 +208,37 @@
IN ULONG bWaveIn,
IN ULONG DeviceId,
OUT LPWSTR * DevicePath);
+
+MIXER_STATUS
+MMixerMidiOutCapabilities(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG DeviceIndex,
+ OUT LPMIDIOUTCAPSW Caps);
+
+MIXER_STATUS
+MMixerMidiInCapabilities(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG DeviceIndex,
+ OUT LPMIDIINCAPSW Caps);
+
+MIXER_STATUS
+MMixerGetMidiDevicePath(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG bMidiIn,
+ IN ULONG DeviceId,
+ OUT LPWSTR * DevicePath);
+
+MIXER_STATUS
+MMixerSetMidiStatus(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE PinHandle,
+ IN KSSTATE State);
+
+MIXER_STATUS
+MMixerOpenMidi(
+ IN PMIXER_CONTEXT MixerContext,
+ IN ULONG DeviceIndex,
+ IN ULONG bMidiIn,
+ IN PIN_CREATE_CALLBACK CreateCallback,
+ IN PVOID Context,
+ OUT PHANDLE PinHandle);
Modified: trunk/reactos/lib/drivers/sound/mmixer/mmixer.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/m…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/mmixer.rbuild [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/mmixer.rbuild [iso-8859-1] Sun Oct 31 14:34:41
2010
@@ -5,6 +5,7 @@
<define name="NDEBUG">1</define>
<file>controls.c</file>
<file>filter.c</file>
+ <file>midi.c</file>
<file>mixer.c</file>
<file>sup.c</file>
<file>wave.c</file>
Modified: trunk/reactos/lib/drivers/sound/mmixer/priv.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/p…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/priv.h [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/priv.h [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -130,14 +130,36 @@
typedef struct
{
+ LIST_ENTRY Entry;
+ ULONG DeviceId;
+ ULONG PinId;
+ union
+ {
+ MIDIOUTCAPSW OutCaps;
+ MIDIINCAPSW InCaps;
+ }u;
+
+}MIDI_INFO, *LPMIDI_INFO;
+
+typedef struct
+{
ULONG MixerListCount;
LIST_ENTRY MixerList;
+
ULONG MixerDataCount;
LIST_ENTRY MixerData;
+
ULONG WaveInListCount;
LIST_ENTRY WaveInList;
+
ULONG WaveOutListCount;
LIST_ENTRY WaveOutList;
+
+ ULONG MidiInListCount;
+ LIST_ENTRY MidiInList;
+
+ ULONG MidiOutListCount;
+ LIST_ENTRY MidiOutList;
}MIXER_LIST, *PMIXER_LIST;
typedef struct
@@ -197,27 +219,12 @@
IN LPMIXER_INFO MixerInfo);
MIXER_STATUS
-MMixerGetTargetPins(
- IN PMIXER_CONTEXT MixerContext,
- IN PKSMULTIPLE_ITEM NodeTypes,
- IN PKSMULTIPLE_ITEM NodeConnections,
- IN ULONG NodeIndex,
- IN ULONG bUpDirection,
- OUT PULONG Pins,
- IN ULONG PinCount);
-
-MIXER_STATUS
MMixerGetPhysicalConnection(
IN PMIXER_CONTEXT MixerContext,
IN HANDLE hMixer,
IN ULONG PinId,
OUT PKSPIN_PHYSICALCONNECTION *OutConnection);
-ULONG
-MMixerGetIndexOfGuid(
- PKSMULTIPLE_ITEM MultipleItem,
- LPCGUID NodeType);
-
MIXER_STATUS
MMixerSetupFilter(
IN PMIXER_CONTEXT MixerContext,
@@ -225,24 +232,24 @@
IN LPMIXER_DATA MixerData,
IN PULONG DeviceCount);
-MIXER_STATUS
-MMixerGetTargetPinsByNodeConnectionIndex(
- IN PMIXER_CONTEXT MixerContext,
- IN PKSMULTIPLE_ITEM NodeConnections,
- IN PKSMULTIPLE_ITEM NodeTypes,
- IN ULONG bUpDirection,
- IN ULONG NodeConnectionIndex,
- IN ULONG PinCount,
- OUT PULONG Pins);
-
-MIXER_STATUS
-MMixerGetControlsFromPin(
- IN PMIXER_CONTEXT MixerContext,
- IN PKSMULTIPLE_ITEM NodeConnections,
- IN PKSMULTIPLE_ITEM NodeTypes,
+PKSPIN_CONNECT
+MMixerAllocatePinConnect(
+ IN PMIXER_CONTEXT MixerContext,
+ ULONG DataFormatSize);
+
+MIXER_STATUS
+MMixerGetAudioPinDataRanges(
+ IN PMIXER_CONTEXT MixerContext,
+ IN HANDLE hDevice,
IN ULONG PinId,
- IN ULONG bUpDirection,
- OUT PULONG Nodes);
+ IN OUT PKSMULTIPLE_ITEM * OutMultipleItem);
+
+VOID
+MMixerInitializeMidiForFilter(
+ IN PMIXER_CONTEXT MixerContext,
+ IN PMIXER_LIST MixerList,
+ IN LPMIXER_DATA MixerData,
+ IN PTOPOLOGY Topology);
MIXER_STATUS
MMixerVerifyContext(
@@ -315,12 +322,6 @@
IN HANDLE hKey);
MIXER_STATUS
-MMixerGetDeviceName(
- IN PMIXER_CONTEXT MixerContext,
- IN LPMIXER_INFO MixerInfo,
- IN HANDLE hKey);
-
-MIXER_STATUS
MMixerInitializeWaveInfo(
IN PMIXER_CONTEXT MixerContext,
IN PMIXER_LIST MixerList,
@@ -337,6 +338,18 @@
IN PVOID MixerEvent,
IN PMIXER_EVENT MixerEventRoutine);
+MIXER_STATUS
+MMixerGetDeviceName(
+ IN PMIXER_CONTEXT MixerContext,
+ OUT LPWSTR DeviceName,
+ IN HANDLE hKey);
+
+VOID
+MMixerInitializePinConnect(
+ IN OUT PKSPIN_CONNECT PinConnect,
+ IN ULONG PinId);
+
+
/* topology.c */
MIXER_STATUS
@@ -448,3 +461,9 @@
IN PTOPOLOGY Topology,
IN ULONG NodeIndex,
OUT PULONG bReserved);
+
+VOID
+MMixerGetTopologyPinCount(
+ IN PTOPOLOGY Topology,
+ OUT PULONG PinCount);
+
Modified: trunk/reactos/lib/drivers/sound/mmixer/sup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/s…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/sup.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/sup.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -31,6 +31,11 @@
const GUID KSPROPSETID_Topology = {0x720D4AC0L, 0x7533, 0x11D0, {0xA5,
0xD6, 0x28, 0xDB, 0x04, 0xC1, 0x00, 0x00}};
const GUID KSEVENTSETID_AudioControlChange = {0xE85E9698L, 0xFA2F, 0x11D1, {0x95,
0xBD, 0x00, 0xC0, 0x4F, 0xB9, 0x25, 0xD3}};
+const GUID KSDATAFORMAT_TYPE_MUSIC = {0xE725D360L, 0x62CC, 0x11CF, {0xA5, 0xD6, 0x28,
0xDB, 0x04, 0xC1, 0x00, 0x00}};
+const GUID KSDATAFORMAT_SUBTYPE_MIDI = {0x1D262760L, 0xE957, 0x11CF, {0xA5, 0xD6, 0x28,
0xDB, 0x04, 0xC1, 0x00, 0x00}};
+const GUID KSDATAFORMAT_SPECIFIER_NONE = {0x0F6417D6L, 0xC318, 0x11D0, {0xA4, 0x3F, 0x00,
0xA0, 0xC9, 0x22, 0x31, 0x96}};
+
+
MIXER_STATUS
MMixerVerifyContext(
IN PMIXER_CONTEXT MixerContext)
@@ -444,7 +449,7 @@
MIXER_STATUS
MMixerGetDeviceName(
IN PMIXER_CONTEXT MixerContext,
- IN LPMIXER_INFO MixerInfo,
+ OUT LPWSTR DeviceName,
IN HANDLE hKey)
{
LPWSTR Name;
@@ -457,10 +462,10 @@
if (Status == MM_STATUS_SUCCESS)
{
/* copy device name */
- MixerContext->Copy(MixerInfo->MixCaps.szPname, Name, min(wcslen(Name),
MAXPNAMELEN-1) * sizeof(WCHAR));
+ MixerContext->Copy(DeviceName, Name, min(wcslen(Name), MAXPNAMELEN-1) *
sizeof(WCHAR));
/* make sure its null terminated */
- MixerInfo->MixCaps.szPname[MAXPNAMELEN-1] = L'\0';
+ DeviceName[MAXPNAMELEN-1] = L'\0';
/* free device name */
MixerContext->Free(Name);
@@ -473,14 +478,14 @@
if (Status != MM_STATUS_SUCCESS)
return Status;
- Status = MixerContext->QueryKeyValue(hKey, L"FriendlyName",
(PVOID*)&Name, &Length, &Type);
+ Status = MixerContext->QueryKeyValue(hTemp, L"FriendlyName",
(PVOID*)&Name, &Length, &Type);
if (Status == MM_STATUS_SUCCESS)
{
/* copy device name */
- MixerContext->Copy(MixerInfo->MixCaps.szPname, Name, min(wcslen(Name),
MAXPNAMELEN-1) * sizeof(WCHAR));
+ MixerContext->Copy(DeviceName, Name, min(wcslen(Name), MAXPNAMELEN-1) *
sizeof(WCHAR));
/* make sure its null terminated */
- MixerInfo->MixCaps.szPname[MAXPNAMELEN-1] = L'\0';
+ DeviceName[MAXPNAMELEN-1] = L'\0';
/* free device name */
MixerContext->Free(Name);
@@ -489,3 +494,21 @@
MixerContext->CloseKey(hTemp);
return Status;
}
+
+VOID
+MMixerInitializePinConnect(
+ IN OUT PKSPIN_CONNECT PinConnect,
+ IN ULONG PinId)
+{
+ PinConnect->Interface.Set = KSINTERFACESETID_Standard;
+ PinConnect->Interface.Id = KSINTERFACE_STANDARD_STREAMING;
+ PinConnect->Interface.Flags = 0;
+ PinConnect->Medium.Set = KSMEDIUMSETID_Standard;
+ PinConnect->Medium.Id = KSMEDIUM_TYPE_ANYINSTANCE;
+ PinConnect->Medium.Flags = 0;
+ PinConnect->PinToHandle = NULL;
+ PinConnect->PinId = PinId;
+ PinConnect->Priority.PriorityClass = KSPRIORITY_NORMAL;
+ PinConnect->Priority.PrioritySubClass = 1;
+}
+
Modified: trunk/reactos/lib/drivers/sound/mmixer/topology.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/t…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/topology.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/topology.c [iso-8859-1] Sun Oct 31 14:34:41
2010
@@ -983,6 +983,15 @@
*OutNodesCount = TopologyNodesCount;
}
+VOID
+MMixerGetTopologyPinCount(
+ IN PTOPOLOGY Topology,
+ OUT PULONG PinCount)
+{
+ /* store pin count */
+ *PinCount = Topology->TopologyPinsCount;
+}
+
MIXER_STATUS
MMixerAllocateTopologyPinArray(
IN PMIXER_CONTEXT MixerContext,
Modified: trunk/reactos/lib/drivers/sound/mmixer/wave.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/drivers/sound/mmixer/w…
==============================================================================
--- trunk/reactos/lib/drivers/sound/mmixer/wave.c [iso-8859-1] (original)
+++ trunk/reactos/lib/drivers/sound/mmixer/wave.c [iso-8859-1] Sun Oct 31 14:34:41 2010
@@ -109,22 +109,7 @@
}
-VOID
-MMixerInitializePinConnect(
- IN OUT PKSPIN_CONNECT PinConnect,
- IN ULONG PinId)
-{
- PinConnect->Interface.Set = KSINTERFACESETID_Standard;
- PinConnect->Interface.Id = KSINTERFACE_STANDARD_STREAMING;
- PinConnect->Interface.Flags = 0;
- PinConnect->Medium.Set = KSMEDIUMSETID_Standard;
- PinConnect->Medium.Id = KSMEDIUM_TYPE_ANYINSTANCE;
- PinConnect->Medium.Flags = 0;
- PinConnect->PinToHandle = NULL;
- PinConnect->PinId = PinId;
- PinConnect->Priority.PriorityClass = KSPRIORITY_NORMAL;
- PinConnect->Priority.PrioritySubClass = 1;
-}
+
VOID
MMixerInitializeDataFormat(
@@ -369,7 +354,7 @@
WaveInfo->PinId = Pins[0];
/* sanity check */
- ASSERT(wcslen(DeviceName) < MAXPNAMELEN);
+ ASSERT(wcslen(DeviceName) + 1 < MAXPNAMELEN);
/* copy device name */
if (bWaveIn)