2017-08-07 09:12:49

Hello.
I need help with ambiences in bgt.
How do I make a sertan ambience to play at x, y, z, that I want, and how do I make it so it pans when you walk.
I tried sound_pozitioning, but I can't get it to work.
Any help would be apprishiated.

Don't care.

2017-08-07 22:25:53

If you don't want to use the sound_pool:

// Global, or in a class instance:
sound@ amb;

void init_amb (){ 
sound temp;
ámb=temp;
amb.load("ambience.ogg"); // use the filename you want.
} 

// assuming you have player position variables:
void update_amb (int player_x, int player_y, int player_z) { 
position_sound_3d (amb, player_x, player_y, player_z, amb_x, amb_y, amb_z, 1, 1, 1);
}
 

If you'd rather use the sound_pool, it's much simpler, especially if you have multiple sounds:

sound_pool pool;

void init_amb (){ 
pool.play_3d ("amb.ogg", player_x, player_y, player_z, amb_x, amb_y, amb_z, true);
}

//after you've moved the player:
pool.update_listener_3d (player_x, player_y, player_z, player_angle);

I might have forgotten when to use the listener angle in there, but that's easy enough to check (I'm typing this on my phone sad ).
Basically, you need to update the sound every time the player moves. The sound_pool does this for all playing sounds with a single method, that only takes the player's new position. So, unless I'm trying to do something fancy like sound rings, I'd just stick with the sound_pool.

看過來!
"If you want utopia but reality gives you Lovecraft, you don't give up, you carve your utopia out of the corpses of dead gods."
MaxAngor wrote:
    George... Don't do that.

2017-08-10 23:53:11

Hi.
I can't get it to work.

Don't care.