Jump to content
  • Advertisement
Sign in to follow this  
bjut

DirectMusic MUSIC_TIME

This topic is 4919 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hello! just a question, what is MUSIC_TIME? I just don't get the explanation in DirectMusic's help. How is it relative to the tempo? Is there any way to get the MUSIC_TIME of a measure in a MIDI file? I'm trying to implement a seeking feature in DirectMusic that seeks onto the measures in a MIDI file. I am thinking of computing it myself because I can already get the Time signature and tempo of the MIDI from DirectMusic. So I can just do this: (number of measure to seek to) * (number of beats per measure) * (duration of a beat obtained from tempo beats per minute) = start time of measure to seek to problem is, how do i translate this into MUSIC_TIME? whatever that is... or is there an easier way to do this? thank you!

Share this post


Link to post
Share on other sites
Advertisement
You probably already saw this in the DX 8.1 docs, but here it is again.
Quote:

Music time is a 32-bit value defined as type MUSIC_TIME. It is not an absolute measure of time but is relative to the tempo. The clock is started when the performance is initialized and ticks DMUS_PPQ times for each quarter-note. DMUS_PPQ is defined as 768.

So if you just created a performance object and, at the same moment, started playing a song in common (4/4) time, by the end of the first measure, the clock would be at DMUS_PPQ*4. Note, that if the beats-per-minute is slower, it will take a longer REFERENCE_TIME to reach the same point, but MUSIC_TIME stays the same.

This might come in handy if you are creating dynamic sound-tracks.

Share this post


Link to post
Share on other sites
thanks for the reply...

yup I have read that part of the help file. I just don't get how to compute for MUSIC_TIME.

so if I did this:


MUSIC_TIME mt;
mt = 4 * DMUS_PPQ;
m_pSegment->SetStartPoint(mt);




Would that start the segment on the 2nd measure? I tried it and it just fell silent. It actually went beyond the file's length (which I got from Segment->GetLength()).

The file I tested had 4/2 time signature.

What is the formula for MUSIC_TIME by the way? What unit is it in?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!