Home » Community » Forums » » Using DirectX Audio 8
  Intel sponsors gamedev.net search:   
[Control Panel] [Register] [Bookmarks] [Who's Online] [Active Topics] [Stats] [FAQ] [Search]

Add Forum to Favorites |  Send Topic To a Friend | View Forum FAQ | Track this topic


 Last Thread Next Thread 
 Using DirectX Audio 8
Post Reply 
I'd really like some feedback on this article so that it will help me make better articles in the future.


No, HTML is not an OO language.

 User Rating: 1012   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

This article reads well, although similar to the DirectX documentation. The more experience you get with writing these, the better they become, keep it up.

I have a question, how do we alter the volume of the segments, and play multiple segments similtaniously?

Thank you.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I needed information on how to load the wav myself and pass a pointer instead of letting DAudio load the sound.
This is useful if you have you own resource file.

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

I am curious why you used the DirectMusic objects for sound effect manipulation instead of the DirectSound buffer objects. What are the pros and cons of this approach?

 User Rating: 1306   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Sulgurth:
Playing multiple segments is as simple as making multiple calls to PlaySegmentEx with different IDirectMusicSegments.
You can change the volume with a call to IDirectSoundBuffer::SetVolume, with the only parameter being the volume in hundreths of decibels.

granat:
You need to create a DMUS_OBJECTDESC object and fill out the data in it after getting a pointer to your data and resource. Here's an example:

  
// globals somewhere

// module handle

HMODULE g_module;

// defined resource

#define WAV_ID     30

// loader object

IDirectMusicLoader* g_loader;

// music segment

IDirectMusicSegment* g_segment;

// somewhere in some function

// get the resource handle

HRSRC wav_handle = FindResource(g_module,
    MAKEINTRESOURCE(WAV_ID), RT_RCDATA);

// get a pointer to the data with a global memory chunk

HGLOBAL data = LoadResource(g_module, wav_handle);

// fill in the data structure

DMUS_OBJECTDESC wav_desc;

// size

wav_desc.dwSize = sizeof(DMUS_OBJECTDESC);

// guid, we're using a music segment

wav_desc.guidClass = CLSID_DirectMusicSegment;

// says that the data and the guid are valid

wav_desc.dwValidData = DMUS_OBJ_CLASS | DMUS_OBJ_MEMORY;

// size of the data

wav_desc.llMemLength = SizeOfResource(g_module, wav_handle);

// actual wave data

wav_desc.pbMemData = (BYTE *)LockResource(data);

// now load the object with the IDirectMusicLoader

g_loader->GetObject(
    &wav_desc, IID_IDirectMusicSegment, (void **) &g_segment);
  


I haven't tried it out, but it should work.

No, HTML is not an OO language.

 User Rating: 1012   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

To play multiple segements at the same instance, you actually need to use a secondary buffer flag setting.

Example:
PlaySegment(segm,DMUS_SEGF_DEFAULT|DMUS_SEGF_SECONDARY,0,NULL);
 




If all that matters is what you get in the end, why go through life?
~Michael Sikora


 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

quote:
Original post by Guardian_Light
To play multiple segements at the same instance, you actually need to use a secondary buffer flag setting.

Example:
PlaySegment(segm,DMUS_SEGF_DEFAULT|DMUS_SEGF_SECONDARY,0,NULL);
 




Thanks, learn something new every day. I've gotten a couple of emails about a typo in the article: all of the CLSID_IDirect*** identifiers should just be CLSID_Direct***. I must've gotten confused with IIDs while I was making it or something. My bad.

No, HTML is not an OO language.

Edited by - masonium on February 8, 2002 12:43:04 AM

 User Rating: 1012   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

A good hint for anyone writing tutorials is that it is CRUCIAL that you spell things correctly. Typo's are not acceptable. If you are writing a letter to me and spell my name wrong I don't care because I know my name. If you are teaching me how to program DX Audio and spell CLSID_DirectMusicPerformance as CLSID_IDirectMusicPerformacnce I may have to shoot you. So, just make sure you type it correctly. A good backup plan would be to make a demo prog that demonstrates the lesson. That way, even if someone can't get the code to work then they can get your sample project.
-Greg Koreman

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

how to make the ivideowindow loop on the video file ?
there are run(), stop(), pause() ... but the run() method stop a the end of the file .

thanks for help

 User Rating: 1015    Report this Post to a Moderator | Link

Anonymous Poster:

The video feed doesn't restart when you call Run() after it has already been run, you have to RenderFile() all over again to restart it.

You need to query the filter graph for a pointer to an IMediaEvent interface. Then you can handle messages like when the video has completed, in which case you can run the video over again if you want it to loop.

By the way...how did this go from DirectX Audio to DirectShow

 User Rating: 1015   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

Quote:
Original post by Greg K
A good hint for anyone writing tutorials is that it is CRUCIAL that you spell things correctly. Typo's are not acceptable. If you are writing a letter to me and spell my name wrong I don't care because I know my name. If you are teaching me how to program DX Audio and spell CLSID_DirectMusicPerformance as CLSID_IDirectMusicPerformacnce I may have to shoot you. So, just make sure you type it correctly. A good backup plan would be to make a demo prog that demonstrates the lesson. That way, even if someone can't get the code to work then they can get your sample project.
-Greg Koreman


He's right.

 User Rating: 1015    Report this Post to a Moderator | Link

Quote:
Original post by Anonymous Poster
Quote:
Original post by Greg K
A good hint for anyone writing tutorials is that it is CRUCIAL that you spell things correctly. Typo's are not acceptable. If you are writing a letter to me and spell my name wrong I don't care because I know my name. If you are teaching me how to program DX Audio and spell CLSID_DirectMusicPerformance as CLSID_IDirectMusicPerformacnce I may have to shoot you. So, just make sure you type it correctly. A good backup plan would be to make a demo prog that demonstrates the lesson. That way, even if someone can't get the code to work then they can get your sample project.
-Greg Koreman


He's right.
This needs to be fixed. I couldn't even find the right declarations to the datatypes on MSDN because I didn't know the proper spelling. It was the quoted post that eventually helped me out. This article should be fixed.


 User Rating: 1444   |  Rate This User  Send Private MessageView Profile Report this Post to a Moderator | Link

All times are ET (US)

Post Reply
 Last Thread Next Thread 
Forum Rules:
You may not post new threads
You may post replies
You may not edit your posts
You may not use HTML in your posts
Jump To:
Administrative Options: