Compiler can't #include dmusici.h

Started by
21 comments, last by regenc 10 years ago
I'm struggling at the moment to get audio set up for my DX9 App. I've got D3D up and running and have created Tetris using D3DXSprite, and I now want to add sound. I've tried a couple of tutorials, as well as just figuring it out myself from the SDK documentation. I got confused from the SDK docs, so I came back to tutorials, but I keep running into the same problem: these tuts are telling me to #include <dmusici.h>, but VC++ 08 tells me "fatal error C1083: Cannot open include file: 'dmusici.h': No such file or directory" So what would I need to include or link or set as an include directory for dmusici.h that I wouldn't have already done to get D3D(X) to work??? cheers, metal
Advertisement
Find where you installed the DirectX SDK and look in the include folder.
Does it have a dmusici.h?

How about a dmusic.h?
Nope. It has nothing starting with the letters "dm". I tried a bunch of combinations like dmusic, daudio, dsound, directmusic, directaudio, directsound etc, and the only things I came up with were dsound.h and audiodefs.h. Neither of them reference anything like dmusic.h or dmusici.h either. Also, different caps combinations don't help.
I had the same thought that you seem to have had, that that extra 'i' shouldn't be on the end of the filename, but 2 seperate resources gave me the same filename.
One of them is two-kings, in case anyone has had previous success/troubles with that one:
http://www.two-kings.de/tutorials/dxaudio/

cheers,
metal
One other thing- I also tried windows' search thing to see if there was any file with 'music' in the filename inside the folders of the DX SDK or the Windows SDK.
Nothing. (well, 2 .wavs but they don't help)
The August 2007 DirectX SDK (which can be downloaded here) was "the final release of the DirectX SDK that will contain the following components: DirectMusic".
Ah. I have the November 07 SDK. So what does that mean for me? Will the functions etc in these tutorials not work? Or are they included in DSound.h instead?
I guess I'll just work my way through the two-kings tutorial and see if stuff compiles.
As a side note, the documentation for Nov 07 still mentions DirectMusic and Dmusici.h in its first "Getting Started with DirectSound" article, "Building DirectSound Projects." To be honest, I wasn't really aware they were seperate APIs. I guess I figured they were both parts of DirectX Audio or something like that. Thanks very much for that.

cheers,
metal
OK I'm getting really frustrated now. I can't compile any of the stuff from the two-kings tutorial because it all requires dmusici.h, which I don't have because it's deprecated. I'm not a fan of using deprecated stuff, but there don't seem to be any tutorials around that just use DirectSound, because none of them are brand-spanking new. I can figure some stuff out about how to use directsound from the SDK Docs, but I keep getting stuck with what to put for certain parameters of functions etc.
So should I just give up and find dmusici.h somewhere and add it to my include folder? In that case can someone let me know where I can get it without downloading the whole previous DX SDK?
Or should I leave directmusic well enough alone and just use directsound, like they want us to? In that case, could someone point me in the direction of a good, UP TO DATE tutorial?

cheers,
metal
I have an older SDK but you might search for CSoundManager in your SDK samples and use that class. It makes the interface to WAV files fairly simple - allows volume setting, pause, reset, etc. It uses DSound.

You'll have to copy to files, etc., but it could be useful.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Thanks very much for that. I'll be sure to check it out.
I managed to find the file I was missing (dmusici.h) at www.koders.com, only to find that dmusici.h #included another file I didn't have. I've now added the following files to my include directory and so far so good with the two-kings tutorial.
Once I get it working I'll have a go with the CSoundManager class and see which I prefer. Would I need any tutorial or anything to learn to use it? From what I'm seeing in the SDK Docs it looks fairly self-explanatory. Thanks again.

cheers,
metal

PS- Bloody MS seem to have deleted every single article relating to DirectMusic, so I'll have to rely on google if I want to know info about directmusic functions, parameters etc. Every article gives me "content not found." How long have they been phasing dmusic out for?
I think it's a relatively simple interface. I'm not great with audio but CSoundManager worked first time for me. Took a while to figure out the volume and frequency control but those were the features that appealed to me. I wanted the sound of helicopter blades to respond to changes in throttle (collective)settings. The class takes care of mixing multiple sounds, etc.

In the SetFrequency line, the frequency varies from 12000Hz to 22000Hz depending on the setting.

Here are some typical snippets from my simulation. Not in order of execution!
// in my init sequenceif( sndMgr==NULL ) {	bool sndLoaded = InitSoundMgr();	if( sndLoaded ) {		SetFrequency( 12000+LONG(collective/100.0f*10000.0f) );		chopSound->Play( 0, DSBPLAY_LOOPING );		SetVolume(g_pSound,chopVolume);	}}//===================// somewhere in your run loop// change the frequency only when collective (throttle, sort of) setting changesif( collective != lastCollective ) {	SetFrequency( 12000+LONG(collective/100.0f*10000.0f) );	lastCollective = collective;}//===================// Initializing the sound managersndMgr = new CSoundManager();if( NULL == sndMgr ){	MessageBox(NULL,"Failed to create sound mgr.","Error",MB_OK);	return false;}if( FAILED( hr = sndMgr->Initialize( m_hwnd, DSSCL_PRIORITY ) ) ){	MessageBox( NULL, "Error initializing DirectSound.",                           "Error", MB_OK | MB_ICONERROR );	return false;}    if( FAILED( hr = sndMgr->SetPrimaryBufferFormat( 2, 22050, 16 ) ) ){	MessageBox( NULL, "Error initializing DirectSound.",                           "Error", MB_OK | MB_ICONERROR );	return false;}char fName[MAX_PATH];strcat(strcpy(fName,resourceDir),"chopper_rotor.wav");if( FAILED( hr = sndMgr->Create( &chopSound, fName, DSBCAPS_CTRLFREQUENCY | DSBCAPS_CTRLVOLUME, GUID_NULL ) ) ){	// Not a critical failure, so just update the status	MessageBox(NULL,"Failed to create sound buffer for chopper sound.","Creation Error",MB_OK);	return false; }strcat(strcpy(fName,resourceDir),"gatling.wav");if( FAILED( hr = sndMgr->Create( &gatGunSound, fName, DSBCAPS_CTRLVOLUME, GUID_NULL ) ) ){	// Not a critical failure, so just update the status	MessageBox(NULL,"Failed to create sound buffer for gatling gun.","Creation Error",MB_OK);	return false; }//========================// some declarationsCSound* chopSound;CSound* gatGunSound;//========================// firing gatling gun when mouse button downif( lButtonDown ) {	if( gatGunSound != NULL && !gatGunSound->IsSoundPlaying() ) gatGunSound->Play(0,DSBPLAY_LOOPING, 250 );} else {	if( gatGunSound != NULL && gatGunSound->IsSoundPlaying() ) {		gatGunSound->Stop();		gatGunSound->Reset();	}}

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

This topic is closed to new replies.

Advertisement