Millisecond accuracy?

This forum is currently in read-only mode.
  • I've been putting some music into my game. One track is 3minutes 2seconds, the other is 4minutes 4seconds. For the first track I set milliseconds as 305000ms in order to give my song a buffer to finish before the next song plays.

    I have:

    *Start of layout

    +XAudio2: Play "ThisMusic.mp3"

    *Timer is equal to 305000ms

    +XAudio2: Play "ThisMusic2.mp3"

    The problem is, instead of the "ThisMusic2.mp3" playing right after 305000ms have elapsed, it just sits silent for about 2 and half minutes, and then suddenly "ThisMusic2.mp3" begins to play out of nowhere.

    I also tried the timeline object and got the exact same result.

    My questions are:

    1. Is there another method to getting these songs to play right after the time period ends instead of minutes after?

    2. Is it a bug with milliseconds not calculating right?

    3. Could it be an issue with my machine?

    4. Should I be thinking Global variable here? I've created a clock in Construct using a global variable, but I'm not sure how I would approach using it for this?

    I'm stumped. I've found that if I cut the ms time down I can get better time, but it's tricky trying to guess a time and requires me to listen the song all the way through in order to test it.

    I even tried shorter files like one 22 second file jumping to a 26 second file. That one calculated perfectly using 22,000 ms, but the larger files are not working so well.

  • You know that 305000ms equals 5:05 min? The song is only 3:02 min, and that means you are waiting at least 2:03 min before this or another song is played again.

    If you want to wait 3:05 min that's 185000ms. (one second = 1000ms, one minute = 60 sec = 60000ms)

    You can't rely on the accuracy of the timer, but it does not create a two minute gap, it will roughly be the value you set, deviating not more than a few milliseconds (it is dependent on the framerate).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Holy crap, you're right. I kept multiplying by 10 and not taking into account the proper conversion calculation, lol. That's a real shame on my part

    Thanks, tulamide!

  • If you have Audacity or some sound editor you could just put both mp3's into one file.

  • If you have Audacity or some sound editor you could just put both mp3's into one file.

    Yeah, I've been debating with myself about doing that. Right now I only have 2 songs so it would be a good idea to just combine them. But I'm holding out for the possibility of having like 10 or more with them all being selectable track by track, I'm just not sure of all the songs I want to use yet.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)