Sign in to follow this  
Tolito

SDL_mixer: Current point in music?

Recommended Posts

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:[code]if(Mix_MusicLength()-Mix_MusicPosition()<=3) Mix_SetMusicPosition(0);[/code]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!

Share this post


Link to post
Share on other sites
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!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this