How to use the DDKSynth audio sample on Windows 98 and on Windows Millennium Edition (318772)



The information in this article applies to:

  • Microsoft Windows 98 Second Edition
  • Microsoft Windows Millennium Edition
  • Microsoft Windows 2000 Driver Development Kit (DDK)

This article was previously published under Q318772

SUMMARY

This article describes how to modify the DDKSynth audio sample that is included in Microsoft Windows 2000 Driver Development Kit. After you modify the sample, you can use the sample on Microsoft Windows 98 and on Microsoft Windows Millennium Edition.

This article also includes a modification of the Miniport.cpp file. The modification adds a pin for a MIDI device that is earlier than the Windows Driver Model (WDM) version (pre-WDM MIDI).

This modification of the Miniport.cpp file applies to the following operating systems:
  • Microsoft Windows 98
  • Microsoft Windows Millennium Edition
  • Microsoft Windows 2000
  • Microsoft Windows XP

MORE INFORMATION

Build a binary

To build a binary that is compatible with Windows 98 and Windows Millennium Edition, change the Sources file so that the UNDER_NT preprocessor definition is not defined. The following code demonstrates the change in the Sources file.
#removed C_DEFINES= $(C_DEFINES) -D_WIN32 -DUNICODE -D_UNICODE -DUNDER_NT
C_DEFINES= $(C_DEFINES) -D_WIN32 -DUNICODE -D_UNICODE
				

Modify the Miniport.cpp file

To support a pre-WDM MIDI pin so that the device appears in Control Panel, change the Miniport.cpp filee as shown in the following code.

Note These modifications for a pre-WDM MIDI pin apply to the operating systems that are listed in the "Summary" section of this article.
/*****************************************************************************
 * PinDataRangesStream[]
 *****************************************************************************
 * Structures that indicate range of valid format values for streaming pins.
 * If your device can also support earlier versions of MIDI, include a second data range
 * here that supports KSDATAFORMAT_SUBTYPE_MIDI.
 */ 
//New code for legacy support.
static const
	KSDATARANGE_MUSIC
	PinDataRangesStreamLegacy[] =
{
	{
		{
			sizeof(KSDATARANGE_MUSIC),
			0,
			0,
			0,
			STATICGUIDOF(KSDATAFORMAT_TYPE_MUSIC),
			STATICGUIDOF(KSDATAFORMAT_SUBTYPE_MIDI),
			STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
		},
		STATICGUIDOF(KSMUSIC_TECHNOLOGY_WAVETABLE),
		0,
		0,
		0xFFFF
	}
};
//End new code for legacy support.

static const
    KSDATARANGE_MUSIC
    PinDataRangesStream[] =
{
    {
        {
            sizeof(KSDATARANGE_MUSIC),
            0,
            0,
            0,
            STATICGUIDOF(KSDATAFORMAT_TYPE_MUSIC),
            STATICGUIDOF(KSDATAFORMAT_SUBTYPE_DIRECTMUSIC),
            STATICGUIDOF(KSDATAFORMAT_SPECIFIER_NONE)
        },
        STATICGUIDOF(KSMUSIC_TECHNOLOGY_WAVETABLE),
        0,                                      // Channels
        0,                                      // Notes
        0x0000ffff                              // ChannelMask
    }
};
/**************************************************************************
 * PinDataRangePointersStream[]
 *****************************************************************************
 * List of pointers to structures that indicate the range of valid format values
 * for streaming pins.
 */ 
static const
    PKSDATARANGE
    PinDataRangePointersStream[] =
{
    PKSDATARANGE(&PinDataRangesStreamLegacy), //for legacy midi support
    PKSDATARANGE(&PinDataRangesStream[0])
};
				

Sample code

The following code sample demonstrates the modified .inf file for Windows 98 and for Windows Millennium Edition.
[Version]
Signature="$CHICAGO$"
Class=MEDIA
ClassGUID={4d36e96c-e325-11ce-bfc1-08002be10318}
provider=%MSFT%
DriverVer =06/16/1999,5.00.2062.1

[Manufacturer]
%DDKMfgName%=Microsoft

[DefaultInstall]
AddReg = WDM_DDKSYNTH.DeviceRegistration
CopyFiles = Default.CopyFiles

[Default.CopyFiles]
ddksynth.inf

[Microsoft]
%WDM_DDKSYNTH.DeviceDesc%   = WDM_DDKSYNTH,  SW\{820DC38A-1F81-11d3-A82E-0060083316C1}
;;  Replace this with your GUID, same as the Private.h file.

;You may specify the specific platform that is supported by each SourceDisksNames section.
;Valid platform identifiers include .x86, .ia64, .alpha, and .axp64.

[SourceDisksNames]
222=%DiskDescription%,,,

;You may also specify the specific platform that is supported by each SourceDisksFiles section.
;Valid platform identifiers include .x86, .ia64, .alpha, and .axp64.

[SourceDisksFiles]
ddksynth.sys=222
;;ddksynth.inf=222

;; Destination Directory List

[DestinationDirs]
WDM_DDKSYNTH.CopyFiles = 10,system32\drivers ; %SystemRoot%\system32\drivers
Default.CopyFiles = 10,inf

[WDM_DDKSYNTH.CopyFiles]
ddksynth.sys

;;
;; DDKSynth swenum install
;;

[WDM_DDKSYNTH.DeviceRegistration]
HKLM,%RunOnce%,"WDM_DDKSYNTH0",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_DDKSYNTH.DeviceId%,%KSNAME_DDKSYNTH%,%KSCATEGORY_DATATRANSFORM%,%01%\ddksynth.inf,WDM_DDKSYNTH.Interface.Install"
HKLM,%RunOnce%,"WDM_DDKSYNTH1",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_DDKSYNTH.DeviceId%,%KSNAME_DDKSYNTH%,%KSCATEGORY_SYNTHESIZER%,%01%\ddksynth.inf,WDM_DDKSYNTH.Interface.Install"
HKLM,%RunOnce%,"WDM_DDKSYNTH2",,"rundll32.exe streamci.dll,StreamingDeviceSetup %WDM_DDKSYNTH.DeviceId%,%KSNAME_DDKSYNTH%,%KSCATEGORY_AUDIO%,%01%\ddksynth.inf,WDM_DDKSYNTH.Interface.Install"
HKLM,%MediaCategories%\%WDM_DDKSYNTH.GUID%,Name,,%WDM_DDKSYNTH.Pin%
HKLM,%MediaCategories%\%WDM_DDKSYNTH.GUID%,Display,1,00,00,00,00


[WDM_DDKSYNTH.Interface.Install]
AddReg=WDM_DDKSYNTH.Interface.AddReg

[WDM_DDKSYNTH.Interface.AddReg]
HKR,,CLSID,,%Proxy.CLSID%
HKR,,FriendlyName,,%WDM_DDKSYNTH.FriendlyName%



;;**************** 9x Specific ****************
;;
;; DDKSynth Install
;;

[WDM_DDKSYNTH]
;;AlsoInstall=KS.Registration(ks.inf), WDM.AddReg.Install(wdmaudio.inf)
AlsoInstall=KS.Registration(ks.inf)
CopyFiles = WDM_DDKSYNTH.CopyFiles
AddReg=WDM_DDKSYNTH.AddReg

[WDM_DDKSYNTH.AddReg]
HKR,,DevLoader,,*NTKERN
HKR,,NTMPDriver,,ddksynth.sys

[WDM_DDKSYNTH.Services]
AddService = ddksynth, 0x00000002, DDKSynth_Service_Inst


[DDKSynth_Service_Inst]
DisplayName    = %WDM_DDKSYNTH.SvcDesc%
ServiceType    = 1                  ; SERVICE_KERNEL_DRIVER
StartType      = 3                  ; SERVICE_SYSTEM_START
ErrorControl   = 1                  ; SERVICE_ERROR_NORMAL
ServiceBinary  = %10%\system32\drivers\ddksynth.sys


;;**************** NT Specific ****************
;;
;; DDKSynth Install
;;

[WDM_DDKSYNTH.NT]
Include=ks.inf, wdmaudio.inf
Needs=KS.Registration, WDMAUDIO.Registration
CopyFiles = WDM_DDKSYNTH.CopyFiles
AddReg=WDM_DDKSYNTH.DeviceRegistration

[WDM_DDKSYNTH.NT.Services]
AddService = DDKSynth, 0x00000002, DDKSynth_Service_Inst


;;*********************************************
[Strings]

MSFT="Microsoft"
DDKMfgName="doughowe - DDK Sample Inc."
DiskDescription="doughowe - DDK Sample"

RunOnce = "SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce"
MediaCategories="SYSTEM\CurrentControlSet\Control\MediaCategories"
Proxy.CLSID             =   "{17CCA71B-ECD7-11D0-B908-00A0C9223196}"
KSNAME_Filter           =   "{9B365890-165F-11D0-A195-0020AFD156E4}"
KSNAME_DDKSYNTH         =   "ddksynth"


;;**** GUIDGen your own (WDM_DDKSYNTH.GUID, WDM_DDKSYNTH.DeviceID). Put them here and in Private.h ****
;;
WDM_DDKSYNTH.GUID         = "{D2D37597-A312-434C-A2DD-2B4C32E6658A}"
WDM_DDKSYNTH.DeviceId   =   "{820DC38A-1F81-11d3-A82E-0060083316C1}"

WDM_DDKSYNTH.Pin="Microsoft DDK DLS Synth sample"



KSCATEGORY_DATATRANSFORM =  "{2EB07EA0-7E70-11D0-A5D6-28DB04C10000}"
KSCATEGORY_SYNTHESIZER   =  "{DFF220F3-F70F-11D0-B917-00A0C9223196}"
KSCATEGORY_AUDIO         =  "{6994AD04-93EF-11D0-A3CC-00A0C9223196}"

WDM_DDKSYNTH.DeviceDesc   = " doughowe - Microsoft DDK Synthesizer (WDM)"
WDM_DDKSYNTH.FriendlyName = " Friendly Name - doughowe - Microsoft DDK Synthesizer (WDM)"
WDM_DDKSYNTH.SvcDesc      = " doughowe - Microsoft DDK Synthesizer (WDM)"


Modification Type:MinorLast Reviewed:9/28/2004
Keywords:kbcode kbDDK kbinfo KB318772 kbAudDeveloper