X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=world_audio.h;h=b1b14da88eaf620ca41fbb7728d68bb665e074db;hb=6e6c7f31b8f17af3814727109e48fc6f85ef04b1;hp=2de8bf2b07402f429e9bc4d42ad3a7b23117bc2e;hpb=0cf7e0563088708f2749f7dacd26ffdf1391dccc;p=carveJwlIkooP6JGAAIwe30JlM.git diff --git a/world_audio.h b/world_audio.h index 2de8bf2..b1b14da 100644 --- a/world_audio.h +++ b/world_audio.h @@ -1,117 +1,11 @@ #ifndef WORLD_AUDIO_H #define WORLD_AUDIO_H -#include "common.h" -#include "vg/vg_audio.h" -#include "audio.h" +#include "world.h" -#if 0 -audio_pack audio_birds = -{ - .sources = "sound/bird0.ogg\0" - "sound/bird1.ogg\0" - "sound/bird2.ogg\0", - .name = "Birds", - .source_mode = k_audio_source_compressed -}; -#endif - -static float k_audio_random_freq = 1.0f/10.0f, - k_audio_random_hz = 1.0f; - -static double world_audio_last_tick = 0.0; - -static struct world_ambient_layer -{ - audio_player sys; - v3f pos; -} -world_ambient_layers[8]; - -static void world_audio_init(void) -{ -#if 0 - audio_pack_init( &audio_birds ); - - vg_convar_push( (struct vg_convar){ - .name = "aud_random_freq", - .data = &k_audio_random_freq, - .data_type = k_convar_dtype_f32, - .opt_f32 = { .clamp = 0 }, - .persistent = 1 - }); - - for( int i=0; isys; - sys->_vol = 1.0f; - sys->ch = 1; - sys->name = "ambient"; - sys->flags = SFX_FLAG_PERSISTENT; - } -#endif -} - -static void world_audio_spawn_random( v3f around ) -{ -#if 0 - for( int i=0; isys.is_playing ) - { - sfx_set_playrnd( &audio_birds, &layer->sys, 0, 3 ); - - v3f chance; - vg_rand_sphere( chance ); - v3_muladds( around, chance, 100.0f, layer->pos ); - - return; - } - } -#endif -} - -static void world_audio_update( v3f around, v3f ears ) -{ -#if 0 - if( world_audio_last_tick + (double)k_audio_random_hz < vg_time ) - { - world_audio_last_tick = vg_time; - - float chance = vg_randf(); - if( chance < k_audio_random_freq ) - { - world_audio_spawn_random( around ); - } - } - - /* Spacialize */ - for( int i=0; isys.is_playing ) - audio_player_spacialize(&layer->sys, layer->pos, around, ears, 30.0f); - } -#endif -} - -static void world_audio_debug(void) -{ -#if 0 - for( int i=0; isys.is_playing ) - { - vg_line_pt3( layer->pos, 1.0f, 0xffff00ff ); - } - } -#endif -} +static void world_fadeout_audio( world_instance *world ); +static void world_audio_sample_distances( v3f co, int *index, float *value ); +static enum audio_sprite_type world_audio_sample_sprite_random( v3f origin, + v3f output ); #endif /* WORLD_AUDIO_H */