DirectMusic Sound Volume

Posted on 2005-04-06
Medium Priority
Last Modified: 2008-02-01
Hi - I'm just trying to get my head around DirectMusic at the moment. I have the following script:

m_pPerformance -> PlaySegmentEx( m_pSegment[1/*i*/], NULL, NULL, DMUS_SEGF_SECONDARY | DMUS_SEGF_REFTIME,rtNow+1250000, NULL, NULL, m_pAudioPath[1/*i*/] );

... which will play a segment of sound. However, I'm trying to figure out how to control the volume for this sound when played via a value that is given from a slider in the dialog box. What is the best function to use in this case?

Hope this makes sense! Many thanks in advance

Question by:nickisme
1 Comment
LVL 17

Accepted Solution

davebytes earned 500 total points
ID: 13731527
If you want minimal control, you can just do:

int fms = 0; // ms to fade to new volume
int hdb = -100; // hundredths of a decibel in volume, -9600 -> 0
m_pAudioPath[1]->SetVolume(hdb, dms);

Alternately, to completely control the buffer, get the DSound interface and set the volume there (ensures no channel events play with the volume outside of your control):

IDirectSoundBuffer8* pDSB = NULL;
                              GUID_NULL, 0, IID_IDirectSoundBuffer,
                              (LPVOID*) &pDSB);
if (pDSB)


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What is RenderMan: RenderMan is a not any particular piece of software. RenderMan is an industry standard, defining set of rules that any rendering software should use, to be RenderMan-compliant. Pixar's RenderMan is a flagship implementation of …
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
When cloud platforms entered the scene, users and companies jumped on board to take advantage of the many benefits, like the ability to work and connect with company information from various locations. What many didn't foresee was the increased risk…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question