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

📄 proppage.cpp

📁 音频编码
💻 CPP
📖 第 1 页 / 共 2 页
字号:
        case IDC_RADIO_CBR:        case IDC_RADIO_VBR:            m_pAEProps->set_Variable(LOWORD(wParam)-IDC_RADIO_CBR);            SetDirty();            break;        case IDC_CHECK_PES:            m_pAEProps->set_PESOutputEnabled(IsDlgButtonChecked(hwnd, IDC_CHECK_PES));            SetDirty();            break;        case IDC_CHECK_COPYRIGHT:            m_pAEProps->set_CopyrightFlag(IsDlgButtonChecked(hwnd, IDC_CHECK_COPYRIGHT));            SetDirty();            break;        case IDC_CHECK_ORIGINAL:            m_pAEProps->set_OriginalFlag(IsDlgButtonChecked(hwnd, IDC_CHECK_ORIGINAL));            SetDirty();            break;        case IDC_CHECK_CRC:            m_pAEProps->set_CRCFlag(IsDlgButtonChecked(hwnd, IDC_CHECK_CRC));            SetDirty();            break;        case IDC_FORCE_MONO:            m_pAEProps->set_ForceMono(IsDlgButtonChecked(hwnd, IDC_FORCE_MONO));            SetDirty();            break;        case IDC_SET_DURATION:            m_pAEProps->set_SetDuration(IsDlgButtonChecked(hwnd, IDC_SET_DURATION));            SetDirty();            break;        }        return TRUE;    case WM_DESTROY:        return TRUE;    default:        return FALSE;    }    return TRUE;}//// OnApplyChanges//HRESULT CMpegAudEncPropertyPage::OnApplyChanges(){    m_pAEProps->get_Bitrate(&m_dwBitrate);    m_pAEProps->get_Variable(&m_dwVariable);    m_pAEProps->get_VariableMin(&m_dwMin);    m_pAEProps->get_VariableMax(&m_dwMax);    m_pAEProps->get_Quality(&m_dwQuality);    m_pAEProps->get_VariableQ(&m_dwVBRq);    m_pAEProps->get_SampleRate(&m_dwSampleRate);    m_pAEProps->get_CRCFlag(&m_dwCRC);    m_pAEProps->get_ForceMono(&m_dwForceMono);    m_pAEProps->get_SetDuration(&m_dwSetDuration);    m_pAEProps->get_CopyrightFlag(&m_dwCopyright);    m_pAEProps->get_OriginalFlag(&m_dwOriginal);    m_pAEProps->SaveAudioEncoderPropertiesToRegistry();    m_pAEProps->ApplyChanges();    return S_OK;}//// Initialize dialogbox controls with proper values//void CMpegAudEncPropertyPage::InitPropertiesDialog(HWND hwndParent){    EnableControls(hwndParent, TRUE);    m_hwndQuality = GetDlgItem(hwndParent,IDC_SLIDER_QUALITY);    DWORD dwQuality;    m_pAEProps->get_Quality(&dwQuality);    SendDlgItemMessage(hwndParent, IDC_SLIDER_QUALITY, TBM_SETRANGE, 1, MAKELONG (2,9));    SendDlgItemMessage(hwndParent, IDC_SLIDER_QUALITY, TBM_SETPOS, 1, dwQuality);    if (dwQuality>=0 && dwQuality<10)        SetDlgItemText(hwndParent,IDC_TEXT_QUALITY,szQualityDesc[dwQuality]);    //    // initialize sample rate selection    //    DWORD dwSourceSampleRate;    m_pAEProps->get_SourceSampleRate(&dwSourceSampleRate);    SendDlgItemMessage(hwndParent, IDC_COMBO_SAMPLE_RATE, CB_RESETCONTENT, 0, 0L);    switch (dwSourceSampleRate)    {    case 48000:    case 24000:    case 12000:        m_srIdx = 0;        break;    case 32000:    case 16000:    case  8000:        m_srIdx = 2;        break;    case 44100:    case 22050:    case 11025:    default:        m_srIdx = 1;    }    for (int i = 0; i < 3; i++)        SendDlgItemMessage(hwndParent, IDC_COMBO_SAMPLE_RATE, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)srRates[i * 3 + m_srIdx].lpSampleRate);    DWORD dwSampleRate;    m_pAEProps->get_SampleRate(&dwSampleRate);    m_pAEProps->set_SampleRate(dwSampleRate);    int nSR = 0;    while (dwSampleRate != srRates[nSR * 3 + m_srIdx].dwSampleRate && nSR < 3)    {        nSR++;    }    if (nSR >= 3)        nSR = 0;    SendDlgItemMessage(hwndParent, IDC_COMBO_SAMPLE_RATE, CB_SETCURSEL, nSR, 0);    DWORD dwChannels;    m_pAEProps->get_SourceChannels(&dwChannels);    //    //initialize VBRq combo box    //    int k;    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRq, CB_RESETCONTENT, 0, 0);    for (k = 0; k < 10; k++)        SendDlgItemMessage(hwndParent, IDC_COMBO_VBRq, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szVBRqDesc[k]);    DWORD dwVBRq;    m_pAEProps->get_VariableQ(&dwVBRq);    if (dwVBRq<0)        dwVBRq = 0;    if (dwVBRq>9)        dwVBRq = 9;    m_pAEProps->set_VariableQ(dwVBRq);    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRq, CB_SETCURSEL, dwVBRq, 0);//////////////////////////////////////// initialize CBR selection//////////////////////////////////////    int nSt;    SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_RESETCONTENT, 0, 0);    if (dwSampleRate >= 32000)    {        // If target sampling rate is less than 32000, consider        // MPEG 1 audio        nSt = 0;        for (int i = 0; i < 14; i++)            SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[0][i]);    }    else    {        // Consider MPEG 2 / 2.5 audio        nSt = 1;        for (int i = 0; i < 14 ; i++)            SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[1][i]);    }    DWORD dwBitrate;    m_pAEProps->get_Bitrate(&dwBitrate);    int nBitrateSel = 0;    // BitRateValue[][i] is in ascending order    // We use this fact. We also know there are 14 bitrate values available.    // We are going to use the closest possible, so we can limit loop with 13    while (nBitrateSel < 13 && dwBitRateValue[nSt][nBitrateSel] < dwBitrate)        nBitrateSel++;    SendDlgItemMessage(hwndParent, IDC_COMBO_CBR, CB_SETCURSEL, nBitrateSel, 0);    // check if the specified bitrate is found exactly and correct if not    if (dwBitRateValue[nSt][nBitrateSel] != dwBitrate)    {        dwBitrate = dwBitRateValue[nSt][nBitrateSel];        // we can change it, because it is independent of any other parameters        // (but depends on some of them!)        m_pAEProps->set_Bitrate(dwBitrate);    }    //    // Check VBR/CBR radio button    //    DWORD dwVariable;    m_pAEProps->get_Variable(&dwVariable);    CheckRadioButton(hwndParent, IDC_RADIO_CBR, IDC_RADIO_VBR, IDC_RADIO_CBR + dwVariable);//////////////////////////////////////////////////// initialize VBR selection//////////////////////////////////////////////////    //VBRMIN, VBRMAX    int j, nST;    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_RESETCONTENT, 0, 0);    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_RESETCONTENT, 0, 0);    if (dwSampleRate >= 32000)    {            nST = 0;            for (j=0; j<14 ;j++) {                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[0][j]);                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[0][j]);            }    }    else    {            nST = 1;            for (j = 0; j < 14; j++)            {                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[1][j]);                SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_ADDSTRING, 0, (LPARAM)(LPCTSTR)szBitRateString[1][j]);            }    }    DWORD dwMin,dwMax;    m_pAEProps->get_VariableMin(&dwMin);    m_pAEProps->get_VariableMax(&dwMax);    int nVariableMinSel = 0;    int nVariableMaxSel = 0;        // BitRateValue[][i] is in ascending order    // We use this fact. We also know there are 14 bitrate values available.    // We are going to use the closest possible, so we can limit loop with 13    while (nVariableMinSel<13 && dwBitRateValue[nST][nVariableMinSel] < dwMin)        nVariableMinSel++;    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMIN, CB_SETCURSEL, nVariableMinSel, 0);    while (nVariableMaxSel<13 && dwBitRateValue[nST][nVariableMaxSel] < dwMax)        nVariableMaxSel++;    SendDlgItemMessage(hwndParent, IDC_COMBO_VBRMAX, CB_SETCURSEL, nVariableMaxSel, 0);        // check if the specified bitrate is found exactly and correct if not    if (dwBitRateValue[nST][nVariableMinSel] != dwMin)    {        dwMin = dwBitRateValue[nST][nVariableMinSel];        // we can change it, because it is independent of any other parameters        // (but depends on some of them!)        m_pAEProps->set_VariableMin(dwMin);    }    // check if the specified bitrate is found exactly and correct if not    if (dwBitRateValue[nST][nVariableMaxSel] != dwMax)    {        dwMax = dwBitRateValue[nST][nVariableMaxSel];        // we can change it, because it is independent of any other parameters        // (but depends on some of them!)        m_pAEProps->set_VariableMax(dwMax);    }    //    // initialize checkboxes    //    DWORD dwPES;    m_pAEProps->get_PESOutputEnabled(&dwPES);    dwPES = 0;    CheckDlgButton(hwndParent, IDC_CHECK_PES, dwPES ? BST_CHECKED : BST_UNCHECKED);    DWORD dwCRC;    m_pAEProps->get_CRCFlag(&dwCRC);    CheckDlgButton(hwndParent, IDC_CHECK_CRC, dwCRC ? BST_CHECKED : BST_UNCHECKED);    DWORD dwForceMono;    m_pAEProps->get_ForceMono(&dwForceMono);    CheckDlgButton(hwndParent, IDC_FORCE_MONO, dwForceMono ? BST_CHECKED : BST_UNCHECKED);    DWORD dwSetDuration;    m_pAEProps->get_SetDuration(&dwSetDuration);    CheckDlgButton(hwndParent, IDC_SET_DURATION, dwSetDuration ? BST_CHECKED : BST_UNCHECKED);    DWORD dwCopyright;    m_pAEProps->get_CopyrightFlag(&dwCopyright);    CheckDlgButton(hwndParent, IDC_CHECK_COPYRIGHT, dwCopyright ? BST_CHECKED : BST_UNCHECKED);    DWORD dwOriginal;    m_pAEProps->get_OriginalFlag(&dwOriginal);    CheckDlgButton(hwndParent, IDC_CHECK_ORIGINAL, dwOriginal ? BST_CHECKED : BST_UNCHECKED);}////////////////////////////////////////////////////////////////// EnableControls////////////////////////////////////////////////////////////////void CMpegAudEncPropertyPage::EnableControls(HWND hwndParent, bool bEnable){    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_PES), false);//bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_CBR), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_CBR), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_RADIO_VBR), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_VBRMIN), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_VBRMAX), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_COPYRIGHT), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_ORIGINAL), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_CHECK_CRC), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_FORCE_MONO), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_SET_DURATION), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_SLIDER_QUALITY), bEnable);    EnableWindow(GetDlgItem(hwndParent, IDC_COMBO_SAMPLE_RATE), bEnable);}//// SetDirty//// notifies the property page site of changesvoid CMpegAudEncPropertyPage::SetDirty(){    m_bDirty = TRUE;    if (m_pPageSite)        m_pPageSite->OnStatusChange(PROPPAGESTATUS_DIRTY);}

⌨️ 快捷键说明

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