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

📄 main.c

📁 the mpeg2/4 aac decoder
💻 C
📖 第 1 页 / 共 2 页
字号:
			SetRect(&bar1, 0, height - 23, (int)(file_complete * width), height - 13);			SetRect(&bar2, 0, height - 12, (int)(percomp * width), height - 2);			FillRect(offscreen, &bar1, (HBRUSH)GetStockObject(LTGRAY_BRUSH));			FillRect(offscreen, &bar2, (HBRUSH)GetStockObject(DKGRAY_BRUSH));			if (fileName)			{				char* sep;				char  fileCaption[80];				if ((sep = strrchr(fileName, '\\')) != 0)					fileName = sep+1;				(void) strcpy(fileCaption, "   ");				(void) strcat(fileCaption, fileName);				DrawText(offscreen, fileCaption, -1, &bar1, DT_SINGLELINE | DT_LEFT);			}			SelectObject(offscreen, dfltFont);			SetBkMode(offscreen, dfltBGMode);			BitBlt(hdc, 0, 0, width, height, offscreen, 0, 0, SRCCOPY);			EndPaint(hwnd, &ps);			return DefWindowProc(hwnd, message, wParam, lParam);			//return 0;		case WM_TIMER:			if (animate || frame)			{				frame++;				if (frame > 7) 					frame -= 8;			}			else			{				frame = 0;			}			GetClientRect(hwnd, &rect);			InvalidateRect(hwnd, &rect, FALSE);			return 0;		case WM_LBUTTONDOWN:			start.x = LOWORD(lParam);			start.y = HIWORD(lParam);			ClientToScreen(hwnd, &start);			GetWindowRect(hwnd, &rect);			start.x -= rect.left;			start.y -= rect.top;			dragging = 1;			SetCapture(hwnd);			return 0;		case WM_LBUTTONUP:			if (dragging)			{				dragging = 0;				ReleaseCapture();			}			return 0;		case WM_MOUSEMOVE:			if (dragging)			{				point.x = LOSHORT(lParam);				point.y = HISHORT(lParam);				/* lParam can contain negative coordinates !				 * point.x = LOWORD(lParam);				 * point.y = HIWORD(lParam);				 */				ClientToScreen(hwnd, &point);				SetWindowPos(hwnd, 0, point.x - start.x, point.y - start.y, 0, 0, SWP_NOSIZE | SWP_NOZORDER | SWP_SHOWWINDOW);				iniSettings.window_x = point.x - start.x;				iniSettings.window_y = point.y - start.y;			}			return 0;		case WM_CAPTURECHANGED:			if (dragging)			{				dragging = 0;				ReleaseCapture();			}			return 0;		case WM_RBUTTONUP:			point.x = LOWORD(lParam);			point.y = HIWORD(lParam);			ClientToScreen(hwnd, &point);			TrackPopupMenu(menu, TPM_RIGHTBUTTON, point.x, point.y, 0, hwnd, NULL);			return 0;		case WM_COMMAND:			switch (LOWORD(wParam)) 			{				case IDM_QUIT:					WriteIniFile(INI_FILE);					decoding_done = 1;					PostQuitMessage(0);					break;				case IDM_ONTOP:					set_always_on_top(hwnd, ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED);					break;					case IDM_LOGERR:					set_logerr(hwnd, ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED);					break;				case IDM_STOP_DEC:				{					int v = ~GetMenuState(menu, LOWORD(wParam), MF_BYCOMMAND) & MF_CHECKED;					if(v == 8)						stop_decoding = 1;					break;				}				case IDM_VOLUME:				{					int value = 					DialogBox(					hinst,  					MAKEINTRESOURCE(IDD_VOLUME),   					hwnd, QCProc);					if (value == -2)						break;					break;				}				case IDM_ABOUT:				{					int value = DialogBox(hinst, MAKEINTRESOURCE(IDD_ABOUT), hwnd, QCProc);					if (value == -7)						break;					break;				}			} // LOWORD(wParam)			return 0;		case WM_DROPFILES:			hdrop = (HANDLE)wParam;			HandleDrag(hwnd, hdrop);			return 0;			case WM_DESTROY:			decoding_done = 1;			PostQuitMessage(0);			return 0;	}	return DefWindowProc(hwnd, message, wParam, lParam);}/* *  Encode parameters dialog procedures. */BOOL CALLBACK QCProc(HWND hwndDlg, UINT message,                      WPARAM wParam, LPARAM lParam) {	switch (message) 	{ 		case WM_INITDIALOG:  			if(iniSettings.decode_mode == 0)			{				CheckDlgButton(hwndDlg,IDC_PLAYBACK,TRUE);				CheckDlgButton(hwndDlg,IDC_WAV,TRUE);				if(iniSettings.outputFormat != 1					&& iniSettings.outputFormat != 5					&& iniSettings.outputFormat != 6					&& iniSettings.outputFormat != 7					&& iniSettings.outputFormat != 8)					CheckDlgButton(hwndDlg,IDC_16BIT,TRUE);				else if(iniSettings.outputFormat == 1)					CheckDlgButton(hwndDlg,IDC_16BIT,TRUE);				else if(iniSettings.outputFormat == 5)					CheckDlgButton(hwndDlg,IDC_16BIT_DITHER,TRUE);				else if(iniSettings.outputFormat == 6)					CheckDlgButton(hwndDlg,IDC_16BIT_L_SHAPE,TRUE);				else if(iniSettings.outputFormat == 7)					CheckDlgButton(hwndDlg,IDC_16BIT_M_SHAPE,TRUE);				else if(iniSettings.outputFormat == 8)					CheckDlgButton(hwndDlg,IDC_16BIT_H_SHAPE,TRUE);				CheckDlgButton(hwndDlg,IDC_WAV,TRUE);				EnableWindow(GetDlgItem(hwndDlg, IDC_AIFF), FALSE);				EnableWindow(GetDlgItem(hwndDlg, IDC_SUNAU), FALSE);				EnableWindow(GetDlgItem(hwndDlg, IDC_DECAU), FALSE);				EnableWindow(GetDlgItem(hwndDlg, IDC_24BIT), FALSE);				EnableWindow(GetDlgItem(hwndDlg, IDC_32BIT), FALSE);				EnableWindow(GetDlgItem(hwndDlg, IDC_FLOATS), FALSE);				EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT), TRUE);				EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_DITHER), TRUE);			}			else if(iniSettings.decode_mode == 1)			{				CheckDlgButton(hwndDlg,IDC_PLAYBACK,FALSE);				if(iniSettings.outputFormat == 1)					CheckDlgButton(hwndDlg,IDC_16BIT,TRUE);				else if(iniSettings.outputFormat == 2)					CheckDlgButton(hwndDlg,IDC_24BIT,TRUE);				else if(iniSettings.outputFormat == 3)					CheckDlgButton(hwndDlg,IDC_32BIT,TRUE);				else if(iniSettings.outputFormat == 4)					CheckDlgButton(hwndDlg,IDC_FLOATS,TRUE);				else if(iniSettings.outputFormat == 5)					CheckDlgButton(hwndDlg,IDC_16BIT_DITHER,TRUE);				else if(iniSettings.outputFormat == 6)					CheckDlgButton(hwndDlg,IDC_16BIT_L_SHAPE,TRUE);				else if(iniSettings.outputFormat == 7)					CheckDlgButton(hwndDlg,IDC_16BIT_M_SHAPE,TRUE);				else if(iniSettings.outputFormat == 8)					CheckDlgButton(hwndDlg,IDC_16BIT_H_SHAPE,TRUE);				if(iniSettings.fileType == 1)					CheckDlgButton(hwndDlg,IDC_WAV,TRUE);				else if(iniSettings.fileType == 2)					CheckDlgButton(hwndDlg,IDC_AIFF,TRUE);				else if(iniSettings.fileType == 3)					CheckDlgButton(hwndDlg,IDC_SUNAU,TRUE);				else if(iniSettings.fileType == 4)					CheckDlgButton(hwndDlg,IDC_DECAU,TRUE);			}			if(iniSettings.object_type == 0)				CheckDlgButton(hwndDlg,IDC_MAIN,TRUE);			else if(iniSettings.object_type == 1)				CheckDlgButton(hwndDlg,IDC_LC,TRUE);			else if(iniSettings.object_type == 3)				CheckDlgButton(hwndDlg,IDC_LTP,TRUE);			else if(iniSettings.object_type == 23)				CheckDlgButton(hwndDlg,IDC_LD,TRUE);			break;		case WM_CLOSE:			EndDialog(hwndDlg, -1);			break;		case WM_COMMAND: 			switch (LOWORD(wParam)) 			{				case IDC_BUTTON1:				{					if (IsDlgButtonChecked(hwndDlg, IDC_PLAYBACK) == BST_CHECKED)						set_decode_mode(0);            // Playback					else if (IsDlgButtonChecked(hwndDlg, IDC_DECODE) == BST_CHECKED)						set_decode_mode(1);            // Decode to File					if (IsDlgButtonChecked(hwndDlg, IDC_WAV) == BST_CHECKED)						set_fileType(1);             // Microsoft WAV					else if (IsDlgButtonChecked(hwndDlg, IDC_AIFF) == BST_CHECKED)						set_fileType(2);             // Apple/SGI AIFF					else if (IsDlgButtonChecked(hwndDlg, IDC_SUNAU) == BST_CHECKED)						set_fileType(3);             // Sun/NeXT AU					else if (IsDlgButtonChecked(hwndDlg, IDC_DECAU) == BST_CHECKED)						set_fileType(4);             // DEC AU					if (IsDlgButtonChecked(hwndDlg, IDC_16BIT) == BST_CHECKED)						set_outputFormat(1);             // 16 bit PCM					else if (IsDlgButtonChecked(hwndDlg, IDC_24BIT) == BST_CHECKED)						set_outputFormat(2);             // 24 bit PCM					else if (IsDlgButtonChecked(hwndDlg, IDC_32BIT) == BST_CHECKED)						set_outputFormat(3);             // 32 bit PCM					else if (IsDlgButtonChecked(hwndDlg, IDC_FLOATS) == BST_CHECKED)						set_outputFormat(4);             // 32 bit floats					else if (IsDlgButtonChecked(hwndDlg, IDC_16BIT_DITHER) == BST_CHECKED)						set_outputFormat(5);             // 16 bit PCM dithered					else if (IsDlgButtonChecked(hwndDlg, IDC_16BIT_L_SHAPE) == BST_CHECKED)						set_outputFormat(6);             // dithered LIGHT noise shaping					else if (IsDlgButtonChecked(hwndDlg, IDC_16BIT_M_SHAPE) == BST_CHECKED)						set_outputFormat(7);             // dithered MEDIUM noise shaping					else if (IsDlgButtonChecked(hwndDlg, IDC_16BIT_H_SHAPE) == BST_CHECKED)						set_outputFormat(8);             // dithered HEAVY noise shaping					if (IsDlgButtonChecked(hwndDlg, IDC_MAIN) == BST_CHECKED)						set_object_type(0);             // Main					else if (IsDlgButtonChecked(hwndDlg, IDC_LC) == BST_CHECKED)						set_object_type(1);             // Low Complexity					else if (IsDlgButtonChecked(hwndDlg, IDC_LTP) == BST_CHECKED)						set_object_type(3);             // Long Term Prediction					else if (IsDlgButtonChecked(hwndDlg, IDC_LD) == BST_CHECKED)						set_object_type(23);            // Low Delay					EndDialog(hwndDlg, -2);					return TRUE;				}				case IDC_BUTTON6:					EndDialog(hwndDlg, -7);					return TRUE;				case IDC_PLAYBACK:					CheckDlgButton(hwndDlg,IDC_WAV,TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_AIFF), FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_SUNAU), FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_DECAU), FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_24BIT), FALSE);					CheckDlgButton(hwndDlg,IDC_24BIT,FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_32BIT), FALSE);					CheckDlgButton(hwndDlg,IDC_32BIT,FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_FLOATS), FALSE);					CheckDlgButton(hwndDlg,IDC_FLOATS,FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_DITHER), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_L_SHAPE), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_M_SHAPE), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_H_SHAPE), TRUE);					if (IsDlgButtonChecked(hwndDlg, IDC_16BIT_DITHER) != BST_CHECKED						&& IsDlgButtonChecked(hwndDlg, IDC_16BIT_L_SHAPE) != BST_CHECKED						&& IsDlgButtonChecked(hwndDlg, IDC_16BIT_M_SHAPE) != BST_CHECKED						&& IsDlgButtonChecked(hwndDlg, IDC_16BIT_H_SHAPE) != BST_CHECKED)						CheckDlgButton(hwndDlg,IDC_16BIT,TRUE);					break;				case IDC_DECODE:					EnableWindow(GetDlgItem(hwndDlg, IDC_AIFF), FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_SUNAU), FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_DECAU), FALSE);					EnableWindow(GetDlgItem(hwndDlg, IDC_24BIT), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_32BIT), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_FLOATS), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_DITHER), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_L_SHAPE), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_M_SHAPE), TRUE);					EnableWindow(GetDlgItem(hwndDlg, IDC_16BIT_H_SHAPE), TRUE);					break;				default:					break;       	  		}	}	return FALSE; }/******************************** end of main.c ********************************/

⌨️ 快捷键说明

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