Jump to content
  • Advertisement


This topic is now archived and is closed to further replies.


Spoted moments in songs

This topic is 5482 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

Hey!!! I am trying to make a sample program to make stuff happen during a song. I mean, a specific thing to do during a specific spot in a specific song, not just at the beginning and end of a song. i was wondering, is it easier to make a new format, or easy to just write the specific points in the engine? See, in my game, i wanted to add something called a "musical interlude" and something called a "musical flourish", they are combos, if they are timed specificaly in a point in a song, will add ether a burst of Ki power or points. I will be glad to have some assistance on this. peace! ^-^ Live in my world, Play in yours!!!

Share this post

Link to post
Share on other sites
It all depends really on the system you are using to play back your audio.

Most APIs should have a system to get the current position in a buffer''s playback.

If you are managing a DirectSound looping buffer yourself, obviously you need to accumulate the position of playback as the buffer loops over itself, but that''s pretty trivial.

Have a system that gets the current position of the buffer every game update loop.

If the position is between positionA and positionB, maybe defined in a text file you load, then you know that it is a ''powerup'' section. When in a powerup section, test if the user has pressed the ''burst'' button, or what have you.

You may need to take into account a little bit of ''slop'', making positionA and positionB a little bit wider, because there will be some latency between the reading of the buffer position and the actual position when you go to render the effect, but it should work.

A better way might be to write a buffer manager that knows about all these ''sync points'', and calls your callback every time a sync point is hit, making a pretty clean interface for handling all of this.

I''ve implemented this before and it works pretty well. We used it for timing camera cuts to music.

DirectSound has an event system that you can use for setting play notifications, but it only works within a buffer, not the entire song length, so be careful not to get confused by that. If you set it at a position and your looping buffer hits that, it will hit it every time the buffer rolls over. Might be best to do it by polling the position, as I said above.

Best of luck.

Share this post

Link to post
Share on other sites
moved to game programming. Now I find out!!! well, anyway, the primary OS is windows, and i''m using the open audio library, that way, i can find a way to use collision detection to trigger a musical interlude/flourish. and I''m mainly focusing on midi''s, but i''m also trying some mp3''s, a tough task, but i am. i''m also trying a new format to ease my pain. any more suggestions?

Live in my world, Play in yours!!!

Share this post

Link to post
Share on other sites

  • 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!