+/* finds any active playing in world and fades them out, we can only do this
+ * while unloading */
+VG_STATIC void world_fadeout_audio( world_instance *world )
+{
+ if( world->status != k_world_status_unloading ){
+ vg_fatal_error( "World status must be set to 'unloading', to fadeout"
+ " audio.\n" );
+ }
+
+ u8 world_id = (world - world_global.worlds) + 1;
+
+ audio_lock();
+ for( u32 i=0; i<AUDIO_CHANNELS; i++ ){
+ audio_channel *ch = &vg_audio.channels[i];
+
+ if( ch->allocated && (ch->world_id == world_id) ){
+ ch = audio_channel_fadeout( ch, 1.0f );
+ }
+ }
+ audio_unlock();
+}
+