annotate src/paranormal-ng/plugin.c @ 2078:1fa3c8cd366a

paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
author William Pitcock <nenolod@atheme.org>
date Mon, 15 Oct 2007 06:20:13 -0500
parents
children bd3a24b39058
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2078
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
1 /*
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
2 * paranormal: iterated pipeline-driven visualization plugin
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
3 * Copyright (c) 2006, 2007 William Pitcock <nenolod@dereferenced.org>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
4 * Portions copyright (c) 2001 Jamie Gennis <jgennis@mindspring.com>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
5 *
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or modify
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
7 * it under the terms of the GNU General Public License as published by
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
8 * the Free Software Foundation; under version 2 of the License.
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
9 *
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
13 * GNU General Public License for more details.
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
14 *
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
16 * along with this program; if not, write to the Free Software
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
18 */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
19
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
20 /* FIXME: issues with not uniniting variables between
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
21 enables? I wasn't too careful about that, but it
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
22 seems to work fine. If there are problems perhaps
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
23 look for a bug there?
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
24 */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
25
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
26 #include <config.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
27
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
28 #include <stdlib.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
29 #include <stdio.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
30 #include <stdarg.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
31 #include <memory.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
32 #include <math.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
33 #include <setjmp.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
34 #include <unistd.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
35
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
36 #include <glib.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
37 #include <audacious/i18n.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
38
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
39 #include <gtk/gtk.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
40 #include <audacious/plugin.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
41 #include <audacious/util.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
42 #include <SDL/SDL.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
43 #include <SDL/SDL_thread.h>
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
44
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
45 #include "paranormal.h"
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
46 #include "actuators.h"
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
47 #include "presets.h"
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
48 #include "containers.h"
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
49
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
50 /* Error reporting dlg */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
51 static GtkWidget *err_dialog;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
52
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
53 /* Draw thread stuff */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
54 /* FIXME: Do I need mutex for pn_done? */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
55 static SDL_Thread *draw_thread = NULL;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
56 static SDL_mutex *sound_data_mutex;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
57 static SDL_mutex *config_mutex;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
58
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
59 static gboolean pn_done = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
60 jmp_buf quit_jmp;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
61 gboolean timeout_set = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
62 guint quit_timeout;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
63
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
64 /* Sound stuffs */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
65 static gboolean new_pcm_data = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
66 static gboolean new_freq_data = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
67 static gint16 tmp_pcm_data[2][512];
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
68 static gint16 tmp_freq_data[2][256];
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
69
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
70 /* XMMS interface */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
71 static void pn_xmms_init (void);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
72 static void pn_xmms_cleanup (void);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
73 static void pn_xmms_about (void);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
74 static void pn_xmms_configure (void);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
75 static void pn_xmms_render_pcm (gint16 data[2][512]);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
76 static void pn_xmms_render_freq (gint16 data[2][256]);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
77
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
78 static VisPlugin pn_vp =
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
79 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
80 .description = "Paranormal Visualization Studio",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
81 .num_pcm_chs_wanted = 2,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
82 .num_freq_chs_wanted = 2,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
83 .init = pn_xmms_init,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
84 .cleanup = pn_xmms_cleanup,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
85 .about = pn_xmms_about,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
86 .configure = pn_xmms_configure,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
87 .render_pcm = pn_xmms_render_pcm,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
88 .render_freq = pn_xmms_render_freq
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
89 };
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
90
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
91 VisPlugin *pn_vplist[] = { &pn_vp, NULL };
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
92
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
93 DECLARE_PLUGIN(paranormal, NULL, NULL, NULL, NULL, NULL, NULL, pn_vplist,NULL);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
94
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
95 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
96 load_pn_rc (void)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
97 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
98 struct pn_actuator *a, *b;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
99
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
100 if (! pn_rc)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
101 pn_rc = g_new0 (struct pn_rc, 1);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
102
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
103 /* load a default preset */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
104 pn_rc->actuator = create_actuator ("container_simple");
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
105 if (! pn_rc->actuator) goto ugh;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
106
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
107 a = create_actuator ("general_clear");
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
108 if (! a) goto ugh;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
109 container_add_actuator (pn_rc->actuator, a);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
110
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
111 a = create_actuator ("wave_horizontal");
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
112 if (! a) goto ugh;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
113 container_add_actuator (pn_rc->actuator, a);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
114
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
115 return;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
116
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
117 ugh:
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
118 if (pn_rc->actuator)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
119 destroy_actuator (pn_rc->actuator);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
120 pn_error ("Error loading default preset");
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
121 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
122
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
123 static int
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
124 draw_thread_fn (gpointer data)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
125 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
126 gfloat fps = 0.0;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
127 guint last_time = 0, last_second = 0;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
128 guint this_time;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
129 pn_init ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
130
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
131 /* Used when pn_quit is called from this thread */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
132 if (setjmp (quit_jmp) != 0)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
133 pn_done = TRUE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
134
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
135 while (! pn_done)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
136 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
137 SDL_mutexP (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
138 if (new_freq_data)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
139 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
140 memcpy (pn_sound_data->freq_data, tmp_freq_data,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
141 sizeof (gint16) * 2 * 256);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
142 new_freq_data = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
143 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
144 if (new_pcm_data)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
145 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
146 memcpy (pn_sound_data->pcm_data, tmp_pcm_data,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
147 sizeof (gint16) * 2 * 512);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
148 new_freq_data = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
149 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
150 SDL_mutexV (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
151 SDL_mutexP (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
152 pn_render ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
153 SDL_mutexV (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
154
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
155 /* Compute the FPS */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
156 this_time = SDL_GetTicks ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
157
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
158 fps = fps * .95 + (1000. / (gfloat) (this_time - last_time)) * .05;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
159 if (this_time > 2000 + last_second)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
160 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
161 last_second = this_time;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
162 g_print ("FPS: %f\n", fps);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
163 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
164 last_time = this_time;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
165
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
166 #ifdef _POSIX_PRIORITY_SCHEDULING
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
167 sched_yield();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
168 #endif
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
169 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
170
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
171 /* Just in case a pn_quit () was called in the loop */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
172 /* SDL_mutexV (sound_data_mutex); */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
173
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
174 pn_cleanup ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
175
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
176 return 0;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
177 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
178
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
179 /* Is there a better way to do this? this = messy
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
180 It appears that calling disable_plugin () in some
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
181 thread other than the one that called pn_xmms_init ()
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
182 causes a seg fault :( */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
183 static int
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
184 quit_timeout_fn (gpointer data)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
185 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
186 if (pn_done)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
187 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
188 pn_vp.disable_plugin (&pn_vp);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
189 return FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
190 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
191
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
192 return TRUE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
193 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
194
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
195 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
196 pn_xmms_init (void)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
197 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
198 /* If it isn't already loaded, load the run control */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
199 if (! pn_rc)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
200 load_pn_rc ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
201
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
202 sound_data_mutex = SDL_CreateMutex ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
203 config_mutex = SDL_CreateMutex ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
204 if (! sound_data_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
205 pn_fatal_error ("Unable to create a new mutex: %s",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
206 SDL_GetError ());
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
207
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
208 pn_done = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
209 draw_thread = SDL_CreateThread (draw_thread_fn, NULL);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
210 if (! draw_thread)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
211 pn_fatal_error ("Unable to create a new thread: %s",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
212 SDL_GetError ());
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
213
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
214 /* Add a gtk timeout to test for quits */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
215 quit_timeout = gtk_timeout_add (1000, quit_timeout_fn, NULL);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
216 timeout_set = TRUE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
217 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
218
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
219 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
220 pn_xmms_cleanup (void)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
221 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
222 if (timeout_set)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
223 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
224 gtk_timeout_remove (quit_timeout);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
225 timeout_set = FALSE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
226 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
227
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
228 if (draw_thread)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
229 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
230 pn_done = TRUE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
231 SDL_WaitThread (draw_thread, NULL);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
232 draw_thread = NULL;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
233 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
234
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
235 if (sound_data_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
236 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
237 SDL_DestroyMutex (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
238 sound_data_mutex = NULL;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
239 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
240
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
241 if (config_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
242 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
243 SDL_DestroyMutex (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
244 config_mutex = NULL;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
245 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
246 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
247
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
248 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
249 about_close_clicked(GtkWidget *w, GtkWidget **window)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
250 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
251 gtk_widget_destroy(*window);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
252 *window=NULL;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
253 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
254
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
255 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
256 about_closed(GtkWidget *w, GdkEvent *e, GtkWidget **window)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
257 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
258 about_close_clicked(w,window);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
259 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
260
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
261 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
262 pn_xmms_about (void)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
263 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
264 audacious_info_dialog("About Paranormal Visualization Studio",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
265
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
266 "Paranormal Visualization Studio " VERSION "\n\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
267 Copyright (C) 2006, William Pitcock <nenolod -at- nenolod.net>\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
268 Portions Copyright (C) 2001, Jamie Gennis <jgennis -at- mindspring.com>\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
269 \n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
270 This program is free software; you can redistribute it and/or modify\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
271 it under the terms of the GNU General Public License as published by\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
272 the Free Software Foundation; either version 2 of the License, or\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
273 (at your option) any later version.\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
274 \n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
275 This program is distributed in the hope that it will be useful,\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
276 but WITHOUT ANY WARRANTY; without even the implied warranty of\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
277 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
278 GNU General Public License for more details.\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
279 \n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
280 You should have received a copy of the GNU General Public License\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
281 along with this program; if not, write to the Free Software\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
282 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307\n\
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
283 USA", _("Ok"), FALSE, NULL, NULL);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
284 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
285
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
286 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
287 pn_xmms_configure (void)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
288 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
289 /* We should already have a GDK_THREADS_ENTER
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
290 but we need to give it config_mutex */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
291 if (config_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
292 SDL_mutexP (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
293
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
294 if (! pn_rc)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
295 load_pn_rc ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
296
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
297 pn_configure ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
298
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
299 if (config_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
300 SDL_mutexV (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
301 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
302
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
303 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
304 pn_xmms_render_pcm (gint16 data[2][512])
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
305 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
306 SDL_mutexP (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
307 memcpy (tmp_pcm_data, data, sizeof (gint16) * 2 * 512);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
308 new_pcm_data = TRUE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
309 SDL_mutexV (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
310 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
311
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
312 static void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
313 pn_xmms_render_freq (gint16 data[2][256])
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
314 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
315 SDL_mutexP (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
316 memcpy (tmp_freq_data, data, sizeof (gint16) * 2 * 256);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
317 new_freq_data = TRUE;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
318 SDL_mutexV (sound_data_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
319 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
320
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
321 /* **************** paranormal.h stuff **************** */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
322
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
323 void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
324 pn_set_rc (struct pn_rc *new_rc)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
325 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
326 if (config_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
327 SDL_mutexP (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
328
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
329 if (! pn_rc)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
330 load_pn_rc ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
331
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
332 if (pn_rc->actuator)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
333 destroy_actuator (pn_rc->actuator);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
334 pn_rc->actuator = new_rc->actuator;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
335
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
336 if (config_mutex)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
337 SDL_mutexV (config_mutex);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
338 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
339
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
340 void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
341 pn_fatal_error (const char *fmt, ...)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
342 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
343 char *errstr;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
344 va_list ap;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
345 GtkWidget *dialog;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
346 GtkWidget *close, *label;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
347
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
348 /* Don't wanna try to lock GDK if we already have it */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
349 if (draw_thread && SDL_ThreadID () == SDL_GetThreadID (draw_thread))
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
350 GDK_THREADS_ENTER ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
351
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
352 /* now report the error... */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
353 va_start (ap, fmt);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
354 errstr = g_strdup_vprintf (fmt, ap);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
355 va_end (ap);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
356
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
357 dialog=gtk_dialog_new();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
358 gtk_window_set_title(GTK_WINDOW(dialog), "Error - Paranormal Visualization Studio - " VERSION);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
359 gtk_container_border_width (GTK_CONTAINER (dialog), 8);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
360
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
361 label=gtk_label_new(errstr);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
362 fprintf (stderr, "%s\n", errstr);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
363 g_free (errstr);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
364
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
365 close = gtk_button_new_with_label ("Close");
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
366 gtk_signal_connect_object (GTK_OBJECT (close), "clicked",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
367 GTK_SIGNAL_FUNC (gtk_widget_destroy),
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
368 GTK_OBJECT (dialog));
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
369
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
370 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), label, FALSE,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
371 FALSE, 0);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
372 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->action_area), close,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
373 FALSE, FALSE, 0);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
374 gtk_widget_show (label);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
375 gtk_widget_show (close);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
376
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
377 gtk_widget_show (dialog);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
378 gtk_widget_grab_focus (dialog);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
379
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
380 if (draw_thread && SDL_ThreadID () == SDL_GetThreadID (draw_thread))
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
381 GDK_THREADS_LEAVE ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
382
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
383 pn_quit ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
384 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
385
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
386
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
387 void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
388 pn_error (const char *fmt, ...)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
389 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
390 char *errstr;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
391 va_list ap;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
392 static GtkWidget *text;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
393 static GtkTextBuffer *textbuf;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
394
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
395 /* now report the error... */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
396 va_start (ap, fmt);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
397 errstr = g_strdup_vprintf (fmt, ap);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
398 va_end (ap);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
399 fprintf (stderr, "Paranormal-CRITICAL **: %s\n", errstr);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
400
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
401 /* This is the easiest way of making sure we don't
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
402 get stuck trying to lock a mutex that this thread
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
403 already owns since this fn can be called from either
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
404 thread */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
405 if (draw_thread && SDL_ThreadID () == SDL_GetThreadID (draw_thread))
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
406 GDK_THREADS_ENTER ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
407
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
408 if (! err_dialog)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
409 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
410 GtkWidget *close;
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
411
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
412 err_dialog=gtk_dialog_new();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
413 gtk_window_set_title (GTK_WINDOW (err_dialog), "Error - Paranormal Visualization Studio - " VERSION);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
414 gtk_window_set_policy (GTK_WINDOW (err_dialog), FALSE, FALSE, FALSE);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
415 gtk_widget_set_usize (err_dialog, 400, 200);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
416 gtk_container_border_width (GTK_CONTAINER (err_dialog), 8);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
417
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
418 textbuf = gtk_text_buffer_new(NULL);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
419 text = gtk_text_view_new_with_buffer (textbuf);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
420
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
421 close = gtk_button_new_with_label ("Close");
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
422 gtk_signal_connect_object (GTK_OBJECT (close), "clicked",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
423 GTK_SIGNAL_FUNC (gtk_widget_hide),
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
424 GTK_OBJECT (err_dialog));
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
425 gtk_signal_connect_object (GTK_OBJECT (err_dialog), "delete-event",
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
426 GTK_SIGNAL_FUNC (gtk_widget_hide),
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
427 GTK_OBJECT (err_dialog));
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
428
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
429 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (err_dialog)->vbox), text, FALSE,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
430 FALSE, 0);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
431 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (err_dialog)->action_area), close,
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
432 FALSE, FALSE, 0);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
433 gtk_widget_show (text);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
434 gtk_widget_show (close);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
435 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
436
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
437 gtk_text_buffer_set_text(GTK_TEXT_BUFFER(textbuf), errstr, -1);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
438 g_free (errstr);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
439
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
440 gtk_widget_show (err_dialog);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
441 gtk_widget_grab_focus (err_dialog);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
442
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
443 if (draw_thread && SDL_ThreadID () == SDL_GetThreadID (draw_thread))
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
444 GDK_THREADS_LEAVE ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
445 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
446
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
447
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
448 /* This is confusing...
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
449 Don't call this from anywhere but the draw thread or
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
450 the initialization xmms thread (ie NOT the xmms sound
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
451 data functions) */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
452 void
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
453 pn_quit (void)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
454 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
455 if (draw_thread && SDL_ThreadID () == SDL_GetThreadID (draw_thread))
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
456 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
457 /* We're in the draw thread so be careful */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
458 longjmp (quit_jmp, 1);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
459 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
460 else
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
461 {
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
462 /* We're not in the draw thread, so don't sweat it...
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
463 addendum: looks like we have to bend over backwards (forwards?)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
464 for xmms here too */
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
465 pn_vp.disable_plugin (&pn_vp);
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
466 while (1)
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
467 gtk_main_iteration ();
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
468 }
1fa3c8cd366a paranormal-ng: a GL visualiser. lots to do, most stuff won't work, but hey, this will do cool stuff too soon
William Pitcock <nenolod@atheme.org>
parents:
diff changeset
469 }