2019-06-02 05:25:02 (edited by redfox 2019-06-02 05:25:48)

I want to possibly tie all my sound_pools into one opperator so that I can go like, fadepool(spool,-35,2);, and it would fade all the things tied to spool. Is there a way to do this?

Or just a way to fade multiple pools att the same time?

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2019-06-02 16:08:50

To achieve the result you want, create an array with your sound pools. I dono why would you need multiple ones, but there you go. Then loop through the array and the list of sounds in each sound pool and fade them.

2019-06-03 04:08:43

@2 it would work but it wouldn't fade them all at once. The proper way to do this is to create an array of sound_pool_items, then loop through all sound pools you want to fade and add it's items array to your global one. Then loop through that and fade it.

I am a web designer, and a game developer. If you wish see me at http://www.samtupy.com

2019-06-03 13:13:23

@3, sorry, I'm not that experienced with arrays, do you think you could give me an example?

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)

2019-06-04 05:50:30

Note this is untested I just wrote it quickly in a notepad window and posted so you'll have to fix any errors.

// to use, make a global array of sound_pools.
sound_pool@[] all_pools;
//Now lets make a couple pools;
sound_pool pool1;
sound_pool pool2;

//In the main function, add any pools you create to the all_pools array.
void main()
{
all_pools.insert_last(pool1);
all_pools.insert_last(pool1);
}

void fadepools(int fadespeed, int destvolume, bool destroy_when_done=true)
{
sound_pool_item@[] pool_items;
// So this sucks, none of the opAdd functions were wrapped so to add the items to the aray, we need to perform this ugglyness. If anyone knows a better way I'd actually love to hear about it.
for(uint i=0; i<all_pools.length(); i++)
{
for(uint x=0; x<all_pools[i].items.length(); x++) pool_items.insert_last(all_pools[i].items[x]);
}
// the wrest is pretty normal. Now that we have all the items together we can just fade them.
for(uint v=0; v<absolute(destvolume), v++)
{
for(uint i=0; i<pool_items.length(); i++)
{
if(@pool_items[i]==null or @pool_items[i].handle==null) continue;
pool_items[i].handle.volume=pool_items[i].handle.volume+destvolume;
}
wait(fadespeed);
}
if(destroy_when_done)
{
for(uint i=0; i<all_pools.length(); i++) all_pools[i].destroy_all();
}
}
I am a web designer, and a game developer. If you wish see me at http://www.samtupy.com

2019-06-04 13:24:00

Thank you! I will test this when I get home!

----------
“Yes, sir. I am attempting to fill a silent moment with non-relevant conversation.”
“You don’t tell me how to behave; you’re not my mother!”
“Could you please continue the petty bickering? I find it most intriguing.” – Data (Star Trek: The Next Generation)