Millisecond accuracy?

For questions about using Classic.

Post » Sat Jun 26, 2010 1:08 am

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.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Sat Jun 26, 2010 2:18 am

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).
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Sat Jun 26, 2010 4:12 am

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 :lol:

Thanks, tulamide!
B
12
S
4
G
3
Posts: 426
Reputation: 2,458

Post » Sat Jun 26, 2010 4:14 am

If you have Audacity or some sound editor you could just put both mp3's into one file.
Image Image
B
161
S
48
G
90
Posts: 7,350
Reputation: 66,755

Post » Sat Jun 26, 2010 4:47 am

[quote="newt":2tc5icxx]If you have Audacity or some sound editor you could just put both mp3's into one file.[/quote:2tc5icxx]

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.
B
12
S
4
G
3
Posts: 426
Reputation: 2,458


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests