[directmusic] Re: question

  • From: "Joshua P. Jung" <joshua@xxxxxxxxxxxxxx>
  • To: directmusic@xxxxxxxxxxxxx
  • Date: Fri, 28 Feb 2003 10:18:36 -0600

So, what your saying is that DirectMusic 8 should NOT be used for games=
 sound effects... which is what I was planning on doing.

I am finishing up a game, and was getting ready to implement sound (basic=
 stuff). Is there any way I could get directmusic 8 to have low latency,=
 like you showed DirectMusic 9 could do?

Josh <><

---------------------------------------------------------------------------
Orignal Message
---------------------------------------------------------------------------

On 2/27/2003 at 6:29 PM Todor Fay wrote:

>With DX8, using DirectMusic for sound effects had a problem: you
>couldn't get low latency for sudden sound effects, in particular any
>sounds that are in reaction to user input (like gun shots, etc.) 
>
>In DX9, you get really low latency. I've measured 4ms latency on the
>Creative Audigy card, for example, so it's a totally different story. 
>
>By default, however, the latency is not low. This was done to handle
>worse case scenarios of really lousy cards on old slow computers. 
>
>But, you can overwrite the latency and write period. Note that the
>latency is added to whatever hardware / software latency is introduced
>by the drivers, so results will vary depending on the card. The
>following code drops the latency to 1ms and the period to 3ms. This
>results in about 4-6 ms latency on an Audigy card:
>
>IDirectMusicAudioPath *pPath;
>if (m_pPerformance &&
>SUCCEEDED(m_pPerformance->GetDefaultAudioPath(&pPath)))
>{
>    IKsControl  *pControl =3D NULL; 
> 
>pPath->GetObjectInPath(0,DMUS_PATH_PORT,0,GUID_All_Objects,0,IID_IKsCont
>rol,(void **)&pControl);
>    pPath->Release();
>    if (pControl)
>    {
>        KSPROPERTY  ksp; 
>        DWORD dwData;
>        ULONG cb; 
>        dwData =3D 3; 
>        ksp.Set =3D GUID_DMUS_PROP_WritePeriod ; 
>        ksp.Id =3D 0; 
>        ksp.Flags =3D KSPROPERTY_TYPE_SET;
>        pControl->KsProperty(&ksp, sizeof(ksp),
>                &dwData, sizeof(dwData), &cb);
>        dwData =3D 1; 
>        ksp.Set =3D GUID_DMUS_PROP_WriteLatency ; 
>        ksp.Id =3D 1; 
>        ksp.Flags =3D KSPROPERTY_TYPE_SET;
>        pControl->KsProperty(&ksp, sizeof(ksp),
>                &dwData, sizeof(dwData), &cb);
>        pControl->Release();    
>    }
>}
>
>BTW, A bunch of us are contributing to a book called DirectX Audio
>Exposed that will ship in a few months. In it, I have written a chapter
>on programming with sound effects that covers this and most other
>questions and issues. 
>
>Todor
>
>
>-----Original Message-----
>From: directmusic-bounce@xxxxxxxxxxxxx
>[mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of justin
>Sent: Thursday, February 27, 2003 11:59 AM
>To: directmusic@xxxxxxxxxxxxx
>Subject: [directmusic] question
>
>
>Hi everyone,
>
>I am working on creating adaptive audio for a DX game and I am using
>direct music to handle all of the aa.  I was wondering if it was ok to
>use direct music for all the sounds in the game i.e gunshots or if I
>should use direct sound to deal with the small one off stuff...
>
>Justin Love
>University of Victoria
>
>-----Original Message-----
>From: directmusic-bounce@xxxxxxxxxxxxx
>[mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Scott Morgan
>Sent: February 27, 2003 8:47 AM
>To: directmusic@xxxxxxxxxxxxx
>Subject: [directmusic] Re: Ciaran - you mentioned...
>
>
>Oh FYI, the point of the C++ Autodownload is to make life easier on the
>programmer.  It means he doesn't have to load and unload every segment
>he
>calls play on.  It's all handled automatically.
>-Scott Morgan
>http://Morganstudios.com
>
>
>----- Original Message -----
>From: "Scott Morgan" <scott@xxxxxxxxxxxxxxxxx>
>To: <directmusic@xxxxxxxxxxxxx>
>Sent: Thursday, February 27, 2003 8:31 AM
>Subject: [directmusic] Re: Ciaran - you mentioned...
>
>
>>
>> The Autodownload feature Todor is referring to is a C++ method that
>has
>> nothing to do with the download checkbox in scripts.  The programmer
>would
>> be the person who decides to use AutoDownload, not the composer.  Just
>so
>> you know DMDemo does not use Autodownload.  Typically if you are using
>> scripting there is absolutely no need to use AutoDownload since the
>script
>> handles everything either through manual script commands or by loading
>what
>> it needs at start (only once).
>>
>> There are periodic CPU spikes in DMusic playback, but my understanding
>is
>> that it is the playback engine waking up every so often and writing
>new
>data
>> to the sound buffer.
>>
>> -Scott Morgan
>> http://Morganstudios.com
>>
>>
>> ----- Original Message -----
>> From: "Ciaran Walsh" <ciaran@xxxxxxxxxxxxxx>
>> To: <directmusic@xxxxxxxxxxxxx>
>> Sent: Thursday, February 27, 2003 7:34 AM
>> Subject: [directmusic] Re: Ciaran - you mentioned...
>>
>>
>> >
>> > that would definitely explain it - does it really download the
>instruments
>> > again every time you play a band? that seems like a really weird way
>for
>> it
>> > to work...
>> >
>> > I thought the point of AutoDownload was so that all content
>referenced
>by
>> > the script was downloaded when the script loaded.
>> >
>> > -----Original Message-----
>> > From: directmusic-bounce@xxxxxxxxxxxxx
>> > [mailto:directmusic-bounce@xxxxxxxxxxxxx]On Behalf Of Todor Fay
>> > Sent: 27 February 2003 15:18
>> > To: directmusic@xxxxxxxxxxxxx
>> > Subject: [directmusic] Re: Ciaran - you mentioned...
>> >
>> >
>> >
>> > Is there any chance you had the AutoDownload command turned on? It's
>a
>> > feature that would cause each band to automatically cause a download
>of
>> > its instruments when it played. Playback of a band should normally
>not
>> > cause any spike because all it does is send program change events to
>the
>> > synth which just stores them, so nothing active occurs.
>> >
>> > Todor
>> >
>> > -----Original Message-----
>> > From: directmusic-bounce@xxxxxxxxxxxxx
>> > [mailto:directmusic-bounce@xxxxxxxxxxxxx] On Behalf Of Ciaran Walsh
>> > Sent: Thursday, February 27, 2003 5:32 AM
>> > To: directmusic@xxxxxxxxxxxxx
>> > Subject: [directmusic] Re: Ciaran - you mentioned...
>> >
>> >
>> > The problem we were having was never pinned down 100% to one
>particular
>> > thing, but band events certainly seemed to be contributing
>> > significantly.
>> > Our performance tests showed big CPU spikes each time a segment was
>> > triggered with a new band event, and somehow there was a cumulative
>> > effect
>> > which had a big impact on the overall frame rate.
>> >
>> > When we removed band events from the segments the spikes
>disappeared.
>> >
>> > We defined the band globally by having a segment play right at the
>start
>> > containing just a band event and triggering the first Primary
>Segment.
>> > As
>> > long as you don't recreate the audiopath or change any band settings
>you
>> > don't need to create the band again after that. I guess it's only a
>> > problem
>> > if you are re-assigning pchannels as you go along, but I've never
>needed
>> > to
>> > do that.
>> >
>> > Hope that helps,
>> > Ciaran
>> >
>> > -----Original Message-----
>> > From: directmusic-bounce@xxxxxxxxxxxxx
>> > [mailto:directmusic-bounce@xxxxxxxxxxxxx]On Behalf Of Paul Stroud
>> > Sent: 27 February 2003 10:59
>> > To: directmusic@xxxxxxxxxxxxx
>> > Subject: [directmusic] Ciaran - you mentioned...
>> >
>> >
>> >
>> > ..that band tracks were giving you and your dev team a few problems
>-
>> > causing some glitch?
>> >
>> > If you don't mind going over the same subject again; what was the
>> > problem?
>> > And how did you sort it?
>> >
>> > I seem to remember that you globally declared a band instead of use
>band
>> > tracks on each segment.  Is this right?  Did you need to play a Band
>> > track
>> > at least once?  Is this how you globally declare a band?
>> >
>> > Anyone else had problems with this sort of thing?
>> >
>> >
>> >
>> >
>> >
>> >
>>

---------------------------------------------------------------------------
End of Original Message
---------------------------------------------------------------------------



Other related posts: