File: w32g.h

package info (click to toggle)
timidity 2.13.2-40.2
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,132 kB
  • ctags: 20,555
  • sloc: ansic: 158,296; sh: 3,778; makefile: 1,156; tcl: 1,048; lisp: 499; perl: 285; ruby: 126
file content (390 lines) | stat: -rw-r--r-- 11,105 bytes parent folder | download | duplicates (8)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
/*
    TiMidity++ -- MIDI to WAVE converter and player
    Copyright (C) 1999-2002 Masanao Izumo <mo@goice.co.jp>
    Copyright (C) 1995 Tuukka Toivonen <tt@cgs.fi>

    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program; if not, write to the Free Software
    Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
*/

#ifndef ___W32G_H_
#define ___W32G_H_

#include <process.h>
#ifdef RC_NONE
#undef RC_NONE
#endif
#include <windows.h>
#ifdef RC_NONE
#undef RC_NONE
#endif
#define RC_NONE	0

#define LANGUAGE_JAPANESE				0x0001
#define LANGUAGE_ENGLISH				0x0002
extern int PlayerLanguage;
extern int PlayerMode;


#ifndef MAXPATH
#define MAXPATH 256
#endif /* MAXPATH */


typedef struct argc_argv_t_ {
	int argc;
	char **argv;
} argc_argv_t;

#if defined(_MSC_VER) || defined(__WATCOMC__)
//typedef void (__cdecl *MSVC_BEGINTHREAD_START_ADDRESS)(void *);
typedef LPTHREAD_START_ROUTINE MSVC_BEGINTHREAD_START_ADDRESS;
#elif defined(_BORLANDC_)
// typedef _USERENTRY (*BCC_BEGINTHREAD_START_ADDRESS)(void *);
typedef LPTHREAD_START_ROUTINE BCC_BEGINTHREAD_START_ADDRESS;
#endif

// beginthread for C RUNTIME LIBRARY

// HANDLE crt_beginthread(LPTHREAD_START_ROUTINE start_address, DWORD stack_size, LPVOID arglist);
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define crt_beginthread(start_address,stack_size,arglist) \
(HANDLE)_beginthread((MSVC_BEGINTHREAD_START_ADDRESS)start_address,(unsigned)stack_size,(void *)arglist)
#elif defined(_BORLANDC_)
#define crt_beginthread(start_address,stack_size,arglist) \
(HANDLE)_beginthread((BCC_BEGINTHREAD_START_ADDRESS)start_address,(unsigned)stack_size,(void *)arglist)
#else
#define crt_beginthread(start_address,stack_size,arglist) \
(HANDLE)CreateThread(NULL,(DWORD)stack_size,(LPTHREAD_START_ROUTINE)start_address,(LPVOID)arglist,0,&dwTmp)
#endif

// (HANDLE)crt_beginthreadex(LPSECURITY_ATTRIBUTES security, DWORD stack_size, LPTHREAD_START_ROUTINE start_address, LPVOID arglist, DWORD initflag, LPDWORD thrdaddr );
#if defined(_MSC_VER) || defined(__WATCOMC__)
#define crt_beginthreadex(security,stack_size,start_address,arglist,initflag,thrdaddr ) \
(HANDLE)_beginthreadex((void *)security,(unsigned)stack_size,(MSVC_BEGINTHREAD_START_ADDRESS)start_address,(void *)arglist,(unsigned)initflag,(unsigned *)thrdaddr)
#elif defined(_BORLANDC_)
#define crt_beginthreadex(security,stack_size,start_address,arglist,initflag,thrdaddr ) \
(HANDLE)_beginthreadNT((BCC_BEGINTHREAD_START_ADDRESS)start_address,(unsigned)stack_size,(void *)arglist,(void *)security_attrib,(unsigned long)create_flags,(unsigned long *)thread_id)
#else
#define crt_beginthreadex(security,stack_size,start_address,arglist,initflag,thrdaddr ) \
(HANDLE)CreateThread((LPSECURITY_ATTRIBUTES)security,(DWORD)stack_size,(LPTHREAD_START_ROUTINE)start_address,(LPVOID)arglist,(DWORD)initflag,(LPDWORD)thrdaddr)
#endif

#if defined(_MSC_VER) || defined(__WATCOMC__)
#define crt_endthread() _endthread()
#elif defined(_BORLANDC_)
#define crt_endthread() _endthread()
#else
#define crt_endthread() ExitThread(0);
#endif

#define RANGE(x,min,max) (((x)<(min))?((x)=(min)):(((x)>(max))?((x)=(max)):(x)))

#define RC_EXT_BASE 1000
enum {
    RC_EXT_DROP = RC_EXT_BASE,
    RC_EXT_LOAD_FILE,
    RC_EXT_LOAD_PLAYLIST,
    RC_EXT_SAVE_PLAYLIST,
    RC_EXT_MODE_CHANGE,
    RC_EXT_APPLY_SETTING,
    RC_EXT_DELETE_PLAYLIST,
    RC_EXT_UPDATE_PLAYLIST,
    RC_EXT_UNIQ_PLAYLIST,
    RC_EXT_REFINE_PLAYLIST,
    RC_EXT_JUMP_FILE,
    RC_EXT_ROTATE_PLAYLIST,
    RC_EXT_CLEAR_PLAYLIST,
    RC_EXT_OPEN_DOC,
    RC_EXT_RESTART_GUI,
	RC_EXT_LOAD_FILES_AND_PLAY
};

#define MAX_W32G_MIDI_CHANNELS	32


// Toolbar Macros
#define IDM_STOP		2501
#define IDM_PAUSE		2502
#define IDM_PREV		2503
#define IDM_FOREWARD	2504
#define IDM_PLAY		2505
#define IDM_BACKWARD	2506
#define IDM_NEXT		2507

#define IDM_CONSOLE		2511
#define IDM_LIST		2512
#define IDM_TRACER	 	2513
#define IDM_DOC			2514
#define IDM_WRD			2515
#define IDM_SOUNDSPEC	2516


#define FLAG_NOTE_OFF	1
#define FLAG_NOTE_ON	2

#define FLAG_BANK	0x0001
#define FLAG_PROG	0x0002
#define FLAG_PAN	0x0004
#define FLAG_SUST	0x0008

#define FLAG_NOTE_OFF	1
#define FLAG_NOTE_ON	2

#define FLAG_BANK	0x0001
#define FLAG_PROG	0x0002
#define FLAG_PAN	0x0004
#define FLAG_SUST	0x0008

typedef struct {
	int reset_panel;
	int wait_reset;
	int multi_part;

	char v_flags[MAX_W32G_MIDI_CHANNELS];
	int16 cnote[MAX_W32G_MIDI_CHANNELS];
	int16 cvel[MAX_W32G_MIDI_CHANNELS];
	int16 ctotal[MAX_W32G_MIDI_CHANNELS];
	char c_flags[MAX_W32G_MIDI_CHANNELS];
	Channel channel[MAX_W32G_MIDI_CHANNELS];

	int32 total_time;
	int total_time_h;
	int total_time_m;
	int total_time_s;
	int total_time_ss;
	int32 cur_time;
	int cur_time_h;
	int cur_time_m;
	int cur_time_s;
	int cur_time_ss;
	int cur_voices;
	int voices;
	int upper_voices;
	char filename[MAXPATH + 64];
	char titlename[MAXPATH + 64];
	int filename_setflag;
	int titlename_setflag;
	int32 master_volume;
	int32 master_volume_max;
	int meas;
	int beat;
	char keysig[7];
	int key_offset;
	int tempo;
	int tempo_ratio;
	int invalid_flag;

	int32 xnote[MAX_W32G_MIDI_CHANNELS][4];
	int aq_ratio;

	int changed;
	char dummy[1024];

	int8 GSLCD[16][16];
	double gslcd_last_display_time;
	int8 gslcd_displayed_flag;
} PanelInfo;
extern PanelInfo *Panel;

#define PANELRESET_TIME			0x0001
#define PANELRESET_CHANNEL		0x0002
#define PANELRESET_MIDIINFO	0x0004
#define PANELRESET_MISC			0x0008
#define PANELRESET_EFFECT		0x0010


#define CANVAS_MODE_GSLCD		0x0001
#define CANVAS_MODE_MAP16		0x0002
#define CANVAS_MODE_MAP32		0x0003
#define CANVAS_MODE_KBD_A		0x0004
#define CANVAS_MODE_KBD_B		0x0005
#define CANVAS_MODE_SLEEP		0x0006

#if 0
#define TMCCC_BLACK	RGB(0x00,0x00,0x00)
#define TMCCC_WHITE	RGB(0xff,0xff,0xff)
#define TMCCC_RED	RGB(0xff,0x00,0x00)

#define TMCCC_FORE	TMCCC_BLACK // Aliased
#define TMCCC_BACK 	RGB(0x00, 0xf0, 0x00)
#define TMCCC_LOW	RGB(0x80, 0xd0, 0x00)
#define TMCCC_MIDDLE	RGB(0xb0, 0xb0, 0x00)
#define TMCCC_HIGH	RGB(0xe0, 0x00, 0x00)

enum {
    TMCC_BLACK, // Aliased FORE
    TMCC_WHITE,
    TMCC_RED,
    TMCC_BACK,
    TMCC_LOW,
    TMCC_MIDDLE,
    TMCC_HIGH,
    TMCC_FORE_HALF,
    TMCC_LOW_HALF,
    TMCC_MIDDLE_HALF,
    TMCC_HIGH_HALF,
    TMCC_FORE_WEAKHALF,
    TMCC_SIZE
};
#define TMCC_FORE TMCC_BLACK // Aliased

typedef struct _TmColors {
    COLORREF color;
    HPEN pen;
    HBRUSH brush;
} TmColors;
#endif

/* w32g_i.c */
extern int w32g_open(void);
extern void w32g_close(void);
extern void w32g_send_rc(int rc, int32 value);
extern int w32g_get_rc(int32 *value, int wait_if_empty);
extern void w32g_lock(void);
extern void w32g_unlock(void);
extern void MainWndScrollbarProgressUpdate(int sec);
extern void PutsConsoleWnd(char *str);
extern void w32g_ctle_play_start(int sec);
extern void SettingWndApply(void);
extern int w32g_lock_open_file;
extern void w32g_i_init();
extern void CanvasChange(int mode);
extern HINSTANCE hInst;
extern void w32g_show_console();
extern void MPanelStartLoad(char *filename);


/* w32g_utl.c */

/* w32g_playlist.c */
extern int w32g_add_playlist(int nfiles, char **files, int expand_flag,
			     int autouniq, int autorefine);
extern char *w32g_get_playlist(int idx);
extern int w32g_next_playlist(int skip_invalid_file);
extern int w32g_prev_playlist(int skip_invalid_file);
extern int w32g_random_playlist(int skip_invalid_file);
extern int w32g_shuffle_playlist_reset(int preserve);
extern int w32g_shuffle_playlist_next(int skip_invalid_file);
extern void w32g_first_playlist(int skip_invalid_file);
extern int w32g_isempty_playlist(void);
extern char *w32g_curr_playlist(void);
extern void w32g_update_playlist(void);
extern void w32g_get_playlist_index(int *selected, int *nfiles, int *cursel);
extern int w32g_goto_playlist(int num, int skip_invalid_file);
extern int w32g_delete_playlist(int pos);
extern int w32g_nvalid_playlist(void);
extern int w32g_ismidi_playlist(int n);
extern void w32g_setcur_playlist(void);
extern int w32g_refine_playlist(int *is_selected_removed);
extern int w32g_uniq_playlist(int *is_selected_removed);
extern void w32g_clear_playlist(void);
extern void w32g_rotate_playlist(int dest);

#if 0
/* w32g_panel.c */
extern void w32g_init_panel(HWND hwnd);
extern void TmPanelStartToLoad(char *filename);
extern void TmPanelStartToPlay(int total_sec);
extern void TmPanelSetVoices(int v);
//extern void TmPanelInit(HWND hwnd);
extern void TmPanelRefresh(void);
extern void TmPanelSetTime(int sec);
extern void TmPanelSetMasterVol(int v);
extern void TmPanelUpdateList(void);

/* w32g_canvas.c */
extern void w32g_init_canvas(HWND hwnd);
extern void TmCanvasRefresh(void);
extern void TmCanvasReset(void);
extern void TmCanvasNote(int status, int ch, int note, int vel);
extern int TmCanvasChange(void);
extern void TmCanvasUpdateInterval();
extern int TmCanvasMode;
#endif

/* w32g_c.c */
extern volatile int w32g_play_active;
extern int w32g_current_volume[/* MAX_CHANNELS */];
extern int w32g_current_expression[/* MAX_CHANNELS */];
extern volatile int w32g_restart_gui_flag;


void PrefSettingApplyReally(void);



// flags
extern int InitMinimizeFlag;
extern int DebugWndStartFlag;
extern int ConsoleWndStartFlag;
extern int ListWndStartFlag;
extern int TracerWndStartFlag;
extern int DocWndStartFlag;
extern int WrdWndStartFlag;
extern int DebugWndFlag;
extern int ConsoleWndFlag;
extern int ListWndFlag;
extern int TracerWndFlag;
extern int DocWndFlag;
extern int WrdWndFlag;
extern int SoundSpecWndFlag;

extern int SubWindowMax;

extern char *IniFile;
extern char *ConfigFile;
extern char *PlaylistFile;
extern char *PlaylistHistoryFile;
extern char *MidiFileOpenDir;
extern char *ConfigFileOpenDir;
extern char *PlaylistFileOpenDir;

extern int PlayerThreadPriority;
extern int GUIThreadPriority;

extern int WrdGraphicFlag;
extern int TraceGraphicFlag;
extern int DocMaxSize;
extern char *DocFileExt;

extern int w32g_has_ini_file;
extern char *w32g_output_dir;
extern int w32g_auto_output_mode;

// HWND
extern HWND hMainWnd;
extern HWND hDebugWnd;
extern HWND hConsoleWnd;
extern HWND hTracerWnd;
extern HWND hDocWnd;
extern HWND hListWnd;
extern HWND hWrdWnd;
extern HWND hSoundSpecWnd;
extern HWND hDebugEditWnd;
extern HWND hDocEditWnd;

// gdi_lock
extern int gdi_lock(void);
extern int gdi_unlock(void);
#define GDI_SAFETY(command) (gdi_lock(),(command),gdi_unlock);

#define W32G_RANDOM_IS_SHUFFLE

#ifndef BELOW_NORMAL_PRIORITY_CLASS	/* VC6.0 doesn't support them. */
#define BELOW_NORMAL_PRIORITY_CLASS 0x4000
#define ABOVE_NORMAL_PRIORITY_CLASS 0x8000
#endif /* BELOW_NORMAL_PRIORITY_CLASS */

#endif