annotate src/projectm/main.c @ 1945:05b9abd78a87

HAVE_CONFIG_H removal
author William Pitcock <nenolod@atheme.org>
date Mon, 01 Oct 2007 16:48:28 -0500
parents b180f83e4388
children bd3a24b39058
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
1 /*
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
2 xmms-projectM v0.99 - xmms-projectm.sourceforge.net
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
3 --------------------------------------------------
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
4
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
5 Lead Developers: Carmelo Piccione (cep@andrew.cmu.edu) &
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
6 Peter Sperl (peter@sperl.com)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
7
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
8 We have also been advised by some professors at CMU, namely Roger B. Dannenberg.
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
9 http://www-2.cs.cmu.edu/~rbd/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
10
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
11 The inspiration for this program was Milkdrop by Ryan Geiss. Obviously.
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
12
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
13 This code is distributed under the GPL.
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
14
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
15
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
16 THANKS FOR THE CODE!!!
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
17 -------------------------------------------------
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
18 The base for this program was andy@nobugs.org's XMMS plugin tutorial
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
19 http://www.xmms.org/docs/vis-plugin.html
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
20
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
21 We used some FFT code by Takuya OOURA instead of XMMS' built-in fft code
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
22 fftsg.c - http://momonga.t.u-tokyo.ac.jp/~ooura/fft.html
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
23
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
24 For font rendering we used GLF by Roman Podobedov
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
25 glf.c - http://astronomy.swin.edu.au/~pbourke/opengl/glf/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
26
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
27 and some beat detection code was inspired by Frederic Patin @
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
28 www.gamedev.net/reference/programming/features/beatdetection/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
29
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
30 */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
31
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
32
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
33 #include <stdio.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
34 #include <audacious/plugin.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
35 #include <string.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
36 #include <stdlib.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
37 #include <gtk/gtk.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
38 #include <audacious/util.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
39 #include <SDL/SDL.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
40 #include <SDL/SDL_thread.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
41 #include <GL/gl.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
42 #include <GL/glu.h>
1035
711ec8d39ca6 [svn] Changed alarm and projectm plugins so they use auddrct now.
magma
parents: 663
diff changeset
43 #include <audacious/auddrct.h>
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
44 #include <math.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
45 #include <sys/stat.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
46 #include <sys/types.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
47
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
48 #include <projectM/projectM.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
49 #include <projectM/console_interface.h>
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
50 #include "sdltoprojectM.h"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
51 #include "video_init.h"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
52
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
53 #include <config.h>
1944
b180f83e4388 more config_h removal
William Pitcock <nenolod@atheme.org>
parents: 1644
diff changeset
54
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
55 #define CONFIG_FILE "/config"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
56 #define PRESETS_DIR "/presets"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
57 #define FONTS_DIR "/fonts"
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
58
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
59 // Forward declarations
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
60 static void projectM_xmms_init(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
61 static void projectM_cleanup(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
62 static void projectM_about(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
63 static void projectM_configure(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
64 static void projectM_playback_start(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
65 static void projectM_playback_stop(void);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
66 static void projectM_render_pcm(gint16 pcm_data[2][512]);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
67 static void projectM_render_freq(gint16 pcm_data[2][256]);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
68 void read_config();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
69
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
70
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
71 //extern preset_t * active_preset;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
72
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
73 // Callback functions
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
74 VisPlugin projectM_vtable = {
1644
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
75 .description = "projectM v0.99", // description
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
76 .num_pcm_chs_wanted = 2, // # of PCM channels for render_pcm()
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
77 .num_freq_chs_wanted = 0, // # of freq channels wanted for render_freq()
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
78 .init = projectM_xmms_init, // Called when plugin is enabled
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
79 .cleanup = projectM_cleanup, // Called when plugin is disabled
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
80 .about = projectM_about, // Show the about box
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
81 .configure = projectM_configure, // Show the configure box
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
82 .playback_start = projectM_playback_start, // Called when playback starts
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
83 .playback_stop = projectM_playback_stop, // Called when playback stops
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
84 .render_pcm = projectM_render_pcm, // Render the PCM data, must return quickly
c0463e51c338 projectm: C99
William Pitcock <nenolod@atheme.org>
parents: 1395
diff changeset
85 .render_freq = projectM_render_freq // Render the freq data, must return quickly
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
86 };
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
87
1139
038298d9fbe3 [svn] - projectm: convert to plugin2 architecture. now SVN users have milkdrop back.
nenolod
parents: 1061
diff changeset
88 VisPlugin *projectM_vplist[] = { &projectM_vtable, NULL };
038298d9fbe3 [svn] - projectm: convert to plugin2 architecture. now SVN users have milkdrop back.
nenolod
parents: 1061
diff changeset
89
1395
761e17b23e0c added Discovery plugin type
Cristi Magherusan <majeru@atheme-project.org>
parents: 1139
diff changeset
90 DECLARE_PLUGIN(projectm, NULL, NULL, NULL, NULL, NULL, NULL, projectM_vplist,NULL);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
91
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
92 // Our worker thread
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
93 SDL_Thread *worker_thread;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
94
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
95 SDL_mutex *mutex;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
96
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
97 SDL_sem *sem;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
98
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
99 SDL_Event event;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
100
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
101 SDL_Surface *screen;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
102 //SDL_RenderTarget *RenderTarget = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
103 //GLuint RenderTargetTextureID;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
104
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
105 projectM_t *globalPM = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
106
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
107 int maxsamples=512;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
108
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
109 int texsize=512;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
110 int gx=32,gy=24;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
111 int wvw=640,wvh=480;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
112 int fvw=1280,fvh=960;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
113 int fps=30, fullscreen=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
114 char *disp;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
115
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
116 int disable_projectm(void) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
117 projectM_vtable.disable_plugin(&projectM_vtable);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
118 return 0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
119 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
120
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
121 int get_xmms_title(void) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
122 static char check_title = 1;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
123 static int last_pos;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
124 static char *last_title = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
125 int pos;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
126 char *title = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
127
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
128 //Nice optimization, but we want the title no matter what so I can display it when the song changes
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
129 #if 0
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
130 if(!(globalPM->showtitle%2)) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
131 /* Repeat less often when not showing title */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
132 return 1000;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
133 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
134 #endif
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
135
1035
711ec8d39ca6 [svn] Changed alarm and projectm plugins so they use auddrct now.
magma
parents: 663
diff changeset
136 pos = audacious_drct_pl_get_pos();
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
137 /* Only check every 1 second for title change, otherwise check pos */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
138 if(check_title || pos != last_pos) {
1035
711ec8d39ca6 [svn] Changed alarm and projectm plugins so they use auddrct now.
magma
parents: 663
diff changeset
139 title = audacious_drct_pl_get_title(pos);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
140 if(title && (!last_title || strcmp(last_title,title))) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
141 globalPM->title = title;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
142 globalPM->drawtitle = 1;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
143 g_free(last_title);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
144 last_title = title;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
145 } else if(title && last_title != title) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
146 /* New copy of last title */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
147 g_free(title);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
148 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
149 check_title = !check_title;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
150 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
151 last_pos = pos;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
152 /* Repeat every 500ms */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
153 return 500;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
154 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
155
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
156 void worker_func()
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
157 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
158 char projectM_data[PATH_MAX];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
159
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
160 SDL_TimerID title_timer = NULL;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
161
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
162
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
163 read_config();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
164
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
165 init_display(wvw,wvh,fullscreen);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
166
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
167 SDL_WM_SetCaption("projectM v0.99", "projectM v0.99");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
168
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
169
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
170 /** Initialise projectM */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
171
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
172 globalPM = (projectM_t *)malloc( sizeof( projectM_t ) );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
173
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
174 projectM_reset( globalPM );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
175
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
176 globalPM->fullscreen = fullscreen;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
177 globalPM->renderTarget->texsize = texsize;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
178 globalPM->gx=gx;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
179 globalPM->gy=gy;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
180 globalPM->fps=fps;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
181 globalPM->renderTarget->usePbuffers=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
182
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
183 strcpy(projectM_data, PROJECTM_DATADIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
184 strcpy(projectM_data+strlen(PROJECTM_DATADIR), FONTS_DIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
185 projectM_data[strlen(PROJECTM_DATADIR)+strlen(FONTS_DIR)]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
186
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
187 globalPM->fontURL = (char *)malloc( sizeof( char ) * 512 );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
188 strcpy( globalPM->fontURL, projectM_data );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
189
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
190 strcpy(projectM_data+strlen(PROJECTM_DATADIR), PRESETS_DIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
191 projectM_data[strlen(PROJECTM_DATADIR)+strlen(PRESETS_DIR)]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
192
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
193 globalPM->presetURL = (char *)malloc( sizeof( char ) * 512 );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
194 strcpy( globalPM->presetURL, projectM_data );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
195
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
196
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
197 projectM_init( globalPM );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
198
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
199 projectM_resetGL( globalPM, wvw, wvh );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
200
663
aaab0bede198 [svn] Cast those pointers properly, and do not use deprecated GTK+ functions.
chainsaw
parents: 358
diff changeset
201 title_timer = SDL_AddTimer(500, (SDL_NewTimerCallback) get_xmms_title, NULL);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
202
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
203 /** Initialise the thread */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
204
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
205 SDL_SemTryWait(sem);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
206 while ( SDL_SemTryWait(sem) ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
207 projectMEvent evt;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
208 projectMKeycode key;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
209 projectMModifier mod;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
210
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
211 /** Process SDL events */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
212 SDL_Event event;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
213 while ( SDL_PollEvent( &event ) ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
214 /** Translate into projectM codes and process */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
215 evt = sdl2pmEvent( event );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
216 key = sdl2pmKeycode( event.key.keysym.sym );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
217 mod = sdl2pmModifier( event.key.keysym.mod );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
218
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
219 if ( evt == PROJECTM_KEYDOWN ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
220
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
221
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
222 if(key == SDLK_f)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
223 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
224 int w, h;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
225 if (fullscreen == 0) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
226 w = fvw;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
227 h = fvh;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
228 } else {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
229 w = wvw;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
230 h = wvh;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
231 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
232 globalPM->fullscreen = fullscreen ^= 1;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
233 resize_display(w, h, fullscreen);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
234 projectM_resetGL( globalPM, w, h );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
235 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
236 else key_handler(globalPM,evt,key,mod);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
237
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
238 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
239 else if ( evt == PROJECTM_VIDEORESIZE )
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
240 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
241 wvw=event.resize.w;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
242 wvh=event.resize.h;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
243 resize_display(wvw, wvh, 0);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
244 projectM_resetGL( globalPM, wvw, wvh );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
245
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
246 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
247 else if ( evt == PROJECTM_VIDEOQUIT ) {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
248
663
aaab0bede198 [svn] Cast those pointers properly, and do not use deprecated GTK+ functions.
chainsaw
parents: 358
diff changeset
249 (void) g_idle_add ((GSourceFunc) disable_projectm, NULL);
358
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
250 /* if(quit_timer == NULL)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
251 quit_timer = SDL_AddTimer(500, disable_projectm, NULL);*/
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
252 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
253
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
254 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
255
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
256
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
257 /** Render the new frame */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
258
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
259 renderFrame( globalPM );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
260
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
261 SDL_GL_SwapBuffers();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
262 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
263
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
264
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
265
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
266 printf("Worker thread: Exiting\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
267 if(title_timer) SDL_RemoveTimer(title_timer);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
268 g_free(globalPM->title);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
269 free(globalPM->presetURL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
270 free(globalPM->fontURL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
271 free(globalPM);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
272 close_display();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
273 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
274
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
275 static void projectM_xmms_init(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
276 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
277
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
278 printf("projectM plugin: Initializing\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
279
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
280 SDL_EnableUNICODE(1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
281
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
282 mutex = SDL_CreateMutex();
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
283
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
284 sem = SDL_CreateSemaphore(1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
285
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
286 worker_thread = SDL_CreateThread ((void *) worker_func, NULL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
287
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
288 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
289
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
290
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
291
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
292 static void projectM_cleanup(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
293 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
294
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
295 SDL_SemPost(sem);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
296 SDL_WaitThread(worker_thread, NULL);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
297
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
298 SDL_DestroySemaphore(sem);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
299 printf("Destroy Semaphore\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
300 SDL_DestroyMutex(mutex);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
301 printf("Destroy Mutex\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
302
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
303 printf("projectM plugin: Cleanup completed\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
304 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
305 static void projectM_about(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
306 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
307 printf("projectM plugin: About\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
308 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
309 static void projectM_configure(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
310 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
311 printf("projectM plugin: Configure\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
312 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
313 static void projectM_playback_start(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
314 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
315 printf("projectM plugin: Playback starting\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
316 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
317 static void projectM_playback_stop(void)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
318 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
319 printf("projectM plugin: Playback stopping\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
320 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
321 static void projectM_render_pcm(gint16 pcm_data[2][512])
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
322 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
323
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
324 if (0 < SDL_SemValue(sem)) return;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
325 SDL_mutexP(mutex);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
326
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
327 addPCM16Data(pcm_data,512);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
328
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
329 SDL_mutexV(mutex);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
330
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
331 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
332
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
333 static void projectM_render_freq(gint16 freq_data[2][256])
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
334 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
335 printf("NO GOOD\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
336 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
337
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
338
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
339 void read_config()
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
340 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
341
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
342 int n;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
343
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
344 char num[80];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
345 FILE *in;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
346 FILE *out;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
347
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
348 char* home;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
349 char projectM_home[PATH_MAX];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
350 char projectM_config[PATH_MAX];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
351
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
352 strcpy(projectM_config, PROJECTM_DATADIR);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
353 strcpy(projectM_config+strlen(PROJECTM_DATADIR), CONFIG_FILE);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
354 projectM_config[strlen(PROJECTM_DATADIR)+strlen(CONFIG_FILE)]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
355
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
356 home=getenv("HOME");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
357 strcpy(projectM_home, home);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
358 strcpy(projectM_home+strlen(home), "/.projectM/config");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
359 projectM_home[strlen(home)+strlen("/.projectM/config")]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
360
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
361
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
362 if ((in = fopen(projectM_home, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
363 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
364 printf("reading ~/.projectM/config \n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
365 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
366 else
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
367 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
368 printf("trying to create ~/.projectM/config \n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
369
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
370 strcpy(projectM_home, home);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
371 strcpy(projectM_home+strlen(home), "/.projectM");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
372 projectM_home[strlen(home)+strlen("/.projectM")]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
373 mkdir(projectM_home,0755);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
374
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
375 strcpy(projectM_home, home);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
376 strcpy(projectM_home+strlen(home), "/.projectM/config");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
377 projectM_home[strlen(home)+strlen("/.projectM/config")]='\0';
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
378
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
379 if((out = fopen(projectM_home,"w"))!=0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
380 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
381
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
382 if ((in = fopen(projectM_config, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
383 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
384
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
385 while(fgets(num,80,in)!=NULL)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
386 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
387 fputs(num,out);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
388 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
389 fclose(in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
390 fclose(out);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
391
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
392
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
393 if ((in = fopen(projectM_home, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
394 { printf("created ~/.projectM/config successfully\n"); }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
395 else{printf("This shouldn't happen, using implementation defualts\n");return;}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
396 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
397 else{printf("Cannot find projectM default config, using implementation defaults\n");return;}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
398 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
399 else
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
400 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
401 printf("Cannot create ~/.projectM/config, using default config file\n");
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
402 if ((in = fopen(projectM_config, "r")) != 0)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
403 { printf("Successfully opened default config file\n");}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
404 else{ printf("Using implementation defaults, your system is really messed up, I'm suprised we even got this far\n"); return;}
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
405
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
406 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
407
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
408 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
409
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
410
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
411
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
412 fgets(num, 80, in); fgets(num, 80, in); fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
413 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &texsize);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
414
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
415 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
416 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &gx);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
417
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
418 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
419 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &gy);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
420
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
421 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
422 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &wvw);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
423
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
424 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
425 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &wvh);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
426
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
427 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
428 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fvw);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
429
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
430 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
431 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fvh);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
432
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
433 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
434 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fps);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
435
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
436 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
437 if(fgets(num, 80, in) != NULL) sscanf (num, "%d", &fullscreen);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
438 /*
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
439 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
440 fgets(num, 80, in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
441
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
442 n=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
443 while (num[n]!=' ' && num[n]!='\n' && n < 80 && num[n]!=EOF)
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
444 {
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
445 disp[n]=num[n];
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
446 n++;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
447 }
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
448 disp[n]=0;
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
449
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
450
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
451 // sprintf(disp,"%s",num );
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
452 setenv("DISPLAY",disp,1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
453 printf("%s %d\n", disp,strlen(disp));
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
454 setenv("LD_PRELOAD", "/usr/lib/tls/libGL.so.1.0.4496", 1);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
455 */
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
456 fclose(in);
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
457
bc3bae2880ec [svn] - add support for projectM
nenolod
parents:
diff changeset
458 }