update helpers/location to 'frosted' ui
[carveJwlIkooP6JGAAIwe30JlM.git] / world_audio.h
index 2de8bf2b07402f429e9bc4d42ad3a7b23117bc2e..07d66d1cc300a2daca4a6df3d3962c62a35f3355 100644 (file)
@@ -1,117 +1,7 @@
-#ifndef WORLD_AUDIO_H
-#define WORLD_AUDIO_H
+#pragma once
+#include "world.h"
 
-#include "common.h"
-#include "vg/vg_audio.h"
-#include "audio.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; i<vg_list_size(world_ambient_layers); i++ )
-   {
-      struct world_ambient_layer *layer = &world_ambient_layers[i];
-      audio_player *sys = &layer->sys;
-      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; i<vg_list_size(world_ambient_layers); i++ )
-   {
-      struct world_ambient_layer *layer = &world_ambient_layers[i];
-
-      if( !layer->sys.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; i<vg_list_size(world_ambient_layers); i++ )
-   {
-      struct world_ambient_layer *layer = &world_ambient_layers[i];
-
-      if( layer->sys.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; i<vg_list_size(world_ambient_layers); i++ )
-   {
-      struct world_ambient_layer *layer = &world_ambient_layers[i];
-
-      if( layer->sys.is_playing )
-      {
-         vg_line_pt3( layer->pos, 1.0f, 0xffff00ff );
-      }
-   }
-#endif
-}
-
-#endif /* WORLD_AUDIO_H */
+void world_fadeout_audio( world_instance *world );
+void world_audio_sample_distances( v3f co, int *index, float *value );
+enum audio_sprite_type 
+world_audio_sample_sprite_random( v3f origin, v3f output );