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

📄 audio.c

📁 飞漫公司的minigui的1.6.8收费增值版本的demon等示例程序
💻 C
📖 第 1 页 / 共 2 页
字号:
}static int musicplay_msg_cb(HWND hWnd, int message, WPARAM wParam, LPARAM lParam, int *result){    *result = MSG_CB_GOON;    return 0;}static void SetControlValue(HWND hParent, int leftrightflag, int index){    int nStep;    int nPos;    skin_head_t *pskin;    sie_slider_t slider_info;        if (leftrightflag) {        pskin = get_window_skin(GetDlgItem (hParent, IDC_MUSICPLAY_CONTROL_MAIN));         skin_get_slider_info(pskin, SIID_MUSICPLAY_MAIN_VOLUME, &slider_info);        nStep = (slider_info.max_pos - slider_info.min_pos) /10;        if (nStep == 0)            nStep =1;        nPos = slider_info.cur_pos - nStep;          if (nPos < slider_info.min_pos)            nPos = slider_info.min_pos;                skin_set_thumb_pos(pskin, SIID_MUSICPLAY_MAIN_VOLUME, nPos);                }    else {        pskin = get_window_skin(GetDlgItem (hParent, IDC_MUSICPLAY_CONTROL_MAIN));         skin_get_slider_info(pskin, SIID_MUSICPLAY_MAIN_VOLUME, &slider_info);        nStep = (slider_info.max_pos - slider_info.min_pos) / 10;        if (nStep == 0)            nStep =1;        nPos = slider_info.cur_pos + nStep;          if (nPos > slider_info.max_pos)            nPos = slider_info.max_pos;                skin_set_thumb_pos(pskin, SIID_MUSICPLAY_MAIN_VOLUME, nPos);    }     UpdateWindow(hParent, TRUE);}char *cursorname[] = {"green.bmp", "yellow.bmp", "red.bmp", "darkgreen.bmp", "darkyellow.bmp", "darkred.bmp"};BITMAP volumecursor[6];PBITMAP darkcursor[16], lightcursor[16];static void initvolumeindicator(void){    int i, green = 11, yellow = 3, red = 2;    for (i = 0; i < 6; i++) {        if (pdag_load_bitmap(&volumecursor[i], NULL, NULL, cursorname[i]) < 0)            fprintf(stderr, "load volume indicator error: music/%s\n", cursorname[i]);    }    for (i = 0; red; i++) {        if (green) {            lightcursor[i] = &volumecursor[0];            darkcursor[i] = &volumecursor[3];            green--;        }        else if (yellow) {            lightcursor[i] = &volumecursor[1];            darkcursor[i] = &volumecursor[4];            yellow--;        }        else if (red) {            lightcursor[i] = &volumecursor[2];            darkcursor[i] = &volumecursor[5];            red--;        }    }}static void getvolume(int *lvolume, int *rvolume){    static Uint32 tv = 0;#ifdef WIN32    rand (tv);#else    srandom(tv);#endif    *lvolume = (int)(rand()) % 17;    *rvolume = (int)(rand()) % 17;    tv++;}static void drawcursor(HWND hwnd){    int i, nth = 2, volume, lvolume, rvolume;    int w = volumecursor[0].bmWidth, h = volumecursor[0].bmHeight;    int x = 150, y = 0;    HDC hdc;    getvolume(&lvolume, &rvolume);    hdc = GetClientDC(hwnd);    volume = lvolume;    while (nth--) {        x = 160;        if (nth == 1)            y = 202;        else if (nth == 0)            y = 205 + h;        for (i = 0; i < volume; i++) {            FillBoxWithBitmap(hdc, x, y, w, h, lightcursor[i]);            x += w + 1;        }        for (i = volume; i < 16; i++) {            FillBoxWithBitmap(hdc, x, y, w, h, darkcursor[i]);            x += w + 1;        }        volume = rvolume;    }    ReleaseDC(hdc);}static void progress(HWND hwnd){    int pos;    char time[6];    skin_head_t *pskin;    HWND hTemp;    hTemp = create_skin_control(&musicplay_skin_temp,                        hwnd, IDC_MUSICPLAY_CONTROL_MAIN, 0, 24, 320,  192);    pskin = get_window_skin(hTemp);    num2time(time, elapse);    skin_set_item_label(pskin, SIID_TIMER_ELAPSE, time);    //num2time(time, totaltime - elapse);    //skin_set_item_label(pskin, SIID_TIMER_REMAIN, time);    num2time(time, totaltime);    skin_set_item_label(pskin, SIID_TIMER_TOTAL, time);    pos = elapse / steplong;    skin_set_thumb_pos(pskin, SIID_MUSICPLAY_MAIN_PROGRESS, pos);    elapse++;    if (elapse > totaltime)        elapse = 0;}extern void draw_caption_bar(HDC, HWND);static int musicplayWinProc(HWND hWnd, int message, WPARAM wparam, LPARAM lparam){    switch (message) {        case MSG_CREATE:            init_musicplay_controlbar();            create_musicplay_controlbar(hWnd);            init_musicplay();            create_musicplay(hWnd);            initvolumeindicator();            SetTimer(hWnd, ID_TIME, 100);            SetTimer(hWnd, ID_TIMER_VOLUME, 10);            steplong = (float)totaltime / (float)280;            break;        case MSG_SIZECHANGING:        {            RECT* rcResult = (RECT*)lparam;            rcResult->top = 0;            rcResult->left = 0;            rcResult->right = 320;            rcResult->bottom = 240;            return 0;        }        case MSG_LBUTTONDOWN:            if (LOWORD(lparam) > 298 && HIWORD(lparam) < 24)                SendMessage (hWnd, MSG_CLOSE, 0, 0);            break;        case MSG_CLOSE:            KillTimer(hWnd, ID_TIMER_VOLUME);            KillTimer(hWnd, ID_TIME);            destroy_musicplay_controlbar();            destroy_musicplay();            DestroyMainWindow (hWnd);            return 0;        case MSG_PAINT:        {            HDC hDC;            hDC = BeginPaint(hWnd);            //SetBrushColor (hDC, RGB2Pixel (HDC_SCREEN, 0xff, 0x0, 0xff));            //SetBrushColor (hDC, RGB2Pixel (HDC_SCREEN, 0x86, 0x99, 0xcc));            SetBrushColor (hDC, RGB2Pixel (HDC_SCREEN, 111, 193, 180));            FillBox (hDC, 0, 0, 320, 24);            //FillBox (hDC, 0, 216, 320, 24);            SetBkMode (hDC, BM_TRANSPARENT);//#ifdef MGDEMO_ENGLISH
//			TextOut (hDC, 2, 5, "Music");
//#else
	
            TextOut (hDC, 2, 5, "音乐");
//#endif                        draw_caption_bar(hDC, hWnd);            EndPaint(hWnd, hDC);            return 0;        }        case MSG_KEYDOWN:            switch (wparam) {            case SCANCODE_CURSORBLOCKLEFT:                SetControlValue(hWnd, 1, 0);                break;            case SCANCODE_CURSORBLOCKRIGHT:                SetControlValue(hWnd, 0, 0);                break;            case SCANCODE_F1:                break;            case SCANCODE_F2:                break;            case SCANCODE_F3:                break;            case SCANCODE_ENTER:                //drawcursor(hWnd);                break;            case SCANCODE_ESCAPE:                SendMessage (hWnd, MSG_CLOSE, 0, 0);                break;            }            break;        case MSG_COMMAND:            break;        case MSG_TIMER:            if (wparam == ID_TIMER_VOLUME) {                drawcursor(hWnd);            }            else if (wparam == ID_TIME) {                progress(hWnd);            }            break;    }     return DefaultMainWinProc(hWnd, message, wparam, lparam);}static int init_musicplay_win(HWND hHosting){    MAINWINCREATE CreateInfo;    HWND hwnd;    CreateInfo.dwStyle = WS_VISIBLE;//#ifdef MGDEMO_ENGLISH
//    CreateInfo.spCaption = "music play";
//#else
    CreateInfo.spCaption = "音乐";//#endif    CreateInfo.dwExStyle = WS_EX_TOPMOST;    CreateInfo.hMenu = 0;    CreateInfo.hCursor = GetSystemCursor(0);    CreateInfo.hIcon = 0;    CreateInfo.MainWindowProc = musicplayWinProc;    CreateInfo.lx = 0;    CreateInfo.ty = 0;    CreateInfo.rx = 320;    CreateInfo.by = 240;    CreateInfo.iBkColor = RGB2Pixel(HDC_SCREEN, 0x86, 0x99, 0xcc);    CreateInfo.dwAddData = 0;    CreateInfo.hHosting = hHosting;     hwnd = CreateMainWindow(&CreateInfo);    ShowWindow (hwnd, SW_SHOWNORMAL);    return 0;       }   void audioMain(HWND hWnd){    init_musicplay_win(hWnd);}

⌨️ 快捷键说明

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