Jump to content
Sign in to follow this  
hellfire257

CfgMusic duration?

Recommended Posts

Hello all,

I've been experimenting with adding custom music and so far I've been successful. However, there is one thing bugging me.

class le_lady_labyrinth {
	name = "Ludovico Einaudi - Lady Labyrinth";
	sound[] = {"\music\le_lady_labyrinth.ogg",0.7943282,1.0};
	[b]duration = 282;[/b]
	genre = "playlist1";
};	

I cannot figure out how to calculate duration. The figure I tried in the example was simply the track length converted into seconds but it cut short. I then added 10 seconds onto that and it still cut short. However with a second track the extra 10 seconds made it finish.

The BIS entries are just as mysterious, with a track with a length of 3:07 having a duration listed as 193 (should be 187 if going by seconds), and a track of 7:28 having a duration of 523 (448). Some of them are about right with a 2:58 track having a duration 180, but I couldn't find an exact relationship between them, but I'm terrible at maths so I might have missed it!

Trial and error will obviously yield the correct duration for each individual track, but does anybody know how to calculate the duration precisely?

Edited by Hellfire257

Share this post


Link to post
Share on other sites

this looks like your entry in the description.ext in which case i'm not sure if you set the duration here. would you not use the FadeMusic command in the script which starts the music playing. ie

282 FadeMusic 0

would fade the music to 0 after 282 seconds or perhaps it would take 282 seconds to fade the music giving a gradual fade from the begining of the song in which case you could try:

wait 282;

0 FadeMusic 0;

which would obviously wait 282second then fade the music out sharply. I am hazy on how it works but i do not recall ever having seen a 'duration' in the music section of a description.ext before, course ToH could be differant from arma 2, I prey i've helped rather than muddied the waters:) i'm off to have a play now if i get something working i'll share. Ok had a play and its not good, using '282 FadeMusic 0' will indeed fade slowly over the 282 seconds instead of waiting untill 282 then cutting it. Also i cant seem to get the delay to work, you should be able to put '~282' to put a pause in a script of 282 seconds but its not working for me. sorry and good luck with it.

Edited by chopperforce

Share this post


Link to post
Share on other sites

This is in a userconfig file rather than a description.ext. I'm simply following what BIS have in their configs. The plot thickens! I'll keep experimenting and see what I can find.

Share this post


Link to post
Share on other sites

Did you find an answer to this? I am currently trying to write an addon for this so anyone can add their own music - and I have got to the same point of confusion having successfully done everything else!

EDIT ---->

The radio functions seem to be using the duration to decide how long to wait (it is a waituntil loop) before playing the next track. If the track in the config has no or 0 duration then the functions set it to 120 seconds. So in theory as far as I can tell from the code (below), as long as the duration is set to longer than the track (in seconds) it should play the full track. I have played around with this and it seems to work.

playMusic [_track, _start];

The waituntil loop looks like this;


   private ["_duration", "_delay", "_timeNow"];
   _track = player getVariable ["HSim_radioMusicTrack", ""];
   _duration = player getVariable ["HSim_radioMusicTrackDuration", 0];
   _delay = _duration - (player getVariable ["HSim_radioMusicTrackStart", 0]);
   _timeNow = time;

   waitUntil 
   {
    ((time - _timeNow) >= _delay) || 
    ((vehicle player) != _this) || 
    !(player getVariable ["HSim_radioMusic", false]) || 
    ((player getVariable ["HSim_radioMusicChannel", ""]) != _channel) || 
    ((player getVariable ["HSim_radioMusicTrack", ""]) != _track) || 
    !(isBatteryOnRTD _this)
   };

Edited by Jedra

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×