2009-12-07 10:28:49 +00:00
/*
* COPYRIGHT : See COPYING in the top level directory
* PROJECT : ReactOS Kernel Streaming
* FILE : lib / drivers / sound / mmixer / mmixer . c
* PURPOSE : Mixer Handling Functions
* PROGRAMMER : Johannes Anderwald
*/
2014-02-04 10:36:20 +00:00
# include "precomp.h"
2009-12-07 10:28:49 +00:00
2014-01-04 10:17:22 +00:00
# define YDEBUG
# include <debug.h>
2009-12-09 09:51:39 +00:00
ULONG
MMixerGetCount (
IN PMIXER_CONTEXT MixerContext )
{
PMIXER_LIST MixerList ;
MIXER_STATUS Status ;
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2009-12-09 09:51:39 +00:00
return Status ;
}
2010-10-15 00:20:15 +00:00
/* grab mixer list */
2009-12-09 09:51:39 +00:00
MixerList = ( PMIXER_LIST ) MixerContext - > MixerContext ;
// return number of mixers
return MixerList - > MixerListCount ;
}
MIXER_STATUS
MMixerGetCapabilities (
IN PMIXER_CONTEXT MixerContext ,
IN ULONG MixerIndex ,
OUT LPMIXERCAPSW MixerCaps )
{
MIXER_STATUS Status ;
LPMIXER_INFO MixerInfo ;
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2009-12-09 09:51:39 +00:00
return Status ;
}
2010-10-15 00:20:15 +00:00
/* get mixer info */
2009-12-09 09:51:39 +00:00
MixerInfo = MMixerGetMixerInfoByIndex ( MixerContext , MixerIndex ) ;
if ( ! MixerInfo )
{
// invalid device index
return MM_STATUS_INVALID_PARAMETER ;
}
MixerCaps - > wMid = MixerInfo - > MixCaps . wMid ;
MixerCaps - > wPid = MixerInfo - > MixCaps . wPid ;
MixerCaps - > vDriverVersion = MixerInfo - > MixCaps . vDriverVersion ;
MixerCaps - > fdwSupport = MixerInfo - > MixCaps . fdwSupport ;
MixerCaps - > cDestinations = MixerInfo - > MixCaps . cDestinations ;
2010-06-12 10:21:03 +00:00
ASSERT ( MixerInfo - > MixCaps . szPname [ MAXPNAMELEN - 1 ] = = 0 ) ;
2009-12-09 09:51:39 +00:00
wcscpy ( MixerCaps - > szPname , MixerInfo - > MixCaps . szPname ) ;
return MM_STATUS_SUCCESS ;
}
MIXER_STATUS
MMixerOpen (
IN PMIXER_CONTEXT MixerContext ,
2009-12-09 16:00:28 +00:00
IN ULONG MixerId ,
2010-10-15 02:24:35 +00:00
IN PVOID MixerEventContext ,
2009-12-09 09:51:39 +00:00
IN PMIXER_EVENT MixerEventRoutine ,
OUT PHANDLE MixerHandle )
{
MIXER_STATUS Status ;
2009-12-09 16:00:28 +00:00
LPMIXER_INFO MixerInfo ;
2009-12-09 09:51:39 +00:00
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2010-12-03 16:49:33 +00:00
DPRINT1 ( " invalid context \n " ) ;
2009-12-09 09:51:39 +00:00
return Status ;
}
2010-10-15 02:24:35 +00:00
/* get mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MMixerGetMixerInfoByIndex ( MixerContext , MixerId ) ;
if ( ! MixerInfo )
{
2010-10-15 00:20:15 +00:00
/* invalid mixer id */
2010-12-03 16:49:33 +00:00
DPRINT1 ( " invalid mixer id %lu \n " , MixerId ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-10-15 02:24:35 +00:00
/* add the event */
Status = MMixerAddEvent ( MixerContext , MixerInfo , MixerEventContext , MixerEventRoutine ) ;
2010-01-02 01:52:12 +00:00
2010-10-15 00:20:15 +00:00
/* store result */
2009-12-09 16:00:28 +00:00
* MixerHandle = ( HANDLE ) MixerInfo ;
return MM_STATUS_SUCCESS ;
2009-12-09 09:51:39 +00:00
}
2017-06-24 13:54:10 +00:00
MIXER_STATUS
MMixerClose (
IN PMIXER_CONTEXT MixerContext ,
IN ULONG MixerId ,
IN PVOID MixerEventContext ,
IN PMIXER_EVENT MixerEventRoutine )
{
MIXER_STATUS Status ;
LPMIXER_INFO MixerInfo ;
/* verify mixer context */
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
/* invalid context passed */
DPRINT1 ( " invalid context \n " ) ;
return Status ;
}
/* get mixer info */
MixerInfo = MMixerGetMixerInfoByIndex ( MixerContext , MixerId ) ;
if ( ! MixerInfo )
{
/* invalid mixer id */
DPRINT1 ( " invalid mixer id %lu \n " , MixerId ) ;
return MM_STATUS_INVALID_PARAMETER ;
}
/* remove event from list */
return MMixerRemoveEvent ( MixerContext , MixerInfo , MixerEventContext , MixerEventRoutine ) ;
}
2009-12-09 09:51:39 +00:00
MIXER_STATUS
MMixerGetLineInfo (
IN PMIXER_CONTEXT MixerContext ,
2010-12-03 16:49:33 +00:00
IN HANDLE MixerHandle ,
IN ULONG MixerId ,
IN ULONG Flags ,
2009-12-09 09:51:39 +00:00
OUT LPMIXERLINEW MixerLine )
{
MIXER_STATUS Status ;
2009-12-09 16:00:28 +00:00
LPMIXER_INFO MixerInfo ;
LPMIXERLINE_EXT MixerLineSrc ;
2010-12-04 17:45:48 +00:00
ULONG DestinationLineID ;
2009-12-09 09:51:39 +00:00
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2009-12-09 09:51:39 +00:00
return Status ;
}
2010-12-03 16:49:33 +00:00
if ( ( Flags & ( MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER ) ) = = MIXER_OBJECTF_MIXER )
{
/* caller passed mixer id */
MixerHandle = ( HANDLE ) MMixerGetMixerInfoByIndex ( MixerContext , MixerId ) ;
if ( ! MixerHandle )
{
/* invalid parameter */
return MM_STATUS_INVALID_PARAMETER ;
}
}
2009-12-09 16:00:28 +00:00
2010-12-04 17:45:48 +00:00
if ( MixerLine - > cbStruct ! = sizeof ( MIXERLINEW ) )
2010-12-07 17:46:25 +00:00
{
DPRINT1 ( " MixerLine Expected %lu but got %lu \n " , sizeof ( MIXERLINEW ) , MixerLine - > cbStruct ) ;
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-04 17:45:48 +00:00
2010-10-15 00:20:15 +00:00
/* clear hmixer from flags */
2009-12-09 16:00:28 +00:00
Flags & = ~ MIXER_OBJECTF_HMIXER ;
2010-12-07 17:46:25 +00:00
DPRINT ( " MMixerGetLineInfo MixerId %lu Flags %lu \n " , MixerId , Flags ) ;
2010-12-04 17:45:48 +00:00
2009-12-09 16:00:28 +00:00
if ( Flags = = MIXER_GETLINEINFOF_DESTINATION )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-12-04 17:45:48 +00:00
/* calculate destination line id */
DestinationLineID = ( MixerLine - > dwDestination + DESTINATION_LINE ) ;
/* get destination line */
MixerLineSrc = MMixerGetSourceMixerLineByLineId ( MixerInfo , DestinationLineID ) ;
if ( MixerLineSrc = = NULL )
2009-12-09 16:00:28 +00:00
{
2010-12-04 17:45:48 +00:00
DPRINT1 ( " MixerCaps Name %S DestinationLineCount %lu dwDestination %lu not found \n " , MixerInfo - > MixCaps . szPname , MixerInfo - > MixCaps . cDestinations , MixerLine - > dwDestination ) ;
return MM_STATUS_UNSUCCESSFUL ;
2009-12-09 16:00:28 +00:00
}
2010-12-04 17:45:48 +00:00
/* copy mixer line */
2009-12-09 16:00:28 +00:00
MixerContext - > Copy ( MixerLine , & MixerLineSrc - > Line , sizeof ( MIXERLINEW ) ) ;
2010-12-04 17:45:48 +00:00
/* make sure it is null terminated */
MixerLine - > szName [ MIXER_LONG_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > szShortName [ MIXER_SHORT_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > Target . szPname [ MAXPNAMELEN - 1 ] = L ' \0 ' ;
/* done */
2009-12-09 16:00:28 +00:00
return MM_STATUS_SUCCESS ;
}
else if ( Flags = = MIXER_GETLINEINFOF_SOURCE )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-12-04 17:45:48 +00:00
/* calculate destination line id */
DestinationLineID = ( MixerLine - > dwDestination + DESTINATION_LINE ) ;
2009-12-09 16:00:28 +00:00
2010-12-04 17:45:48 +00:00
/* get destination line */
MixerLineSrc = MMixerGetSourceMixerLineByLineId ( MixerInfo , DestinationLineID ) ;
2009-12-09 16:00:28 +00:00
2010-12-04 17:45:48 +00:00
if ( MixerLineSrc = = NULL )
2009-12-09 16:00:28 +00:00
{
2010-12-04 17:45:48 +00:00
DPRINT1 ( " MixerCaps Name %S DestinationLineCount %lu dwDestination %lu not found \n " , MixerInfo - > MixCaps . szPname , MixerInfo - > MixCaps . cDestinations , MixerLine - > dwDestination ) ;
return MM_STATUS_UNSUCCESSFUL ;
2009-12-09 16:00:28 +00:00
}
2010-12-04 17:45:48 +00:00
/* check if dwSource is out of bounds */
if ( MixerLine - > dwSource > = MixerLineSrc - > Line . cConnections )
2009-12-09 16:00:28 +00:00
{
2010-12-04 17:45:48 +00:00
DPRINT1 ( " MixerCaps Name %S MixerLineName %S Connections %lu dwSource %lu not found \n " , MixerInfo - > MixCaps . szPname , MixerLineSrc - > Line . szName , MixerLineSrc - > Line . cConnections , MixerLine - > dwSource ) ;
return MM_STATUS_UNSUCCESSFUL ;
2009-12-09 16:00:28 +00:00
}
2010-12-04 17:45:48 +00:00
/* calculate destination line id */
2010-12-04 18:53:51 +00:00
DestinationLineID = ( MixerLine - > dwSource * SOURCE_LINE ) + MixerLine - > dwDestination ;
2010-12-04 17:45:48 +00:00
2010-12-04 18:53:51 +00:00
DPRINT ( " MixerName %S cDestinations %lu MixerLineName %S cConnections %lu dwSource %lu dwDestination %lu ID %lx \n " , MixerInfo - > MixCaps . szPname , MixerInfo - > MixCaps . cDestinations ,
MixerLineSrc - > Line . szName , MixerLineSrc - > Line . cConnections ,
MixerLine - > dwSource , MixerLine - > dwDestination ,
DestinationLineID ) ;
2010-12-04 17:45:48 +00:00
/* get target destination line id */
MixerLineSrc = MMixerGetSourceMixerLineByLineId ( MixerInfo , DestinationLineID ) ;
/* sanity check */
ASSERT ( MixerLineSrc ) ;
DPRINT ( " Line %u Name %S \n " , MixerLineSrc - > Line . dwSource , MixerLineSrc - > Line . szName ) ;
/* copy mixer line */
MixerContext - > Copy ( MixerLine , & MixerLineSrc - > Line , sizeof ( MIXERLINEW ) ) ;
/* make sure it is null terminated */
MixerLine - > szName [ MIXER_LONG_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > szShortName [ MIXER_SHORT_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > Target . szPname [ MAXPNAMELEN - 1 ] = L ' \0 ' ;
/* done */
return MM_STATUS_SUCCESS ;
2009-12-09 16:00:28 +00:00
}
else if ( Flags = = MIXER_GETLINEINFOF_LINEID )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-12-04 17:45:48 +00:00
/* try to find line */
2009-12-09 16:00:28 +00:00
MixerLineSrc = MMixerGetSourceMixerLineByLineId ( MixerInfo , MixerLine - > dwLineID ) ;
if ( ! MixerLineSrc )
{
2010-10-15 00:20:15 +00:00
/* invalid parameter */
2010-12-08 19:49:28 +00:00
DPRINT1 ( " MMixerGetLineInfo: MixerName %S Line not found 0x%lx \n " , MixerInfo - > MixCaps . szPname , MixerLine - > dwLineID ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-04 17:45:48 +00:00
DPRINT ( " Line %u Name %S \n " , MixerLineSrc - > Line . dwSource , MixerLineSrc - > Line . szName ) ;
/* copy mixer line*/
2009-12-09 16:00:28 +00:00
MixerContext - > Copy ( MixerLine , & MixerLineSrc - > Line , sizeof ( MIXERLINEW ) ) ;
2010-12-04 17:45:48 +00:00
/* make sure it is null terminated */
MixerLine - > szName [ MIXER_LONG_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > szShortName [ MIXER_SHORT_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > Target . szPname [ MAXPNAMELEN - 1 ] = L ' \0 ' ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_SUCCESS ;
}
else if ( Flags = = MIXER_GETLINEINFOF_COMPONENTTYPE )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-12-04 17:45:48 +00:00
/* find mixer line by component type */
2009-12-09 16:00:28 +00:00
MixerLineSrc = MMixerGetSourceMixerLineByComponentType ( MixerInfo , MixerLine - > dwComponentType ) ;
if ( ! MixerLineSrc )
{
DPRINT1 ( " Failed to find component type %x \n " , MixerLine - > dwComponentType ) ;
return MM_STATUS_UNSUCCESSFUL ;
}
2010-12-04 17:45:48 +00:00
/* copy mixer line */
2009-12-09 16:00:28 +00:00
MixerContext - > Copy ( MixerLine , & MixerLineSrc - > Line , sizeof ( MIXERLINEW ) ) ;
2010-12-04 17:45:48 +00:00
/* make sure it is null terminated */
MixerLine - > szName [ MIXER_LONG_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > szShortName [ MIXER_SHORT_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLine - > Target . szPname [ MAXPNAMELEN - 1 ] = L ' \0 ' ;
/* done */
2009-12-09 16:00:28 +00:00
return MM_STATUS_SUCCESS ;
}
2010-12-04 17:45:48 +00:00
else if ( Flags = = MIXER_GETLINEINFOF_TARGETTYPE )
{
DPRINT1 ( " MIXER_GETLINEINFOF_TARGETTYPE handling is unimplemented \n " ) ;
}
else
{
DPRINT1 ( " Unknown Flags %lx handling is unimplemented \n " , Flags ) ;
}
2009-12-09 16:00:28 +00:00
2009-12-09 09:51:39 +00:00
return MM_STATUS_NOT_IMPLEMENTED ;
}
MIXER_STATUS
MMixerGetLineControls (
IN PMIXER_CONTEXT MixerContext ,
IN HANDLE MixerHandle ,
2010-12-03 16:49:33 +00:00
IN ULONG MixerId ,
2009-12-09 09:51:39 +00:00
IN ULONG Flags ,
2009-12-20 00:55:55 +00:00
OUT LPMIXERLINECONTROLSW MixerLineControls )
2009-12-09 09:51:39 +00:00
{
2009-12-09 16:00:28 +00:00
LPMIXER_INFO MixerInfo ;
LPMIXERLINE_EXT MixerLineSrc ;
2010-12-07 10:29:57 +00:00
LPMIXERCONTROL_EXT MixerControl ;
2009-12-09 09:51:39 +00:00
MIXER_STATUS Status ;
2010-12-07 10:29:57 +00:00
PLIST_ENTRY Entry ;
2009-12-09 16:00:28 +00:00
ULONG Index ;
2009-12-09 09:51:39 +00:00
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2009-12-09 09:51:39 +00:00
return Status ;
}
2010-12-07 10:29:57 +00:00
if ( MixerLineControls - > cbStruct ! = sizeof ( MIXERLINECONTROLSW ) )
{
DPRINT1 ( " Invalid MixerLineControls cbStruct passed %lu expected %lu \n " , MixerLineControls - > cbStruct , sizeof ( MIXERLINECONTROLSW ) ) ;
/* invalid parameter */
return MM_STATUS_INVALID_PARAMETER ;
}
if ( MixerLineControls - > cbmxctrl ! = sizeof ( MIXERCONTROLW ) )
{
2014-10-21 21:08:51 +00:00
DPRINT1 ( " Invalid MixerLineControls cbmxctrl passed %lu expected %lu \n " , MixerLineControls - > cbmxctrl , sizeof ( MIXERCONTROLW ) ) ;
2010-12-07 10:29:57 +00:00
/* invalid parameter */
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-03 16:49:33 +00:00
if ( ( Flags & ( MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER ) ) = = MIXER_OBJECTF_MIXER )
{
/* caller passed mixer id */
MixerHandle = ( HANDLE ) MMixerGetMixerInfoByIndex ( MixerContext , MixerId ) ;
if ( ! MixerHandle )
{
/* invalid parameter */
return MM_STATUS_INVALID_PARAMETER ;
}
}
2009-12-09 16:00:28 +00:00
Flags & = ~ MIXER_OBJECTF_HMIXER ;
2010-12-04 18:53:51 +00:00
DPRINT ( " MMixerGetLineControls MixerId %lu Flags %lu \n " , MixerId , Flags ) ;
2009-12-09 16:00:28 +00:00
if ( Flags = = MIXER_GETLINECONTROLSF_ALL )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-12-07 10:29:57 +00:00
/* get mixer line */
2009-12-09 16:00:28 +00:00
MixerLineSrc = MMixerGetSourceMixerLineByLineId ( MixerInfo , MixerLineControls - > dwLineID ) ;
if ( ! MixerLineSrc )
{
2010-10-15 00:20:15 +00:00
/* invalid line id */
2010-12-04 18:53:51 +00:00
DPRINT ( " MMixerGetLineControls Line not found %lx \n " , MixerLineControls - > dwLineID ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-07 10:29:57 +00:00
if ( MixerLineSrc - > Line . cControls ! = MixerLineControls - > cControls )
{
/* invalid parameter */
DPRINT1 ( " Invalid control count %lu expected %lu \n " , MixerLineControls - > cControls , MixerLineSrc - > Line . cControls ) ;
return MM_STATUS_INVALID_PARAMETER ;
}
2010-10-15 00:20:15 +00:00
/* copy line control(s) */
2010-12-07 10:29:57 +00:00
Entry = MixerLineSrc - > ControlsList . Flink ;
Index = 0 ;
while ( Entry ! = & MixerLineSrc - > ControlsList )
{
/* get mixer control */
MixerControl = ( LPMIXERCONTROL_EXT ) CONTAINING_RECORD ( Entry , MIXERCONTROL_EXT , Entry ) ;
/* copy mixer control */
MixerContext - > Copy ( & MixerLineControls - > pamxctrl [ Index ] , & MixerControl - > Control , sizeof ( MIXERCONTROLW ) ) ;
/* move to next */
Entry = Entry - > Flink ;
2009-12-09 16:00:28 +00:00
2010-12-07 10:29:57 +00:00
/* increment mixer control offset */
Index + + ;
}
2009-12-09 16:00:28 +00:00
return MM_STATUS_SUCCESS ;
}
else if ( Flags = = MIXER_GETLINECONTROLSF_ONEBYTYPE )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-12-04 18:53:51 +00:00
/* get mixer line */
2009-12-09 16:00:28 +00:00
MixerLineSrc = MMixerGetSourceMixerLineByLineId ( MixerInfo , MixerLineControls - > dwLineID ) ;
if ( ! MixerLineSrc )
{
2010-10-15 00:20:15 +00:00
/* invalid line id */
2010-12-04 18:53:51 +00:00
DPRINT1 ( " MMixerGetLineControls Line not found %lx \n " , MixerLineControls - > dwLineID ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-04 18:53:51 +00:00
/* sanity checks */
ASSERT ( MixerLineControls - > cControls = = 1 ) ;
ASSERT ( MixerLineControls - > cbmxctrl = = sizeof ( MIXERCONTROLW ) ) ;
ASSERT ( MixerLineControls - > pamxctrl ! = NULL ) ;
2009-12-09 16:00:28 +00:00
2010-12-07 10:29:57 +00:00
Entry = MixerLineSrc - > ControlsList . Flink ;
while ( Entry ! = & MixerLineSrc - > ControlsList )
2009-12-09 16:00:28 +00:00
{
2010-12-07 10:29:57 +00:00
MixerControl = ( LPMIXERCONTROL_EXT ) CONTAINING_RECORD ( Entry , MIXERCONTROL_EXT , Entry ) ;
if ( MixerLineControls - > dwControlType = = MixerControl - > Control . dwControlType )
2009-12-09 16:00:28 +00:00
{
2010-10-15 00:20:15 +00:00
/* found a control with that type */
2010-12-07 10:29:57 +00:00
MixerContext - > Copy ( MixerLineControls - > pamxctrl , & MixerControl - > Control , sizeof ( MIXERCONTROLW ) ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_SUCCESS ;
}
2010-12-07 10:29:57 +00:00
/* move to next entry */
Entry = Entry - > Flink ;
}
DPRINT ( " DeviceInfo->u.MixControls.dwControlType %x not found in Line %x cControls %u \n " , MixerLineControls - > dwControlType , MixerLineControls - > dwLineID , MixerLineSrc - > Line . cControls ) ;
return MM_STATUS_UNSUCCESSFUL ;
2009-12-09 16:00:28 +00:00
}
else if ( Flags = = MIXER_GETLINECONTROLSF_ONEBYID )
{
2010-10-15 00:20:15 +00:00
/* cast to mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
Status = MMixerGetMixerControlById ( MixerInfo , MixerLineControls - > dwControlID , NULL , & MixerControl , NULL ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid parameter */
2010-12-04 18:53:51 +00:00
DPRINT ( " MMixerGetLineControls ControlID not found %lx \n " , MixerLineControls - > dwLineID ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-04 18:53:51 +00:00
ASSERT ( MixerLineControls - > cControls = = 1 ) ;
ASSERT ( MixerLineControls - > cbmxctrl = = sizeof ( MIXERCONTROLW ) ) ;
ASSERT ( MixerLineControls - > pamxctrl ! = NULL ) ;
2010-12-07 10:29:57 +00:00
DPRINT ( " MMixerGetLineControls ControlID %lx ControlType %lx Name %S \n " , MixerControl - > Control . dwControlID , MixerControl - > Control . dwControlType , MixerControl - > Control . szName ) ;
2010-12-04 18:53:51 +00:00
2010-10-15 00:20:15 +00:00
/* copy the controls */
2010-12-07 10:29:57 +00:00
MixerContext - > Copy ( MixerLineControls - > pamxctrl , & MixerControl - > Control , sizeof ( MIXERCONTROLW ) ) ;
2010-12-04 18:53:51 +00:00
MixerLineControls - > pamxctrl - > szName [ MIXER_LONG_NAME_CHARS - 1 ] = L ' \0 ' ;
MixerLineControls - > pamxctrl - > szShortName [ MIXER_SHORT_NAME_CHARS - 1 ] = L ' \0 ' ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_SUCCESS ;
}
2017-02-06 15:49:23 +00:00
UNIMPLEMENTED ;
2009-12-09 09:51:39 +00:00
return MM_STATUS_NOT_IMPLEMENTED ;
}
MIXER_STATUS
MMixerSetControlDetails (
IN PMIXER_CONTEXT MixerContext ,
IN HANDLE MixerHandle ,
2010-12-03 16:49:33 +00:00
IN ULONG MixerId ,
2009-12-09 09:51:39 +00:00
IN ULONG Flags ,
OUT LPMIXERCONTROLDETAILS MixerControlDetails )
{
MIXER_STATUS Status ;
2009-12-09 16:00:28 +00:00
ULONG NodeId ;
LPMIXER_INFO MixerInfo ;
LPMIXERLINE_EXT MixerLine ;
2010-12-07 10:29:57 +00:00
LPMIXERCONTROL_EXT MixerControl ;
2009-12-09 09:51:39 +00:00
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2010-12-07 10:29:57 +00:00
DPRINT1 ( " invalid context \n " ) ;
2009-12-09 09:51:39 +00:00
return Status ;
}
2009-12-09 16:00:28 +00:00
2010-12-03 16:49:33 +00:00
if ( ( Flags & ( MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER ) ) = = MIXER_OBJECTF_MIXER )
{
/* caller passed mixer id */
MixerHandle = ( HANDLE ) MMixerGetMixerInfoByIndex ( MixerContext , MixerId ) ;
if ( ! MixerHandle )
{
/* invalid parameter */
2010-12-07 10:29:57 +00:00
DPRINT1 ( " invalid handle \n " ) ;
2010-12-03 16:49:33 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
}
2010-10-15 00:20:15 +00:00
/* get mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-10-15 00:20:15 +00:00
/* get mixer control */
2009-12-09 16:00:28 +00:00
Status = MMixerGetMixerControlById ( MixerInfo , MixerControlDetails - > dwControlID , & MixerLine , & MixerControl , & NodeId ) ;
2010-10-15 00:20:15 +00:00
/* check for success */
2009-12-09 16:00:28 +00:00
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* failed to find control id */
2010-12-07 10:29:57 +00:00
DPRINT1 ( " invalid control id %lu \n " , MixerControlDetails - > dwControlID ) ;
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-07 17:46:25 +00:00
DPRINT ( " MMixerSetControlDetails ControlType %lx MixerControlName %S MixerLineName %S NodeID %lu \n " , MixerControl - > Control . dwControlType , MixerControl - > Control . szName , MixerLine - > Line . szName , NodeId ) ;
2010-12-07 10:29:57 +00:00
switch ( MixerControl - > Control . dwControlType )
2009-12-09 16:00:28 +00:00
{
case MIXERCONTROL_CONTROLTYPE_MUTE :
2010-12-07 10:29:57 +00:00
Status = MMixerSetGetMuteControlDetails ( MixerContext , MixerInfo , MixerControl , MixerLine - > Line . dwLineID , MixerControlDetails , TRUE ) ;
2009-12-09 16:00:28 +00:00
break ;
case MIXERCONTROL_CONTROLTYPE_VOLUME :
2010-12-07 10:29:57 +00:00
Status = MMixerSetGetVolumeControlDetails ( MixerContext , MixerInfo , NodeId , TRUE , MixerControl , MixerControlDetails , MixerLine ) ;
2009-12-09 16:00:28 +00:00
break ;
2010-12-08 19:49:28 +00:00
case MIXERCONTROL_CONTROLTYPE_MUX :
Status = MMixerSetGetMuxControlDetails ( MixerContext , MixerInfo , NodeId , TRUE , Flags , MixerControl , MixerControlDetails , MixerLine ) ;
break ;
2009-12-09 16:00:28 +00:00
default :
Status = MM_STATUS_NOT_IMPLEMENTED ;
}
return Status ;
2009-12-09 09:51:39 +00:00
}
MIXER_STATUS
MMixerGetControlDetails (
IN PMIXER_CONTEXT MixerContext ,
IN HANDLE MixerHandle ,
2010-12-03 16:49:33 +00:00
IN ULONG MixerId ,
2009-12-09 09:51:39 +00:00
IN ULONG Flags ,
OUT LPMIXERCONTROLDETAILS MixerControlDetails )
{
MIXER_STATUS Status ;
2009-12-09 16:00:28 +00:00
ULONG NodeId ;
LPMIXER_INFO MixerInfo ;
LPMIXERLINE_EXT MixerLine ;
2010-12-07 10:29:57 +00:00
LPMIXERCONTROL_EXT MixerControl ;
2009-12-09 09:51:39 +00:00
2010-10-15 00:20:15 +00:00
/* verify mixer context */
2009-12-09 09:51:39 +00:00
Status = MMixerVerifyContext ( MixerContext ) ;
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* invalid context passed */
2009-12-09 09:51:39 +00:00
return Status ;
}
2010-12-03 16:49:33 +00:00
if ( ( Flags & ( MIXER_OBJECTF_MIXER | MIXER_OBJECTF_HMIXER ) ) = = MIXER_OBJECTF_MIXER )
{
/* caller passed mixer id */
MixerHandle = ( HANDLE ) MMixerGetMixerInfoByIndex ( MixerContext , MixerId ) ;
if ( ! MixerHandle )
{
/* invalid parameter */
return MM_STATUS_INVALID_PARAMETER ;
}
}
2010-10-15 00:20:15 +00:00
/* get mixer info */
2009-12-09 16:00:28 +00:00
MixerInfo = ( LPMIXER_INFO ) MixerHandle ;
2010-10-15 00:20:15 +00:00
/* get mixer control */
2009-12-09 16:00:28 +00:00
Status = MMixerGetMixerControlById ( MixerInfo , MixerControlDetails - > dwControlID , & MixerLine , & MixerControl , & NodeId ) ;
2010-10-15 00:20:15 +00:00
/* check for success */
2009-12-09 16:00:28 +00:00
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* failed to find control id */
2009-12-09 16:00:28 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-12-07 10:29:57 +00:00
switch ( MixerControl - > Control . dwControlType )
2009-12-09 16:00:28 +00:00
{
case MIXERCONTROL_CONTROLTYPE_MUTE :
2010-12-07 10:29:57 +00:00
Status = MMixerSetGetMuteControlDetails ( MixerContext , MixerInfo , MixerControl , MixerLine - > Line . dwLineID , MixerControlDetails , FALSE ) ;
2009-12-09 16:00:28 +00:00
break ;
case MIXERCONTROL_CONTROLTYPE_VOLUME :
2010-10-15 02:24:35 +00:00
Status = MMixerSetGetVolumeControlDetails ( MixerContext , MixerInfo , NodeId , FALSE , MixerControl , MixerControlDetails , MixerLine ) ;
2009-12-09 16:00:28 +00:00
break ;
2010-12-08 19:49:28 +00:00
case MIXERCONTROL_CONTROLTYPE_ONOFF :
DPRINT1 ( " Not Implemented MIXERCONTROL_CONTROLTYPE_ONOFF \n " ) ;
break ;
case MIXERCONTROL_CONTROLTYPE_MUX :
Status = MMixerSetGetMuxControlDetails ( MixerContext , MixerInfo , NodeId , FALSE , Flags , MixerControl , MixerControlDetails , MixerLine ) ;
break ;
2009-12-09 16:00:28 +00:00
default :
Status = MM_STATUS_NOT_IMPLEMENTED ;
2010-12-08 19:49:28 +00:00
DPRINT1 ( " ControlType %lx not implemented \n " , MixerControl - > Control . dwControlType ) ;
2009-12-09 16:00:28 +00:00
}
return Status ;
2009-12-09 09:51:39 +00:00
}
2010-12-07 10:29:57 +00:00
VOID
MMixerPrintMixerLineControls (
IN LPMIXERLINE_EXT MixerLine )
{
PLIST_ENTRY Entry ;
LPMIXERCONTROL_EXT MixerControl ;
ULONG Index = 0 ;
Entry = MixerLine - > ControlsList . Flink ;
while ( Entry ! = & MixerLine - > ControlsList )
{
MixerControl = ( LPMIXERCONTROL_EXT ) CONTAINING_RECORD ( Entry , MIXERCONTROL_EXT , Entry ) ;
DPRINT1 ( " \n " ) ;
DPRINT1 ( " Control Index: %lu \n " , Index ) ;
DPRINT ( " \n " ) ;
DPRINT1 ( " cbStruct %u \n " , MixerControl - > Control . cbStruct ) ;
DPRINT1 ( " dwControlID %lu \n " , MixerControl - > Control . dwControlID ) ;
DPRINT1 ( " dwControlType %lx \n " , MixerControl - > Control . dwControlType ) ;
DPRINT1 ( " fdwControl %lu \n " , MixerControl - > Control . fdwControl ) ;
DPRINT1 ( " cMultipleItems %lu \n " , MixerControl - > Control . cMultipleItems ) ;
DPRINT1 ( " szShortName %S \n " , MixerControl - > Control . szShortName ) ;
DPRINT1 ( " szName %S \n " , MixerControl - > Control . szName ) ;
DPRINT1 ( " Bounds.dwMinimum %lu \n " , MixerControl - > Control . Bounds . dwMinimum ) ;
DPRINT1 ( " Bounds.dwMaximum %lu \n " , MixerControl - > Control . Bounds . dwMaximum ) ;
DPRINT1 ( " Metrics.Reserved[0] %lu \n " , MixerControl - > Control . Metrics . dwReserved [ 0 ] ) ;
DPRINT1 ( " Metrics.Reserved[1] %lu \n " , MixerControl - > Control . Metrics . dwReserved [ 1 ] ) ;
DPRINT1 ( " Metrics.Reserved[2] %lu \n " , MixerControl - > Control . Metrics . dwReserved [ 2 ] ) ;
DPRINT1 ( " Metrics.Reserved[3] %lu \n " , MixerControl - > Control . Metrics . dwReserved [ 3 ] ) ;
DPRINT1 ( " Metrics.Reserved[4] %lu \n " , MixerControl - > Control . Metrics . dwReserved [ 4 ] ) ;
DPRINT1 ( " Metrics.Reserved[5] %lu \n " , MixerControl - > Control . Metrics . dwReserved [ 5 ] ) ;
Entry = Entry - > Flink ;
Index + + ;
}
}
2010-12-04 17:45:48 +00:00
VOID
MMixerPrintMixers (
IN PMIXER_CONTEXT MixerContext ,
IN PMIXER_LIST MixerList )
{
2010-12-05 18:01:24 +00:00
ULONG Index , SubIndex , DestinationLineID , SrcIndex ;
2010-12-04 17:45:48 +00:00
LPMIXER_INFO MixerInfo ;
2010-12-05 18:01:24 +00:00
LPMIXERLINE_EXT DstMixerLine , SrcMixerLine ;
2010-12-04 17:45:48 +00:00
DPRINT1 ( " MixerList %p \n " , MixerList ) ;
DPRINT1 ( " MidiInCount %lu \n " , MixerList - > MidiInListCount ) ;
DPRINT1 ( " MidiOutCount %lu \n " , MixerList - > MidiOutListCount ) ;
DPRINT1 ( " WaveInCount %lu \n " , MixerList - > WaveInListCount ) ;
DPRINT1 ( " WaveOutCount %lu \n " , MixerList - > WaveOutListCount ) ;
DPRINT1 ( " MixerCount %p \n " , MixerList - > MixerListCount ) ;
for ( Index = 0 ; Index < MixerList - > MixerListCount ; Index + + )
{
/* get mixer info */
MixerInfo = MMixerGetMixerInfoByIndex ( MixerContext , Index ) ;
ASSERT ( MixerInfo ) ;
DPRINT1 ( " \n " ) ;
DPRINT1 ( " Name :%S \n " , MixerInfo - > MixCaps . szPname ) ;
DPRINT1 ( " cDestinations: %lu \n " , MixerInfo - > MixCaps . cDestinations ) ;
DPRINT1 ( " fdwSupport %lu \n " , MixerInfo - > MixCaps . fdwSupport ) ;
DPRINT1 ( " vDriverVersion %lx \n " , MixerInfo - > MixCaps . vDriverVersion ) ;
DPRINT1 ( " wMid %lx \n " , MixerInfo - > MixCaps . wMid ) ;
DPRINT1 ( " wPid %lx \n " , MixerInfo - > MixCaps . wPid ) ;
for ( SubIndex = 0 ; SubIndex < MixerInfo - > MixCaps . cDestinations ; SubIndex + + )
{
/* calculate destination line id */
DestinationLineID = ( SubIndex + DESTINATION_LINE ) ;
/* get destination line */
DstMixerLine = MMixerGetSourceMixerLineByLineId ( MixerInfo , DestinationLineID ) ;
2010-12-07 10:29:57 +00:00
DPRINT1 ( " //---------------------------------------------------------------------------------------------- \n " ) ;
DPRINT1 ( " \n " ) ;
DPRINT1 ( " Destination Index %lu \n " , SubIndex ) ;
2010-12-04 17:45:48 +00:00
DPRINT1 ( " \n " ) ;
DPRINT1 ( " cChannels %lu \n " , DstMixerLine - > Line . cChannels ) ;
DPRINT1 ( " cConnections %lu \n " , DstMixerLine - > Line . cConnections ) ;
DPRINT1 ( " cControls %lu \n " , DstMixerLine - > Line . cControls ) ;
DPRINT1 ( " dwComponentType %lx \n " , DstMixerLine - > Line . dwComponentType ) ;
DPRINT1 ( " dwDestination %lu \n " , DstMixerLine - > Line . dwDestination ) ;
DPRINT1 ( " dwLineID %lx \n " , DstMixerLine - > Line . dwLineID ) ;
DPRINT1 ( " dwSource %lx \n " , DstMixerLine - > Line . dwSource ) ;
DPRINT1 ( " dwUser %lu \n " , DstMixerLine - > Line . dwUser ) ;
DPRINT1 ( " fdwLine %lu \n " , DstMixerLine - > Line . fdwLine ) ;
DPRINT1 ( " szName %S \n " , DstMixerLine - > Line . szName ) ;
DPRINT1 ( " szShortName %S \n " , DstMixerLine - > Line . szShortName ) ;
DPRINT1 ( " Target.dwDeviceId %lu \n " , DstMixerLine - > Line . Target . dwDeviceID ) ;
DPRINT1 ( " Target.dwType %lu \n " , DstMixerLine - > Line . Target . dwType ) ;
DPRINT1 ( " Target.szName %S \n " , DstMixerLine - > Line . Target . szPname ) ;
DPRINT1 ( " Target.vDriverVersion %lx \n " , DstMixerLine - > Line . Target . vDriverVersion ) ;
DPRINT1 ( " Target.wMid %lx \n " , DstMixerLine - > Line . Target . wMid ) ;
DPRINT1 ( " Target.wPid %lx \n " , DstMixerLine - > Line . Target . wPid ) ;
2010-12-07 10:29:57 +00:00
MMixerPrintMixerLineControls ( DstMixerLine ) ;
2010-12-05 18:01:24 +00:00
for ( SrcIndex = 0 ; SrcIndex < DstMixerLine - > Line . cConnections ; SrcIndex + + )
{
/* calculate destination line id */
DestinationLineID = ( SOURCE_LINE * SrcIndex ) + SubIndex ;
/* get source line */
SrcMixerLine = MMixerGetSourceMixerLineByLineId ( MixerInfo , DestinationLineID ) ;
2010-12-07 10:29:57 +00:00
DPRINT1 ( " //============================================================================================== \n " ) ;
2010-12-05 18:01:24 +00:00
DPRINT1 ( " \n " ) ;
2010-12-07 10:29:57 +00:00
DPRINT1 ( " SrcLineIndex : %lu \n " , SrcIndex ) ;
2010-12-05 18:01:24 +00:00
DPRINT1 ( " \n " ) ;
DPRINT1 ( " cChannels %lu \n " , SrcMixerLine - > Line . cChannels ) ;
DPRINT1 ( " cConnections %lu \n " , SrcMixerLine - > Line . cConnections ) ;
DPRINT1 ( " cControls %lu \n " , SrcMixerLine - > Line . cControls ) ;
DPRINT1 ( " dwComponentType %lx \n " , SrcMixerLine - > Line . dwComponentType ) ;
DPRINT1 ( " dwDestination %lu \n " , SrcMixerLine - > Line . dwDestination ) ;
DPRINT1 ( " dwLineID %lx \n " , SrcMixerLine - > Line . dwLineID ) ;
DPRINT1 ( " dwSource %lx \n " , SrcMixerLine - > Line . dwSource ) ;
DPRINT1 ( " dwUser %lu \n " , SrcMixerLine - > Line . dwUser ) ;
DPRINT1 ( " fdwLine %lu \n " , SrcMixerLine - > Line . fdwLine ) ;
DPRINT1 ( " szName %S \n " , SrcMixerLine - > Line . szName ) ;
DPRINT1 ( " szShortName %S \n " , SrcMixerLine - > Line . szShortName ) ;
DPRINT1 ( " Target.dwDeviceId %lu \n " , SrcMixerLine - > Line . Target . dwDeviceID ) ;
DPRINT1 ( " Target.dwType %lu \n " , SrcMixerLine - > Line . Target . dwType ) ;
DPRINT1 ( " Target.szName %S \n " , SrcMixerLine - > Line . Target . szPname ) ;
DPRINT1 ( " Target.vDriverVersion %lx \n " , SrcMixerLine - > Line . Target . vDriverVersion ) ;
DPRINT1 ( " Target.wMid %lx \n " , SrcMixerLine - > Line . Target . wMid ) ;
DPRINT1 ( " Target.wPid %lx \n " , SrcMixerLine - > Line . Target . wPid ) ;
2010-12-07 10:29:57 +00:00
MMixerPrintMixerLineControls ( SrcMixerLine ) ;
2010-12-05 18:01:24 +00:00
}
2010-12-04 17:45:48 +00:00
}
}
}
2009-12-07 10:28:49 +00:00
MIXER_STATUS
MMixerInitialize (
2009-12-08 21:10:02 +00:00
IN PMIXER_CONTEXT MixerContext ,
2009-12-07 10:28:49 +00:00
IN PMIXER_ENUM EnumFunction ,
IN PVOID EnumContext )
{
MIXER_STATUS Status ;
2009-12-18 10:25:41 +00:00
HANDLE hMixer , hKey ;
2009-12-07 10:28:49 +00:00
ULONG DeviceIndex , Count ;
LPWSTR DeviceName ;
2009-12-18 10:25:41 +00:00
LPMIXER_DATA MixerData ;
2009-12-09 09:51:39 +00:00
PMIXER_LIST MixerList ;
2009-12-18 10:25:41 +00:00
PLIST_ENTRY Entry ;
2009-12-07 10:28:49 +00:00
if ( ! MixerContext | | ! EnumFunction | | ! EnumContext )
{
2010-10-15 00:20:15 +00:00
/* invalid parameter */
2009-12-07 10:28:49 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-01-02 01:52:12 +00:00
if ( ! MixerContext - > Alloc | | ! MixerContext - > Control | | ! MixerContext - > Free | | ! MixerContext - > Open | |
! MixerContext - > AllocEventData | | ! MixerContext - > FreeEventData | |
2009-12-18 10:25:41 +00:00
! MixerContext - > Close | | ! MixerContext - > OpenKey | | ! MixerContext - > QueryKeyValue | | ! MixerContext - > CloseKey )
2009-12-07 10:28:49 +00:00
{
2010-10-15 00:20:15 +00:00
/* invalid parameter */
2009-12-07 10:28:49 +00:00
return MM_STATUS_INVALID_PARAMETER ;
}
2010-10-15 00:20:15 +00:00
/* allocate a mixer list */
2009-12-09 09:51:39 +00:00
MixerList = ( PMIXER_LIST ) MixerContext - > Alloc ( sizeof ( MIXER_LIST ) ) ;
if ( ! MixerList )
{
2010-10-15 00:20:15 +00:00
/* no memory */
2009-12-09 09:51:39 +00:00
return MM_STATUS_NO_MEMORY ;
}
2010-10-15 00:20:15 +00:00
/* initialize mixer list */
2009-12-09 09:51:39 +00:00
MixerList - > MixerListCount = 0 ;
2009-12-18 10:25:41 +00:00
MixerList - > MixerDataCount = 0 ;
2009-12-20 00:55:55 +00:00
MixerList - > WaveInListCount = 0 ;
MixerList - > WaveOutListCount = 0 ;
2010-10-31 14:34:41 +00:00
MixerList - > MidiInListCount = 0 ;
MixerList - > MidiOutListCount = 0 ;
2009-12-09 09:51:39 +00:00
InitializeListHead ( & MixerList - > MixerList ) ;
2009-12-18 10:25:41 +00:00
InitializeListHead ( & MixerList - > MixerData ) ;
2009-12-20 00:55:55 +00:00
InitializeListHead ( & MixerList - > WaveInList ) ;
InitializeListHead ( & MixerList - > WaveOutList ) ;
2010-10-31 14:34:41 +00:00
InitializeListHead ( & MixerList - > MidiInList ) ;
InitializeListHead ( & MixerList - > MidiOutList ) ;
2009-12-07 10:28:49 +00:00
2010-10-15 00:20:15 +00:00
/* store mixer list */
2009-12-10 12:27:16 +00:00
MixerContext - > MixerContext = ( PVOID ) MixerList ;
2010-10-15 00:20:15 +00:00
/* start enumerating all available devices */
2009-12-07 10:28:49 +00:00
Count = 0 ;
DeviceIndex = 0 ;
do
{
2010-10-15 00:20:15 +00:00
/* enumerate a device */
2009-12-18 10:25:41 +00:00
Status = EnumFunction ( EnumContext , DeviceIndex , & DeviceName , & hMixer , & hKey ) ;
2009-12-07 10:28:49 +00:00
if ( Status ! = MM_STATUS_SUCCESS )
{
2010-10-15 00:20:15 +00:00
/* check error code */
2009-12-10 12:27:16 +00:00
if ( Status = = MM_STATUS_NO_MORE_DEVICES )
2009-12-07 10:28:49 +00:00
{
2010-10-15 00:20:15 +00:00
/* enumeration has finished */
2009-12-10 12:27:16 +00:00
break ;
2009-12-07 10:28:49 +00:00
}
2010-06-09 16:51:16 +00:00
else
{
DPRINT1 ( " Failed to enumerate device %lu \n " , DeviceIndex ) ;
2010-10-15 00:20:15 +00:00
/* TODO cleanup */
2010-06-09 16:51:16 +00:00
return Status ;
}
2009-12-07 10:28:49 +00:00
}
2009-12-10 12:27:16 +00:00
else
{
2010-10-15 00:20:15 +00:00
/* create a mixer data entry */
2009-12-18 10:25:41 +00:00
Status = MMixerCreateMixerData ( MixerContext , MixerList , DeviceIndex , DeviceName , hMixer , hKey ) ;
if ( Status ! = MM_STATUS_SUCCESS )
break ;
2009-12-10 12:27:16 +00:00
}
2009-12-07 10:28:49 +00:00
2010-10-15 00:20:15 +00:00
/* increment device index */
2009-12-07 10:28:49 +00:00
DeviceIndex + + ;
} while ( TRUE ) ;
2010-10-15 00:20:15 +00:00
/* now all filters have been pre-opened
* lets enumerate the filters
*/
2009-12-18 10:25:41 +00:00
Entry = MixerList - > MixerData . Flink ;
while ( Entry ! = & MixerList - > MixerData )
{
MixerData = ( LPMIXER_DATA ) CONTAINING_RECORD ( Entry , MIXER_DATA , Entry ) ;
MMixerSetupFilter ( MixerContext , MixerList , MixerData , & Count ) ;
Entry = Entry - > Flink ;
}
2010-12-07 10:29:57 +00:00
Entry = MixerList - > MixerData . Flink ;
while ( Entry ! = & MixerList - > MixerData )
{
MixerData = ( LPMIXER_DATA ) CONTAINING_RECORD ( Entry , MIXER_DATA , Entry ) ;
/* now handle alternative mixer types */
MMixerHandleAlternativeMixers ( MixerContext , MixerList , MixerData , MixerData - > Topology ) ;
Entry = Entry - > Flink ;
}
//MMixerPrintMixers(MixerContext, MixerList);
2010-12-04 17:45:48 +00:00
2010-10-15 00:20:15 +00:00
/* done */
2009-12-10 12:27:16 +00:00
return MM_STATUS_SUCCESS ;
2009-12-07 10:28:49 +00:00
}