Jump to content
  • 0

Ambient sound


bombajack

Question

19 answers to this question

Recommended Posts

  • 0

//description.ext:
class CfgSounds {
    sounds[] = {};
    class track1 {
        name = "track1";
        sound[] = {"track1.ogg", 1.0, 1};
        titles[] = {};
    };
    class track2 {
        name = "track2";
        sound[] = {"track2.ogg", .8, 1};
        titles[] = {};
    };
    class track3 {
        name = "track3";
        sound[] = {"track3.ogg", 1.0, 1};
        titles[] = {};
    };    
};

//or you can use CfgMusic (keep in mind, for this the player have to activate his music volume at ingame options to here anything)
class CfgMusic {
    tracks[]={};
    class track1 {
        name = "track1";
        sound[] = {"track1.ogg", db+0, 1.0};
    };
    class track2 {
        name = "track2";
        sound[] = {"track2.ogg", db+0, 1.0};
    };
    class track3 {
        name = "track3";
        sound[] = {"track3.ogg", db+0, 1.0};
    };
};

//the sqf from where to start the sounds:
private "_tracks";
_tracks = ["track1","track2","track3"] call BIS_fnc_selectRandom;
playSound _tracks;
//or
playMusic _tracks;

 

Untested, but it should works this way.

cheers

 

 

btw: no need to quote a message directly after itself. :)

Link to comment
Share on other sites

  • 0

Sure i know it, but i don´t can remember the ambient sound stuff :) It´s a long time ago...

I could write you something like your wish but i have to say i dont can give you predictions for the performance because i should use some waitUntils or sleep commands to get this working. Perhaps i find a better way, but also then i don´t can say anything about the performance. You can only give it a try.

 

 

I would use playSound for this because this is hearable for everyone (it doesnt matter if the players music volume is activated or not), but with playSound you dont can interrupt the music playing... Only that u know.

<_<

Link to comment
Share on other sites

  • 0

Test this one, but its untested and i give no warranty if it works:

 

//the sqf from where to start the ambient:

private["_tracks","_minGap","_maxGap"];
_tracks = ["track1","track2","track3"]; //insert the "names" of the soundfiles you described in description.ext "without" file-extension
_minGap = 3; //number in minutes of the smallest gap between the tracks //DON´T USE A SMALLER NUMBER THAN THE SHORTEST SOUNDLENGTH!!!
_maxGap = 10; //number in minutes of the longest gap between the tracks

/******* dont edit below ********/
private["_minT","_maxT","_rndT"];
_minT = (_minGap *60);
_maxT = (_maxGap *60);
_rndT = round(random _maxT) _minT;

while{true}do{
    _rndTrck = _tracks call BIS_fnc_selectRandom;
    playSound _rndTrck;
    sleep _rndT; //perhaps use of uiSleep is possible
};

 

Surely anybody else have a better way to do this, but this is my attempt in a few minutes :P

 

Give response about functionality please, cheers

Link to comment
Share on other sites

  • 0

Test this one, but its untested and i give no warranty if it works:

//the sqf from where to start the ambient:

private["_tracks","_minGap","_maxGap"];
_tracks = ["track1","track2","track3"]; //insert the "names" of the soundfiles you described in description.ext "without" file-extension
_minGap = 3; //number in minutes of the smallest gap between the tracks //DON´T USE A SMALLER NUMBER THAN THE SHORTEST SOUNDLENGTH!!!
_maxGap = 10; //number in minutes of the longest gap between the tracks

/******* dont edit below ********/
private["_minT","_maxT","_rndT"];
_minT = (_minGap *60);
_maxT = (_maxGap *60);
_rndT = round(random _maxT) _minT;

while{true}do{
    _rndTrck = _tracks call BIS_fnc_selectRandom;
    playSound _rndTrck;
    sleep _rndT; //perhaps use of uiSleep is possible
};

Surely anybody else have a better way to do this, but this is my attempt in a few minutes :P

 

Give response about functionality please, cheers

doesnt work for me

i called the sounds from a custom pbo but path should be set correctly

Link to comment
Share on other sites

  • 0

custom pbo... serverside ?

If yes, then look at post #2.

 

The script itself i will test later, then i give response if it works :)

 

EDIT:

Correct, it fails...

Actually work in progress, i post the finished script if im done....

 

EDIT 2:

It´s running, i will post a tutorial in a few minutes :D

Link to comment
Share on other sites

  • 0

custom pbo... serverside ?

If yes, then look at post #2.

 

The script itself i will test later, then i give response if it works :)

 

EDIT:

Correct, it fails...

Actually work in progress, i post the finished script if im done....

 

EDIT 2:

It´s running, i will post a tutorial in a few minutes :D

 

 

You are simply the best :D

Link to comment
Share on other sites

  • 0

Use playMusic (so players have control over the volume and/or can turn it off) and work with the appropriate musicEventHandlers for it https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#addMusicEventHandler

 

@READTHESCROLL

There are better ways to get the terrain & surroundings, without triggers.

Look how it is done in mods like JSRS.

 

Greez Kilo

Link to comment
Share on other sites

  • 0

yes, playMusic would be a better way to change sounds etc... because they can forced to stop, which isnt possible with playSound until you use an attached object to the player.

 

_____________________________________________________________

Because my release threat is still in checking, i will post the github link here for now:

 

https://github.com/SPKcoding/SPK_RAS

 

Updates will come...

Link to comment
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
  • Advertisement
  • Discord

×
×
  • Create New...