Пример #1
0
void CEffectDlg::EqualizerOnScroll(HWND hwndDlg)
{
	EQUALIZER eq;
	MAP_GetEqualizer(m_hMap, &eq);
	eq.preamp = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_PREAMP), TBM_GETPOS, 0, 0);
	eq.data[0] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ1), TBM_GETPOS, 0, 0);
	eq.data[1] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ2), TBM_GETPOS, 0, 0);
	eq.data[2] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ3), TBM_GETPOS, 0, 0);
	eq.data[3] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ4), TBM_GETPOS, 0, 0);
	eq.data[4] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ5), TBM_GETPOS, 0, 0);
	eq.data[5] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ6), TBM_GETPOS, 0, 0);
	eq.data[6] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ7), TBM_GETPOS, 0, 0);
	eq.data[7] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ8), TBM_GETPOS, 0, 0);
	eq.data[8] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ9), TBM_GETPOS, 0, 0);
	eq.data[9] = SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_EQ10), TBM_GETPOS, 0, 0);
	MAP_SetEqualizer(m_hMap, &eq);

	int nLevel = 20 - SendMessage(GetDlgItem(hwndDlg, IDC_SLIDER_BASSBOOST), TBM_GETPOS, 0, 0);
	MAP_SetBassBoostLevel(m_hMap, nLevel);
}
Пример #2
0
void CEffectDlg::LoadPresetFile(LPTSTR pszFile)
{
#ifdef _UNICODE
	char sz[MAX_PATH * 2];
	WideCharToMultiByte(CP_ACP, NULL, pszFile, -1, sz, MAX_PATH * 2, NULL, NULL);
	FILE* fp = fopen(sz, "r");
#else
	FILE* fp = fopen(pszFile, "r");
#endif
	if (!fp)
		return;

	int i;
	EFFECT effect;
	EQUALIZER eq;
	TCHAR szBuf[MAX_PATH];

	if (!GetKeyString(fp, SECTION_GSPLAYERW, KEY_EFFECT_VERSIONW, szBuf))
		goto done;

	if (_tcstol(szBuf, NULL, 10) != VALUE_VERSION)
		goto done;

	MAP_GetEqualizer(m_hMap, &eq);
	if (GetKeyString(fp, SECTION_EQUALIZERW, KEY_ENABLEW, szBuf))
		eq.fEnable = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_EQUALIZERW, KEY_PREAMPW, szBuf))
		eq.preamp = _tcstol(szBuf, NULL, 10);
	for (i = 0; i < 10; i++) {
		TCHAR szKey[64];
		wsprintf(szKey, _T("%d"), i);
		if (GetKeyString(fp, SECTION_EQUALIZERW, szKey, szBuf))
			eq.data[i] = _tcstol(szBuf, NULL, 10);
	}
	MAP_SetEqualizer(m_hMap, &eq);
	
	MAP_GetEffect(m_hMap, EFFECT_SURROUND, &effect);
	if (GetKeyString(fp, SECTION_SURROUNDW, KEY_ENABLEW, szBuf))
		effect.fEnable = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_SURROUNDW, KEY_RATEW, szBuf))
		effect.nRate = _tcstol(szBuf, NULL, 10);
	MAP_SetEffect(m_hMap, EFFECT_SURROUND, &effect);

	MAP_GetEffect(m_hMap, EFFECT_3DCHORUS, &effect);
	if (GetKeyString(fp, SECTION_3DCHORUSW, KEY_ENABLEW, szBuf))
		effect.fEnable = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_3DCHORUSW, KEY_RATEW, szBuf))
		effect.nRate = _tcstol(szBuf, NULL, 10);
	MAP_SetEffect(m_hMap, EFFECT_3DCHORUS, &effect);

	MAP_GetEffect(m_hMap, EFFECT_REVERB, &effect);
	if (GetKeyString(fp, SECTION_REVERBW, KEY_ENABLEW, szBuf))
		effect.fEnable = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_REVERBW, KEY_DELAYW, szBuf))
		effect.nDelay = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_REVERBW, KEY_RATEW, szBuf))
		effect.nRate = _tcstol(szBuf, NULL, 10);
	MAP_SetEffect(m_hMap, EFFECT_REVERB, &effect);

	MAP_GetEffect(m_hMap, EFFECT_ECHO, &effect);
	if (GetKeyString(fp, SECTION_ECHOW, KEY_ENABLEW, szBuf))
		effect.fEnable = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_ECHOW, KEY_DELAYW, szBuf))
		effect.nDelay = _tcstol(szBuf, NULL, 10);
	if (GetKeyString(fp, SECTION_ECHOW, KEY_RATEW, szBuf))
		effect.nRate = _tcstol(szBuf, NULL, 10);
	MAP_SetEffect(m_hMap, EFFECT_ECHO, &effect);
	
	i = MAP_GetBassBoostLevel(m_hMap);
	if (GetKeyString(fp, SECTION_BASSBOOSTW, KEY_RATEW, szBuf))
		i = _tcstol(szBuf, NULL, 10);
	MAP_SetBassBoostLevel(m_hMap, i);
done:
	fclose(fp);
}