model_audio.c File Reference

#include <math.h>
#include "gui.h"
#include "dijkstra.h"
#include "stage_internal.h"

Defines

#define AUDIO_DEBUG1(...)   { printf(__VA_ARGS__); fflush(stdout);}
#define AUDIO_DEBUG2(...)   {}
#define AUDIO_DEBUG_ALLOC(...)   {}
#define AUDIO_FIG_DESTROY_LATER
#define AUDIO_FIG_DESTROY_LIFEMS   (100)
#define AUDIO_HEARING_RANGE   (INFINITY)
#define AUDIO_USE_CACHE
#define GMC(X, Y)   (mapdata[(X)+(Y)*w])
#define GX2P(X)   ((int) ( ( (X) + geom.size.x/2.0 ) / mres ) )
#define GY2P(Y)   ((int) ( ( (Y) + geom.size.y/2.0 ) / mres ) )
#define PX2G(X)   ((X)*mres-geom.size.x/2.0)
#define PY2G(Y)   ((Y)*mres-geom.size.y/2.0)

Functions

int audio_checkvisible (stg_model_t *mod, double x1, double y1, double x2, double y2)
void audio_create_visibilitygraph (stg_model_t *mod)
void audio_deliver_msgs (gpointer key, gpointer data, gpointer user)
void audio_draw_path (gpointer data, gpointer user)
void audio_find_dist_multi (stg_model_t *mod, stg_pose_t *srcpose, int ndest, GArray *devpose, double *dists, double *angles)
void audio_findpoints (gpointer key, gpointer data, gpointer user)
void audio_free_path (gpointer data, gpointer user)
int audio_init (stg_model_t *mod)
void audio_load (stg_model_t *mod)
void audio_path_destroy (gpointer data)
gboolean audio_pointpair_equal (gconstpointer v1, gconstpointer v2)
guint audio_pointpair_hash (gconstpointer v)
void audio_pointpair_key_destroy (gpointer data)
int audio_raytrace_match (stg_model_t *mod, stg_model_t *hitmod)
int audio_render_cfg (stg_model_t *mod, void *userp)
int audio_render_data (stg_model_t *mod, void *userp)
void audio_render_line (int8_t *buf, int w, int h, int x1, int y1, int x2, int y2, int8_t val)
void audio_render_line2 (int8_t *buf, int w, int h, int x1, int y1, int x2, int y2, int8_t val)
int audio_shutdown (stg_model_t *mod)
int audio_startup (stg_model_t *mod)
stg_pose_taudio_stg_pose_dup (const stg_pose_t *d)
gboolean audio_stg_pose_t_equal (const stg_pose_t p1, const stg_pose_t p2)
int audio_unrender_cfg (stg_model_t *mod, void *userp)
int audio_unrender_data (stg_model_t *mod, void *userp)
int audio_update (stg_model_t *mod)

Variables

GHashTable * dijkstra_adjacency
GHashTable * dijkstra_d
GHashTable * dijkstra_previous

Define Documentation

#define AUDIO_DEBUG1 ( ...   )     { printf(__VA_ARGS__); fflush(stdout);}

#define AUDIO_DEBUG2 ( ...   )     {}

#define AUDIO_DEBUG_ALLOC ( ...   )     {}

#define AUDIO_FIG_DESTROY_LATER

#define AUDIO_FIG_DESTROY_LIFEMS   (100)

Referenced by audio_render_data().

#define AUDIO_HEARING_RANGE   (INFINITY)

#define AUDIO_USE_CACHE

#define GMC ( X,
 )     (mapdata[(X)+(Y)*w])

Referenced by audio_findpoints().

#define GX2P (  )     ((int) ( ( (X) + geom.size.x/2.0 ) / mres ) )

#define GY2P (  )     ((int) ( ( (Y) + geom.size.y/2.0 ) / mres ) )

#define PX2G (  )     ((X)*mres-geom.size.x/2.0)

Referenced by audio_findpoints().

#define PY2G (  )     ((Y)*mres-geom.size.y/2.0)

Referenced by audio_findpoints().


Function Documentation

int audio_checkvisible ( stg_model_t mod,
double  x1,
double  y1,
double  x2,
double  y2 
)

void audio_create_visibilitygraph ( stg_model_t mod  ) 

void audio_deliver_msgs ( gpointer  key,
gpointer  data,
gpointer  user 
)

void audio_draw_path ( gpointer  data,
gpointer  user 
)

void audio_find_dist_multi ( stg_model_t mod,
stg_pose_t srcpose,
int  ndest,
GArray *  devpose,
double *  dists,
double *  angles 
)

Loop over all points and fill the information. If the points are directly visible and don't need dijkstra then put them at the end of list.

if directly visible just calculate the distance

if not directly visible use dijkstra

References audio_checkvisible(), AUDIO_DEBUG2, AUDIO_DEBUG_ALLOC, AUDIO_HEARING_RANGE, stg_audio_data_t::audio_paths, audio_stg_pose_dup(), dijkstra_d, dijkstra_insert_edge(), dijkstra_previous, dijkstra_remove_temp_edges(), dijkstra_run(), TRUE, stg_pose_t::x, and stg_pose_t::y.

Referenced by audio_update().

void audio_free_path ( gpointer  data,
gpointer  user 
)

References AUDIO_DEBUG_ALLOC.

Referenced by audio_path_destroy(), and audio_update().

void audio_load ( stg_model_t mod  ) 

References AUDIO_DEBUG2.

Referenced by audio_init().

void audio_path_destroy ( gpointer  data  ) 

References audio_free_path().

Referenced by audio_startup().

gboolean audio_pointpair_equal ( gconstpointer  v1,
gconstpointer  v2 
)

References audio_stg_pose_t_equal().

Referenced by audio_startup().

guint audio_pointpair_hash ( gconstpointer  v  ) 

Referenced by audio_startup().

void audio_pointpair_key_destroy ( gpointer  data  ) 

References AUDIO_DEBUG_ALLOC.

Referenced by audio_startup().

int audio_raytrace_match ( stg_model_t mod,
stg_model_t hitmod 
)

Referenced by audio_checkvisible().

void audio_render_line ( int8_t *  buf,
int  w,
int  h,
int  x1,
int  y1,
int  x2,
int  y2,
int8_t  val 
)

void audio_render_line2 ( int8_t *  buf,
int  w,
int  h,
int  x1,
int  y1,
int  x2,
int  y2,
int8_t  val 
)

Referenced by audio_findpoints().

int audio_shutdown ( stg_model_t mod  ) 

References AUDIO_DEBUG2, and dijkstra_destroy().

Referenced by audio_init().

stg_pose_t* audio_stg_pose_dup ( const stg_pose_t d  ) 

References AUDIO_DEBUG_ALLOC.

Referenced by audio_find_dist_multi().

gboolean audio_stg_pose_t_equal ( const stg_pose_t  p1,
const stg_pose_t  p2 
)

References stg_pose_t::x, and stg_pose_t::y.

Referenced by audio_pointpair_equal().

int audio_unrender_cfg ( stg_model_t mod,
void *  userp 
)

References stg_model_fig_clear().

Referenced by audio_init().

int audio_unrender_data ( stg_model_t mod,
void *  userp 
)

Referenced by audio_init().


Variable Documentation


Generated on Wed Jun 3 23:12:29 2009 for Stage by  doxygen 1.5.9