10 #include "w32g_pref.h"
13 //
\83G
\83\89\81[
\89ñ
\94ð
\97p (w32g_c.c, w32g_i.c, w32g_ut2.c
\93\99\82Ì
\91ã
\91Ö
14 int PlayerLanguage = LANGUAGE_JAPANESE; //LANGUAGE_ENGLISH;
15 int IniFileAutoSave = 1;
19 char *PlaylistHistoryFile;
20 char *MidiFileOpenDir;
21 char *ConfigFileOpenDir;
22 char *PlaylistFileOpenDir;
24 BOOL PosSizeSave = TRUE;
27 int AutoloadPlaylist = 0;
28 int AutosavePlaylist = 0;
29 int SeachDirRecursive = 0;
30 int DocWndIndependent = 0;
31 int DocWndAutoPopup = 0;
33 int PlayerThreadPriority;
34 int MidiPlayerThreadPriority;
35 int MainThreadPriority;
36 int GUIThreadPriority;
37 int TracerThreadPriority;
38 int WrdThreadPriority;
40 int InitMinimizeFlag = 0;
41 int main_panel_update_time = 10;
42 int DebugWndStartFlag = 1;
43 int ConsoleWndStartFlag = 0;
44 int ListWndStartFlag = 0;
45 int TracerWndStartFlag = 0;
46 int DocWndStartFlag = 0;
47 int WrdWndStartFlag = 0;
48 int SoundSpecWndStartFlag = 0;
50 int ConsoleWndFlag = 1;
52 int TracerWndFlag = 0;
55 int SoundSpecWndFlag = 0;
58 char *w32g_output_dir = NULL;
59 int w32g_auto_output_mode = 0;
60 int w32g_lock_open_file = 0;
61 WRDTracer w32g_wrdt_mode;
63 int playlist_max_ini = 1;
64 int ConsoleClearFlag = 0;
73 HWND hSoundSpecWnd = 0;
74 HWND hDebugEditWnd = 0;
80 HANDLE hMainThread = 0;
81 HANDLE hPlayerThread = 0;
82 HANDLE hMainThreadInfo = 0;
83 DWORD dwMainThreadID = 0;
88 void TracerWndApplyQuietChannel(ChannelBitMask quietchannels_){}
89 void w32g_restart(void){}
90 void w32g_send_rc(int rc, ptr_size_t value){}
91 void w32g_i_init(void){}
92 void w32g_ext_control_main_thread(int rc, ptr_size_t value){}
95 static int ctl_open(int using_stdin, int using_stdout){}
96 static void ctl_close(void){}
97 static int ctl_pass_playing_list(int number_of_files, char *list_of_files[]){}
98 static void ctl_event(CtlEvent *e){}
99 static int ctl_read(ptr_size_t *valp){}
100 static int cmsg(int type, int verbosity_level, char *fmt, ...){}
101 #define ctl w32gui_control_mode
102 #define CTL_STATUS_UPDATE -98
105 "Win32 GUI interface", 'w',
108 CTLF_AUTOSTART | CTLF_DRAG_START,
111 ctl_pass_playing_list,
119 //
\82±
\82±
\82©
\82çsetup
\82Ì
\83\81\83C
\83\93\95\94\95ª
121 char IniPath[FILEPATH_MAX] = "";
124 // w32_utl.c
\82Å
\8eg
\97p
125 void get_ini_path(char *ini)
128 strcpy(ini, (const char *)&IniPath);
132 // timidity_start_initialize()
133 void config_gui_start_initialize(void)
136 static int drums[] = DEFAULT_DRUMCHANNELS;
137 static int is_first = 1;
139 #if defined(__FreeBSD__) && !defined(__alpha__)
141 #elif defined(__NetBSD__) || defined(__OpenBSD__)
144 #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
146 fpsetmask(fpexp & ~(FP_X_INV|FP_X_DZ));
148 if(!output_text_code)
149 output_text_code = safe_strdup(OUTPUT_TEXT_CODE);
151 opt_aq_max_buff = safe_strdup("5.0");
152 if(!opt_aq_fill_buff)
153 opt_aq_fill_buff = safe_strdup("100%");
154 if(!opt_reduce_voice_threshold)
155 opt_reduce_voice_threshold = safe_strdup("75%");
156 if(!opt_reduce_quality_threshold)
157 opt_reduce_quality_threshold = safe_strdup("99%");
158 if(!opt_reduce_polyphony_threshold)
159 opt_reduce_polyphony_threshold = safe_strdup("85%");
161 /* Check the byte order */
169 fprintf(stderr, "Byte order is miss configured.\n");
172 for(i = 0; i < MAX_CHANNELS; i++)
173 memset(&(channel[i]), 0, sizeof(Channel));
174 CLEAR_CHANNELMASK(quietchannels);
175 CLEAR_CHANNELMASK(default_drumchannels);
176 for(i = 0; drums[i] > 0; i++)
177 SET_CHANNELMASK(default_drumchannels, drums[i] - 1);
178 #if MAX_CHANNELS > 16
179 for(i = 16; i < MAX_CHANNELS; i++)
180 if(IS_SET_CHANNELMASK(default_drumchannels, i & 0xF))
181 SET_CHANNELMASK(default_drumchannels, i);
183 if(program_name == NULL)
184 program_name = "TiMidity";
185 uudecode_unquote_html = 1;
186 for(i = 0; i < MAX_CHANNELS; i++){
187 default_program[i] = DEFAULT_PROGRAM;
188 special_program[i] = -1;
189 memset(channel[i].drums, 0, sizeof(channel[i].drums));
191 if(play_mode == NULL)
192 play_mode = &null_play_mode;
197 void config_gui_main(void)
199 #if defined(TIMIDITY_LEAK_CHECK)
200 _CrtSetDbgFlag(CRTDEBUGFLAGS);
202 OverrideSFSettingLoad();
203 #if defined(VST_LOADER_ENABLE)
204 if (hVSTHost == NULL) {
205 // ini(=kpi)
\82Ì
\83f
\83B
\83\8c\83N
\83g
\83\8a\82É
\82 \82é timvstwrap.dll
207 char WrapPath[FILEPATH_MAX] = "";
208 for(i = 0; i < FILEPATH_MAX; i++){
209 if(IniPath[i] == '\0')
211 else if(IniPath[i] == '\\')
216 for(i = 0; i < last; i++){
217 WrapPath[j++] = IniPath[i];
221 strcat(WrapPath, "\\timvstwrap_x64.dll\0");
223 strcat(WrapPath, "\\timvstwrap.dll\0");
227 hVSTHost = LoadLibrary(WrapPath);
228 if (hVSTHost == NULL){
230 hVSTHost = LoadLibrary("timvstwrap_x64.dll");
232 hVSTHost = LoadLibrary("timvstwrap.dll");
236 if (hVSTHost != NULL) {
237 ((vst_open)GetProcAddress(hVSTHost, "vstOpen"))();
241 #if defined(__W32__) && !defined(WINDRV)
242 (void)w32_reset_dll_directory();
244 // timidity_start_initialize()
245 config_gui_start_initialize();
249 void config_gui_main_close(void)
252 #ifdef SUPPORT_SOCKET
253 safe_free(url_user_agent);
254 url_user_agent = NULL;
255 safe_free(url_http_proxy_host);
256 url_http_proxy_host = NULL;
257 safe_free(url_ftp_proxy_host);
258 url_ftp_proxy_host = NULL;
259 safe_free(user_mailaddr);
260 user_mailaddr = NULL;
263 safe_free(dynamic_lib_root);
264 dynamic_lib_root = NULL;
266 safe_free(pcm_alternate_file);
267 pcm_alternate_file = NULL;
268 safe_free(opt_output_name);
269 opt_output_name = NULL;
270 safe_free(opt_aq_max_buff);
271 opt_aq_max_buff = NULL;
272 safe_free(opt_aq_fill_buff);
273 opt_aq_fill_buff = NULL;
274 safe_free(opt_reduce_voice_threshold);
275 opt_reduce_voice_threshold = NULL;
276 safe_free(opt_reduce_quality_threshold);
277 opt_reduce_quality_threshold = NULL;
278 safe_free(opt_reduce_polyphony_threshold);
279 opt_reduce_polyphony_threshold = NULL;
280 safe_free(output_text_code);
281 output_text_code = NULL;
282 safe_free(wrdt_open_opts);
283 wrdt_open_opts = NULL;
294 free_global_mblock();
296 //free_reverb_buffer();
297 free_effect_buffers();
302 uninitialize_resampler_coeffs();
303 for (i = 0; i < MAX_CHANNELS; i++)
305 #ifdef VST_LOADER_ENABLE
306 if (hVSTHost != NULL) {
307 // only load , no save
308 ((vst_close)GetProcAddress(hVSTHost,"vstClose"))();
309 FreeLibrary(hVSTHost);
318 HINSTANCE hInst = NULL;
319 HWND hConfigWnd = NULL;
321 void set_config_hwnd(HWND hwnd)
328 BOOL InitInstance(HINSTANCE hInstance, int nCmdShow)
333 hIcon = (HICON *)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TIMIDITY), IMAGE_ICON, 16, 16, 0);
334 if ( hConfigWnd != NULL ) {
335 DestroyWindow ( hConfigWnd );
339 PrefWndCreate(NULL, 0); // set hConfigWnd
341 SendMessage(hConfigWnd, WM_SETICON,FALSE, (LPARAM)hIcon);
342 { // Set the title of the main window again.
344 SendMessage( hConfigWnd, WM_GETTEXT, (WPARAM)255, (LPARAM)buffer);
345 SendMessage( hConfigWnd, WM_SETTEXT, (WPARAM)0, (LPARAM)buffer);
349 ShowWindow(hConfigWnd, nCmdShow);
350 UpdateWindow(hConfigWnd);
354 int APIENTRY _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, int nCmdShow)
356 static int init_flg = 0;
363 if(lpCmdLine[0] == 0){
364 //
\8bó
\82Ì
\8fê
\8d\87 kbtimsetup.exe
\82Ì
\83f
\83B
\83\8c\83N
\83g
\83\8a\82É
\82 \82é kbtim.ini
365 char buffer[FILEPATH_MAX] = {0};
367 HMODULE hInst = GetModuleHandle(0);
368 if(GetModuleFileName(hInst, buffer, FILEPATH_MAX - 1)){
369 if((p = pathsep_strrchr(buffer)) != NULL){
374 buffer[1] = PATH_SEP;
379 buffer[1] = PATH_SEP;
382 strncpy(IniPath, buffer, FILEPATH_MAX);
383 IniPath[FILEPATH_MAX - 1] = '\0';
384 strcat(IniPath,"kbtim.ini");
386 // ini
\8eæ
\93¾
\83v
\83\89\83O
\83C
\83\93\82Æ
\83t
\83@
\83C
\83\8b\96¼
\82ª
\93¯
\82¶
\82Å
\8ag
\92£
\8eq
\82ª INI
388 for(i = 0; i < FILEPATH_MAX; i++){
389 if(lpCmdLine[i] == '\0')
391 else if(lpCmdLine[i] == '.')
396 for(i = 0; i < last; i++){
397 if(lpCmdLine[i] != '"')
398 IniPath[j++] = lpCmdLine[i];
401 strcat(IniPath, ".ini\0");
404 if (!InitInstance (hInstance, nCmdShow)) // Create Window
407 hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_CONFIG_GUI));
408 while (GetMessage(&msg, NULL, 0, 0)){ // message loop
409 if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)){
410 TranslateMessage(&msg);
411 DispatchMessage(&msg);
415 while( GetMessage(&msg,NULL,0,0) ){ // message loop
416 TranslateMessage(&msg);
417 DispatchMessage(&msg);
420 return (int) msg.wParam;