38 static pthread_mutex_t
mutex = PTHREAD_MUTEX_INITIALIZER;
54 pthread_mutex_lock (&
mutex);
58 pthread_mutex_unlock (&
mutex);
67 while ((next = g_queue_peek_head (&
vis_list)))
79 vis_node = g_queue_pop_head (&
vis_list);
82 pthread_mutex_unlock (&
mutex);
95 pthread_mutex_lock (&
mutex);
97 pthread_mutex_unlock (&
mutex);
108 pthread_mutex_lock (&
mutex);
115 pthread_mutex_unlock (&
mutex);
172 if (current_node && current_node->
channels != channels)
184 int node_time = time;
194 if ((last = g_queue_peek_tail (&
vis_list)))
197 at = channels * (
int) ((int64_t) (node_time - time) * rate / 1000);
204 current_node = g_malloc (
sizeof (
VisNode));
205 current_node->
time = node_time;
206 current_node->
data = g_malloc (
sizeof (
float) * channels * 512);
217 memcpy (current_node->
data + channels *
current_frames, data + at, sizeof (
float) * copy);
220 if (current_frames < 512)
223 g_queue_push_tail (&
vis_list, current_node);
230 vis_node->
time += GPOINTER_TO_INT (offset);
236 current_node->
time += offset;
243 pthread_mutex_lock (&
mutex);
246 pthread_mutex_unlock (&
mutex);