Jump to content

  • Log In with Google      Sign In   
  • Create Account

We're offering banner ads on our site from just $5!

1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


SDL_mixer: Current point in music?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
2 replies to this topic

#1 Tolito   Members   -  Reputation: 256

Like
0Likes
Like

Posted 20 November 2012 - 06:47 AM

I am using SDL with C. Instead of editing my audio to fit the game, I would like to edit the game to fit the audio. I know there is a way to jump to a certain point in an audio file (using Mix_SetMusicPosition), but how do I tell the length of the music and the current position? I would like to do something like this:
if(Mix_MusicLength()-Mix_MusicPosition()<=3) Mix_SetMusicPosition(0);
To say that if the music position is three seconds from the end, skip to the beginning. I would edit my audio files, but the program I am exporting music compositions from adds a precise number of seconds to the end of each file. Instead of having to remove this and try with trial and error to get the looping set up properly again each time, I would like to just edit my music playing system in my project to ignore the last three (or whatever number I specify) seconds of the music.

If there is a better way to do this, please share. Thank you!

Sponsor:

#2 lorund   Members   -  Reputation: 111

Like
0Likes
Like

Posted 21 November 2012 - 02:14 PM

If your audio files have a constant bitrate, you can find that from a alen member (see Mix_Chunk).

#3 Tolito   Members   -  Reputation: 256

Like
0Likes
Like

Posted 21 November 2012 - 03:21 PM

I am using Mix_Music for this instead of Mix_Chunk. I tried music.alen, but that doesn't work. Is there an alternative to this so using Mix_Chunk for my music is not necessary? Thank you for your response!




Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS