⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 w32g_pref.c

📁 linux上播放midi音乐,但是要一些设置.可网上查找. 软件名称: TiMidity++-2.13.0.tar
💻 C
📖 第 1 页 / 共 5 页
字号:
/*	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	w32g_pref.c: Written by Daisuke Aoki <dai@y7.net>*/#ifdef HAVE_CONFIG_H#include "config.h"#endif /* HAVE_CONFIG_H */#include "interface.h"#include <stdio.h>#include <stdlib.h>#include <process.h>#include <stddef.h>#include <windows.h>#undef RC_NONE#include <commctrl.h>#ifndef NO_STRING_H#include <string.h>#else#include <strings.h>#endif#include "timidity.h"#include "common.h"#include "instrum.h"#include "playmidi.h"#include "readmidi.h"#include "output.h"#include "controls.h"#include "tables.h"#include "miditrace.h"#include "reverb.h"#ifdef SUPPORT_SOUNDSPEC#include "soundspec.h"#endif /* SUPPORT_SOUNDSPEC */#include "recache.h"#include "arc.h"#include "strtab.h"#include "wrd.h"#include "mid.defs"#include "w32g.h"#include "w32g_res.h"#include "w32g_utl.h"#include "w32g_pref.h"#ifdef AU_GOGO/* #include <musenc.h>		/* for gogo */#include <gogo/gogo.h>		/* for gogo */#include "gogo_a.h"#endif/* TiMidity Win32GUI preference / PropertySheet */#ifndef IA_W32G_SYNextern void w32g_restart(void);#endifextern void set_gogo_opts_use_commandline_options(char *commandline);extern void restore_voices(int save_voices);extern void TracerWndApplyQuietChannel( ChannelBitMask quietchannels_ );volatile int PrefWndDoing = 0;static void PrefSettingApply(void);static volatile int PrefWndSetOK = 0;static HWND hPrefWnd = NULL;static BOOL APIENTRY CALLBACK PrefWndDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);static BOOL APIENTRY PrefPlayerDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);static BOOL APIENTRY PrefTiMidity1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);static BOOL APIENTRY PrefTiMidity2DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);static BOOL APIENTRY PrefTiMidity3DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);static BOOL APIENTRY PrefTiMidity4DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);#ifdef IA_W32G_SYNstatic BOOL APIENTRY PrefSyn1DialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam);#endifstatic int DlgOpenConfigFile(char *Filename, HWND hwnd);static int DlgOpenOutputFile(char *Filename, HWND hwnd);static int vorbisCofigDialog(void);static int gogoCofigDialog(void);//#if defined(__CYGWIN32__) || defined(__MINGW32__)#if 0 /* New version of mingw *///#define pszTemplate	u1.pszTemplate//#define pszIcon		u2.pszIcon#ifndef NONAMELESSUNION#define NONAMELESSUNION#endif#ifndef DUMMYUNIONNAME#define DUMMYUNIONNAME	u1#endif#ifndef DUMMYUNIONNAME2#define DUMMYUNIONNAME2	u2#endif#ifndef DUMMYUNIONNAME3#define DUMMYUNIONNAME3	u3#endif#endif#ifdef IA_W32G_SYN static char **GetMidiINDrivers ( void );#endif#define WM_MYSAVE (WM_USER + 100)#define WM_MYRESTORE (WM_USER + 101)typedef struct pref_page_t_ {	int index;	char *title;	HWND hwnd;	UINT control;	DLGPROC dlgproc;	int opt;} pref_page_t;static pref_page_t pref_pages_ja[] = {	{ 0, "僾儗僀儎", (HWND)NULL, IDD_PREF_PLAYER, (DLGPROC) PrefPlayerDialogProc, 0 },	{ 1, "僄僼僃僋僩", (HWND)NULL, IDD_PREF_TIMIDITY1, (DLGPROC) PrefTiMidity1DialogProc, 0 },	{ 2, "偦偺懠", (HWND)NULL, IDD_PREF_TIMIDITY2, (DLGPROC) PrefTiMidity2DialogProc, 0 },	{ 3, "弌椡", (HWND)NULL, IDD_PREF_TIMIDITY3, (DLGPROC) PrefTiMidity3DialogProc, 0 },	{ 4, "僠儍儞僱儖", (HWND)NULL, IDD_PREF_TIMIDITY4, (DLGPROC) PrefTiMidity4DialogProc, 0 },#ifdef IA_W32G_SYN	{ 5, "僔儞僙僒僀僓", (HWND)NULL, IDD_PREF_SYN1, (DLGPROC) PrefSyn1DialogProc, 0 },#endif};static pref_page_t pref_pages_en[] = {	{ 0, "Player", (HWND)NULL, IDD_PREF_PLAYER_EN, (DLGPROC) PrefPlayerDialogProc, 0 },	{ 1, "Effect", (HWND)NULL, IDD_PREF_TIMIDITY1_EN, (DLGPROC) PrefTiMidity1DialogProc, 0 },	{ 2, "Misc", (HWND)NULL, IDD_PREF_TIMIDITY2_EN, (DLGPROC) PrefTiMidity2DialogProc, 0 },	{ 3, "Output", (HWND)NULL, IDD_PREF_TIMIDITY3_EN, (DLGPROC) PrefTiMidity3DialogProc, 0 },	{ 4, "Channle", (HWND)NULL, IDD_PREF_TIMIDITY4_EN, (DLGPROC) PrefTiMidity4DialogProc, 0 },#ifdef IA_W32G_SYN	{ 5, "Synthesizer", (HWND)NULL, IDD_PREF_SYN1_EN, (DLGPROC) PrefSyn1DialogProc, 0 },#endif};#ifndef IA_W32G_SYN#define PREF_PAGE_MAX 5#else#define PREF_PAGE_MAX 6#endifstatic pref_page_t *pref_pages;static void PrefWndCreatePage ( HWND hwnd ){	int i;	RECT rc;	HWND hwnd_tab;#ifdef IA_W32G_SYN	GetMidiINDrivers ();#endif	switch(PlayerLanguage) {		case LANGUAGE_JAPANESE:			pref_pages = pref_pages_ja;			break;		default:		case LANGUAGE_ENGLISH:			pref_pages = pref_pages_en;			break;	}	hwnd_tab = GetDlgItem ( hwnd, IDC_TAB_MAIN );	for ( i = 0; i < PREF_PAGE_MAX; i++ ) {		TC_ITEM tci;    tci.mask = TCIF_TEXT;    tci.pszText = pref_pages[i].title;		tci.cchTextMax = strlen ( pref_pages[i].title );		SendMessage ( hwnd_tab, TCM_INSERTITEM, (WPARAM)i, (LPARAM)&tci );	}	GetClientRect ( hwnd_tab, &rc );	SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_ADJUSTRECT, (WPARAM)0, (LPARAM)&rc );	for ( i = 0; i < PREF_PAGE_MAX; i++ ) {		pref_pages[i].hwnd = CreateDialog ( hInst, MAKEINTRESOURCE(pref_pages[i].control),			hwnd, pref_pages[i].dlgproc );    ShowWindow ( pref_pages[i].hwnd, SW_HIDE );		MoveWindow ( pref_pages[i].hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE );	}}void PrefWndCreate(HWND hwnd){	VOLATILE_TOUCH(PrefWndDoing);	if(PrefWndDoing)		return;	PrefWndDoing = 1;	PrefWndSetOK = 1;	switch(PlayerLanguage) {		case LANGUAGE_JAPANESE:			DialogBox ( hInst, MAKEINTRESOURCE(IDD_DIALOG_PREF), hwnd, PrefWndDialogProc );			break;		default:		case LANGUAGE_ENGLISH:			DialogBox ( hInst, MAKEINTRESOURCE(IDD_DIALOG_PREF_EN), hwnd, PrefWndDialogProc );			break;	}	hPrefWnd = NULL;	PrefWndSetOK = 0;	PrefWndDoing = 0;	return;}static BOOL APIENTRY CALLBACK PrefWndDialogProc(HWND hwnd, UINT uMess, WPARAM wParam, LPARAM lParam){	int i;	switch (uMess){	case WM_INITDIALOG:	{		hPrefWnd = hwnd;		PrefWndCreatePage ( hwnd );		SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_SETCURSEL, (WPARAM)0, (LPARAM)0 );		ShowWindow ( pref_pages[0].hwnd, TRUE );		return TRUE;	}	case WM_COMMAND:		switch (LOWORD(wParam)) {		case IDOK:			for ( i = 0; i < PREF_PAGE_MAX; i++ ) {				SendMessage ( pref_pages[i].hwnd, WM_MYSAVE, (WPARAM)0, (LPARAM)0 );			}			PrefSettingApply();			SetWindowLong(hwnd,	DWL_MSGRESULT, TRUE);			EndDialog ( hwnd, TRUE );			return TRUE;		case IDCANCEL:			SetWindowLong(hwnd,	DWL_MSGRESULT, FALSE);			EndDialog ( hwnd, FALSE );			return TRUE;		case IDC_BUTTON_APPLY:			for ( i = 0; i < PREF_PAGE_MAX; i++ ) {				SendMessage ( pref_pages[i].hwnd, WM_MYSAVE, (WPARAM)0, (LPARAM)0 );			}			PrefSettingApply();#ifndef IA_W32G_SYN			TracerWndApplyQuietChannel(st_temp->quietchannels);#endif			SetWindowLong(hwnd,	DWL_MSGRESULT, TRUE);			return TRUE;		}		break;	case WM_NOTIFY:	{		int idCtrl = (int) wParam;     LPNMHDR pnmh = (LPNMHDR) lParam; 		if ( pnmh->idFrom == IDC_TAB_MAIN ) {			switch ( pnmh->code ) {			case TCN_SELCHANGE:			{				int nIndex = SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_GETCURSEL, (WPARAM)0, (LPARAM)0);				for ( i = 0; i < PREF_PAGE_MAX; i++ ) {					if ( nIndex == i ) {						ShowWindow ( pref_pages[i].hwnd, TRUE );					} else {						ShowWindow ( pref_pages[i].hwnd, FALSE );					}				}			}				return TRUE;			}		}		break;	}	case WM_SIZE:	{		RECT rc;		HWND hwnd_tab = GetDlgItem ( hwnd, IDC_TAB_MAIN );		GetClientRect ( hwnd_tab, &rc );		SendDlgItemMessage ( hwnd, IDC_TAB_MAIN, TCM_ADJUSTRECT, (WPARAM)TRUE, (LPARAM)&rc );		for ( i = 0; i < PREF_PAGE_MAX; i++ ) {			MoveWindow ( pref_pages[i].hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, TRUE );		}		return TRUE;	}	case WM_CLOSE:		break;	default:	  break;	}	return FALSE;}//			SetWindowLong(hwnd,	DWL_MSGRESULT, FALSE);#define DLG_CHECKBUTTON_TO_FLAG(hwnd,ctlid,x)	\	((SendDlgItemMessage((hwnd),(ctlid),BM_GETCHECK,0,0))?((x)=1):((x)=0))#define DLG_FLAG_TO_CHECKBUTTON(hwnd,ctlid,x)	\	((x)?(SendDlgItemMessage((hwnd),(ctlid),BM_SETCHECK,1,0)):\	(SendDlgItemMessage((hwnd),(ctlid),BM_SETCHECK,0,0)))extern void TracerWndApplyQuietChannel( ChannelBitMask quietchannels_ );#ifndef IA_W32G_SYN/* st_temp, sp_temp 傪揔梡偡傞 * 拲堄: MainThread 偐傜偺屇傃弌偟嬛巭丄婋尟両 */void PrefSettingApplyReally(void){	int restart;	extern int IniFileAutoSave;	free_instruments(1);	if(play_mode->fd != -1)		play_mode->close_output();	restart = (PlayerLanguage != sp_temp->PlayerLanguage);//	restart |= (strcmp(sp_temp->ConfigFile,ConfigFile) != 0);	if(sp_temp->PlayerLanguage == LANGUAGE_JAPANESE)		strcpy(st_temp->output_text_code, "SJIS");	else		strcpy(st_temp->output_text_code, "ASCII");	ApplySettingPlayer(sp_temp);	ApplySettingTiMidity(st_temp);	SaveSettingPlayer(sp_current);	SaveSettingTiMidity(st_current);	memcpy(sp_temp, sp_current, sizeof(SETTING_PLAYER));	memcpy(st_temp, st_current, sizeof(SETTING_TIMIDITY));	restore_voices(1);	PrefWndSetOK = 0;	if(IniFileAutoSave)		SaveIniFile(sp_current, st_current);	if(restart &&	   MessageBox(hListWnd,"Restart TiMidity?", "TiMidity",				  MB_YESNO)==IDYES)	{		w32g_restart();//		PrefWndDoing = 0;	}}#endif#ifdef IA_W32G_SYNextern int w32g_syn_do_before_pref_apply ( void );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -