Results 1 to 5 of 5

Thread: CfgMusic duration?

  1. #1
    Master Gunnery Sergeant Hellfire257's Avatar
    Join Date
    Feb 17 2009
    Location
    (getPosATL player)
    Posts
    1,207

    CfgMusic duration?

    Hello all,

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

    Code:
    	class le_lady_labyrinth {
    		name = "Ludovico Einaudi - Lady Labyrinth";
    		sound[] = {"\music\le_lady_labyrinth.ogg",0.7943282,1.0};
    		duration = 282;
    		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?
    Last edited by Hellfire257; Oct 29 2011 at 17:53.

  2. #2
    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.
    Last edited by chopperforce; Oct 29 2011 at 22:58.

  3. #3
    Master Gunnery Sergeant Hellfire257's Avatar
    Join Date
    Feb 17 2009
    Location
    (getPosATL player)
    Posts
    1,207
    Author of the Thread
    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.

  4. #4
    When was BIS and sound not mysterious?
    Regards
    Carl Gustaffa - left this game due becoming Steam Exclusive

  5. #5
    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.

    Code:
    playMusic [_track, _start];
    The waituntil loop looks like this;

    Code:
     
        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)
        };
    Last edited by Jedra; Nov 8 2011 at 22:18.
    Jedra's Addons
    Arma 2 : Enhanced Skills Slider
    Take On Helicopters : Take On Taxi | Jedra's Time Trials | Weapon Indicators | No Radar

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •