DSshow: DirectSound Mixing Test

Click to open or copy the files for the DSshow sample.

The DSshow application uses the DirectSound APIs and pops up some controls that the user can play with at run time to change the sound frequency, panning, volume, etc. It also has a few other built-in functions.

This application allows the user to play with most of the controls exposed by DirectSoundBuffers, including the mixing of multiple sounds, and changing frequency, pan, and volume of those sounds.

The control bar for each opened WAV file shows the file name, whether the buffer is mixed in software (SW) or hardware (HW), and whether the buffer is playing or stopped.  DSshow puts buffers in hardware whenever possible.  DSshow also displays the current play and write cursors.  There are sliders to control the buffer's frequency, pan, and volume settings.  There is a Play/Stop button, a Close button, and a checkbox for Looping.

The DSshow title bar tells you information about the hardware mixing capabilities of your sound card.  It displays the number of free hardware mixing channels and hardware memory, if you have an ISA card, which is most common.  If both of those numbers are 0, your card does not have hardware mixing.

The Options menu enables you to set the format of the primary buffer.  This lists the formats supported by the primary buffer, and let you choose one.  Enumerate Drivers, on the Options menu, shows you what objects DirectSoundEnumerate will list for you, and allows you to select an object.

Caution   DSshow uses static buffers for its sounds and is therefore designed for short sounds only. If you try to open a file that is very large, you will run out of system memory.

Building SDK Samples

This sample uses the following keywords:

_assert; _based; _segname; acmmetrics; addtolist; appdestroy; appinit; assert; assertfail; assertmessage; batchopenfiles; changeoutputfreq; changeoutputpan; changeoutputvol; charlower; checkmenuitem; classinit; cocreateinstance; coinitialize; combobox_addstring; combobox_findstring; combobox_getcount; combobox_getcursel; combobox_getitemdata; combobox_setcursel; combobox_setitemdata; copymemory; couninitialize; createcontrol; createsoundbuffer; createwindow; dbgenable; dbggetlevel; dbginitialize; dbgsetlevel; defwindowproc; destroywindow; dialogbox; dialogboxparam; directsoundenumerate; dispatchmessage; dlgchecklatency; dlghelpabout; dlgoutputbuffertype; dodsoundenumerate; dpf; dpi; dprintf; dsenumdlgproc; dsenumproc; enddialog; fgettoken; fileopencustomtemplatedlgproc; fmatchtoken; formattoindex; freealllist; getdc; getdlgitem; getformat; getmediastartpath; getmenu; getmessage; getnextcontrolcoords; getnumcontrols; getopenfilename; getprofileint; getstatus; gettextextentpoint32; getwindowsdirectory; globalalloc; globalallocptr; globalfree; globalfreeptr; idirectsound_createsoundbuffer; idirectsound_getcaps; idirectsound_initialize; idirectsound_release; idirectsound_setcooperativelevel; idirectsoundbuffer_getcaps; idirectsoundbuffer_getcurrentposition; idirectsoundbuffer_getstatus; idirectsoundbuffer_lock; idirectsoundbuffer_play; idirectsoundbuffer_release; idirectsoundbuffer_restore; idirectsoundbuffer_stop; idirectsoundbuffer_unlock; indextoformat; initcommoncontrols; isvalidwave; killtimer; loadcursor; loadicon; localalloc; localfree; lock; lstrcat; lstrcmp; lstrcpy; lstrlen; makeintresource; makelong; makewparam; memcpy; memset; messagebox; mmioadvance; mmioascend; mmioclose; mmiocreatechunk; mmiodescend; mmiofourcc; mmiogetinfo; mmioopen; mmioread; mmioseek; mmiosetinfo; mmiowrite; newdirectsoundbuffer; openfiledialog; outputdebugstr; parsecommandline; pd_fileopen; play; postmessage; postquitmessage; regclosekey; registerclass; regopenkeyex; regqueryvalueex; release; releasedc; releasedirectsoundbuffer; removefromlist; riffcopychunk; senddlgitemmessage; sendmessage; setalltext; setcurrentposition; setformat; setfrequency; setpan; settimer; setvolume; setwindowtext; showwindow; sprintf; startdsound; stop; stopalldsounds; stopdsound; strcpy; succeeded; switch; text; translatemessage; uimainwindowcmdhandler; uimainwindowhsbhandler; uimainwindowtimerhandler; uimainwindowvsbhandler; unlock; unregisterclass; updatelrvolume; updatemainstatus; updatestatus; warning; waveclosereadfile; waveclosewritefile; wavecopyuselesschunks; wavecreatefile; waveloadfile; waveopenfile; wavereadfile; wavesavefile; wavestartdataread; wavestartdatawrite; wavewritefile; winmain; wndproc; writeprofilestring; wsprintf; zeromemory