projects
/
carveJwlIkooP6JGAAIwe30JlM.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix da bugs
[carveJwlIkooP6JGAAIwe30JlM.git]
/
audio.h
diff --git
a/audio.h
b/audio.h
index 43adf052e289077ef860e1ef8ba82f1452b3d1b8..5caa759e01fdc7b00182f025eb36d03950520e5d 100644
(file)
--- a/
audio.h
+++ b/
audio.h
@@
-19,7
+19,10
@@
audio_clip audio_board[] =
{ .path="sound/skate.ogg" },
{ .path="sound/wheel.ogg" },
{ .path="sound/slide.ogg" },
{ .path="sound/skate.ogg" },
{ .path="sound/wheel.ogg" },
{ .path="sound/slide.ogg" },
- { .path="sound/reverb.ogg" }
+ { .path="sound/reverb.ogg" },
+ { .path="sound/grind_loop.ogg" },
+ { .path="sound/grind_enter.ogg" },
+ { .path="sound/grind_exit.ogg" }
};
audio_clip audio_splash =
};
audio_clip audio_splash =
@@
-149,6
+152,11
@@
audio_player audio_player3 =
.name = "Player3",
};
.name = "Player3",
};
+audio_player audio_player4 =
+{
+ .name = "Player4",
+};
+
audio_player audio_player_extra =
{
.name = "PlayerInst"
audio_player audio_player_extra =
{
.name = "PlayerInst"
@@
-165,6
+173,7
@@
VG_STATIC void audio_init(void)
audio_player_init( &audio_player1 );
audio_player_init( &audio_player2 );
audio_player_init( &audio_player3 );
audio_player_init( &audio_player1 );
audio_player_init( &audio_player2 );
audio_player_init( &audio_player3 );
+ audio_player_init( &audio_player4 );
audio_player_init( &audio_player_gate );
audio_player_init( &ambient_player );
audio_player_init( &ambient_sprites[0] );
audio_player_init( &audio_player_gate );
audio_player_init( &ambient_player );
audio_player_init( &ambient_sprites[0] );
@@
-198,6
+207,7
@@
VG_STATIC void audio_init(void)
audio_player_set_flags( &audio_player0, flags );
audio_player_set_flags( &audio_player1, flags );
audio_player_set_flags( &audio_player2, flags );
audio_player_set_flags( &audio_player0, flags );
audio_player_set_flags( &audio_player1, flags );
audio_player_set_flags( &audio_player2, flags );
+ audio_player_set_flags( &audio_player4, flags );
audio_player_set_flags( &audio_player_gate, flags );
audio_player_set_flags( &audio_player3, AUDIO_FLAG_LOOP );
audio_player_set_flags( &ambient_player, AUDIO_FLAG_LOOP );
audio_player_set_flags( &audio_player_gate, flags );
audio_player_set_flags( &audio_player3, AUDIO_FLAG_LOOP );
audio_player_set_flags( &ambient_player, AUDIO_FLAG_LOOP );
@@
-215,29
+225,30
@@
VG_STATIC void audio_init(void)
audio_player_playclip( &audio_player1, &audio_board[1] );
audio_player_playclip( &audio_player2, &audio_board[2] );
audio_player_playclip( &audio_player3, &audio_board[3] );
audio_player_playclip( &audio_player1, &audio_board[1] );
audio_player_playclip( &audio_player2, &audio_board[2] );
audio_player_playclip( &audio_player3, &audio_board[3] );
+ audio_player_playclip( &audio_player4, &audio_board[4] );
audio_player_playclip( &ambient_player, &audio_ambience[0] );
audio_player_playclip( &audio_player_gate, &audio_gate_ambient );
audio_unlock();
audio_player_playclip( &ambient_player, &audio_ambience[0] );
audio_player_playclip( &audio_player_gate, &audio_gate_ambient );
audio_unlock();
- vg_
convar_push( (struct vg_con
var){
+ vg_
var_push( (struct vg_
var){
.name = "aud_debug_soundscape",
.data = &k_audio_debug_soundscape,
.name = "aud_debug_soundscape",
.data = &k_audio_debug_soundscape,
- .data_type = k_
con
var_dtype_i32,
+ .data_type = k_var_dtype_i32,
.opt_i32 = { .min=0, .max=1, .clamp=0 },
.persistent = 1
});
.opt_i32 = { .min=0, .max=1, .clamp=0 },
.persistent = 1
});
- vg_
convar_push( (struct vg_con
var){
+ vg_
var_push( (struct vg_
var){
.name = "aud_occlusion_rate",
.data = &k_audio_occlusion_rate,
.name = "aud_occlusion_rate",
.data = &k_audio_occlusion_rate,
- .data_type = k_
con
var_dtype_f32,
+ .data_type = k_var_dtype_f32,
.opt_f32 = { .clamp = 0 },
.persistent = 1
});
}
.opt_f32 = { .clamp = 0 },
.persistent = 1
});
}
-VG_STATIC void audio_free(void
*_
)
+VG_STATIC void audio_free(void)
{
/* TODO! */
vg_warn( "UNIMPLEMENTED: audio_free()\n" );
{
/* TODO! */
vg_warn( "UNIMPLEMENTED: audio_free()\n" );
@@
-254,6
+265,8
@@
VG_STATIC void audio_sample_occlusion( v3f origin )
v3f last;
v3_zero(last);
v3f last;
v3_zero(last);
+ world_instance *world = get_active_world();
+
for( int i=0; i<sample_count; i++ )
{
v3f dir;
for( int i=0; i<sample_count; i++ )
{
v3f dir;
@@
-262,7
+275,7
@@
VG_STATIC void audio_sample_occlusion( v3f origin )
ray_hit contact;
contact.dist = 15.0f;
ray_hit contact;
contact.dist = 15.0f;
- if( ray_world( origin, dir, &contact ) )
+ if( ray_world(
world,
origin, dir, &contact ) )
{
d += contact.dist;
{
d += contact.dist;
@@
-294,7
+307,7
@@
VG_STATIC void audio_sample_occlusion( v3f origin )
float occlusion = 1.0f - (d * (1.0f/(sample_dist*(float)sample_count))),
rate = VG_TIMESTEP_FIXED * k_audio_occlusion_rate,
float occlusion = 1.0f - (d * (1.0f/(sample_dist*(float)sample_count))),
rate = VG_TIMESTEP_FIXED * k_audio_occlusion_rate,
- target = powf(
occlusion
, 6.0f );
+ target = powf(
vg_maxf(occlusion,0.0f)
, 6.0f );
audio_occlusion_current = vg_lerpf( audio_occlusion_current, target, rate );
}
audio_occlusion_current = vg_lerpf( audio_occlusion_current, target, rate );
}
@@
-321,10
+334,11
@@
VG_STATIC enum audio_sprite_type audio_sample_sprite_random( v3f origin,
ray_hit contact;
contact.dist = vg_minf( 16.0f, pos[1] );
ray_hit contact;
contact.dist = vg_minf( 16.0f, pos[1] );
+ world_instance *world = get_active_world();
- if( ray_world( pos, (v3f){0.0f,-1.0f,0.0f}, &contact ) )
+ if( ray_world(
world,
pos, (v3f){0.0f,-1.0f,0.0f}, &contact ) )
{
{
- struct world_material *mat = ray_hit_material( &contact );
+ struct world_material *mat = ray_hit_material(
world,
&contact );
if( mat->info.surface_prop == k_surface_prop_grass)
{
if( mat->info.surface_prop == k_surface_prop_grass)
{
@@
-345,7
+359,7
@@
VG_STATIC enum audio_sprite_type audio_sample_sprite_random( v3f origin,
output[1] = 0.0f;
output[2] = pos[2];
output[1] = 0.0f;
output[2] = pos[2];
- if( world
.
water.enabled )
+ if( world
->
water.enabled )
return k_audio_sprite_type_water;
else
return k_audio_sprite_type_none;
return k_audio_sprite_type_water;
else
return k_audio_sprite_type_none;