DirectMusic Software Synthesizer

Summary

This sample contains working source code for a kernel-mode software synthesizer that plugs into the Microsoft® DirectMusic® and WDM Audio architectures.

Building a new DirectMusic Synthesizer

You are encouraged to use this sample code to start building your own software synthesizer. Modify the sample to add your own features.

If you ship your synthesizer to customers, be sure to use the Guidgen program to create a Globally Unique ID (GUID) for your synthesizer so it won't interfere with other synthesizers. Set CLSID_DDKWDMSynth at the top of private.h and ddksynth.inf to be your GUID. You should also set the text in miniport.cpp, ddksynth.rc and ddksynth.inf to describe your synthesizer.

Note: this is a software synthesizer sample, but is also relevant as a hardware driver sample. If you are writing a hardware driver, you should 1) not implement the wave pin, 2) not implement a synthsink nor depend on Render being called from the port (the hardware should notify the miniport if it needs additional work done at buffer render time), and 3) use category RENDER instead of DATATRANSFORM.

Creating a User-mode Synthesizer

Although this sample doesn't show you how to create a user-mode synthesizer, you can start with the user-mode sample to feel out how synthesis and DLS downloads work. We recommend that you try out your ideas and get things working in user-mode before moving to kernel mode. This approach might be easier and save a bit of debugging time.

Building the Sample

Open a free or checked DDK build environment, go to the sample directory, and run build. This creates ddksynth.sys in the Objfre or Objchk subdirectories. Before the sample can be used, it must be installed by executing ddksynth.inf.

Testing the Synthesizer

To test the synthesizer, open DirectMusic Producer and open the Port Configuration window. (You can do this by right-clicking the button showing a 1 or 2 with a sound wave behind it on the Transit Controls toolbar.) The port name dropdown will now contain the option Microsoft DDK Synthesizer (WDM) in addition to the Microsoft Synthesizer (WDM) option. Set one of the configurations to use the Microsoft DDK Synthesizer port.

Then, when you play music through that configuration, it will be played by the synthesizer you built from the DDK sample. The sound and capabilities of the DDK sample -- Microsoft DDK Synthesizer (WDM) -- are virtually identical to the kernel-mode DirectMusic synthesizer -- Microsoft Synthesizer (WDM). One major exception is that the DDK sample synthesizer does not support reverb.

Supported Configurations

The DDK sample synthesizer has been tested in checked and free builds with Microsoft Visual C++® version 6. It has been tested on Alpha, but not on 64-bit platforms.

Plug and Play as well as Power Management are supported by PortCls on behalf of the synthesizer.

CODE TOUR

File Manifest

File			Description

adapter.cpp		Implementation of WDM adapter
clist.cpp		Implements a simple list data structure
clist.h			Prototypes for clist.cpp
common.h		Master header file 
control.cpp		CControlLogic implementation 
csynth.cpp		CSynth implementation
csynth.h		Prototypes for csynth.cpp
DDKSynth.rc		Resources file containng version information
instr.cpp		Implements instruments
kernhelp.cpp		Helper functions to keep code common between user and kernel modes
kernhelp.h		Prototype file for kernhelp.h
makefile		Makefile for BUILD environment
midi.cpp		Implements MIDI events
miniport.cpp		Implementation of WDM miniport
mix.cpp			CDigitalAudio mixing functions
mmx.cpp			MMX-optimized mixing functions
muldiv32.h		High-resolution multiply-divide operations
plclock.cpp		Clock implementation
plclock.h		Prototypes for plclock.cpp
private.h		Prototypes for adapter.cpp, miniport.cpp, and syslink.cpp
sources			Sources file for BUILD environment 
synth.h			Prototypes for instr.cpp, midi.cpp, voice.cpp, and control.cpp
syslink.cpp		Wave interface back into PortCls
voice.cpp		Voice implementation




Top of page

© 1999-2000 Microsoft Corporation. All rights reserved.